Initial meson build for macOS

This commit is contained in:
Joseph Donofry 2021-12-23 20:31:44 -05:00
parent bc5c8189da
commit eb9319b6ed
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
3 changed files with 104 additions and 8 deletions

View file

@ -119,6 +119,30 @@ build-macos:
- .hunter/
- "${CCACHE_DIR}"
build-macos-meson:
stage: build
tags: [macos]
needs: []
variables:
GIT_SUBMODULE_STRATEGY: normal
script:
- export PATH=/usr/local/opt/qt@5/bin/:${PATH}
- meson setup --prefix=${PWD}/build/nheko.app --bindir=Contents/MacOS build
- meson compile -C build
- meson install --skip-subprojects -C build
artifacts:
paths:
- build/nheko.app
name: nheko-${CI_COMMIT_SHORT_SHA}-macos-app
expose_as: 'macos-app'
public: false
cache:
key: "$CI_JOB_NAME"
when: 'always'
paths:
- .ccache
- subprojects/packagecache/
codesign-macos:
stage: deploy
tags: [macos]

View file

@ -18,7 +18,9 @@ elif target_machine.system() == 'darwin'
else
qt5_modules += 'DBus'
endif
qt5_dep = dependency('qt5', modules: qt5_modules, include_type: 'system')
inc = include_directories('src', 'includes', 'third_party/cpp-httplib-0.5.12')
deps = [
@ -90,6 +92,7 @@ if sdp_dep.found() and webrtc_dep.found()
deps += [sdp_dep, webrtc_dep]
add_project_arguments('-DGSTREAMER_AVAILABLE', language: 'cpp')
if target_machine.system() != 'darwin'
xcb_dep = dependency('xcb', required: get_option('screenshare_x11'))
xcb_ewmh_dep = dependency('xcb-ewmh', required: get_option('screenshare_x11'))
if xcb_dep.found() and xcb_ewmh_dep.found()
@ -97,6 +100,7 @@ if sdp_dep.found() and webrtc_dep.found()
add_project_arguments('-DXCB_AVAILABLE', language: 'cpp')
endif
endif
endif
backtrace_check = '''#include<execinfo.h>
#ifndef HAVE_BACKTRACE_SYMBOLS_FD
@ -119,6 +123,20 @@ configure_file(input : 'meson/nheko.h',
output : 'config_nheko.h',
configuration : conf_data)
if host_machine.system() == 'darwin'
# Identify MacOS bundle
macos_bundle_data = configuration_data()
macos_bundle_data.set('MACOSX_BUNDLE_BUNDLE_NAME', meson.project_name())
macos_bundle_data.set('MACOSX_BUNDLE_EXECUTABLE_NAME', meson.project_name())
macos_bundle_data.set('MACOSX_BUNDLE_INFO_STRING', meson.project_version())
macos_bundle_data.set('MACOSX_BUNDLE_BUNDLE_VERSION', meson.project_version())
macos_bundle_data.set('MACOSX_BUNDLE_LONG_VERSION_STRING', meson.project_version())
macos_bundle_data.set('MACOSX_BUNDLE_SHORT_VERSION_STRING', meson.project_version())
macos_bundle_data.set('MACOSX_BUNDLE_COPYRIGHT', 'Copyright (c) 2021 Nheko Contributors')
macos_bundle_data.set('MACOSX_BUNDLE_GUI_IDENTIFIER', 'io.github.nheko-reborn.nheko')
macos_bundle_data.set('MACOSX_BUNDLE_ICON_FILE', 'nheko')
endif
vcs_tag(input: 'meson/version.h', output: 'nheko_version.h', replace_string: '@PROJECT_VERSION@')
moc_files = qt5.preprocess(moc_headers :
@ -329,14 +347,21 @@ endif
subdir('resources/langs')
resources = qt5.compile_resources(name: 'res', sources: 'resources/res.qrc')
cpp_args = ['-DQAPPLICATION_CLASS=QApplication']
if target_machine.system() == 'darwin'
cpp_args += ['-DMACOS_USE_BUNDLE']
endif
executable('nheko',
sources, moc_files, resources, translations,
cpp_args: '-DQAPPLICATION_CLASS=QApplication',
cpp_args: cpp_args,
include_directories: inc,
dependencies : deps,
win_subsystem: 'windows,6.1',
install: true)
if target_machine.system() != 'windows' and target_machine.system() != 'darwin'
install_data([
'resources/nheko-16.png',
@ -360,5 +385,14 @@ if target_machine.system() != 'windows' and target_machine.system() != 'darwin'
], install_dir: 'share/icons/hicolor')
install_data('resources/nheko.desktop', install_dir: 'share/applications')
install_data('resources/nheko.appdata.xml', install_dir: 'share/metainfo')
elif target_machine.system() == 'darwin'
install_data('resources/nheko.icns', install_dir : 'Contents/Resources')
configure_file(
input : 'meson/MacOSXBundleInfo.plist.in',
output : 'Info.plist',
configuration : macos_bundle_data,
install : true,
install_dir : 'Contents'
)
endif

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>@MACOSX_BUNDLE_EXECUTABLE_NAME@</string>
<key>CFBundleGetInfoString</key>
<string>@MACOSX_BUNDLE_INFO_STRING@</string>
<key>CFBundleIconFile</key>
<string>@MACOSX_BUNDLE_ICON_FILE@</string>
<key>CFBundleIdentifier</key>
<string>@MACOSX_BUNDLE_GUI_IDENTIFIER@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>@MACOSX_BUNDLE_LONG_VERSION_STRING@</string>
<key>CFBundleName</key>
<string>@MACOSX_BUNDLE_BUNDLE_NAME@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@MACOSX_BUNDLE_SHORT_VERSION_STRING@</string>
<key>CFBundleVersion</key>
<string>@MACOSX_BUNDLE_BUNDLE_VERSION@</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>@MACOSX_BUNDLE_COPYRIGHT@</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>