From 0c38a07faf6ea88f6d83c2c5137a797639795097 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Wed, 10 Feb 2021 14:24:17 +0000 Subject: [PATCH] Cross files for macOS and iOS architectures --- cross/ios-simulator.txt | 19 +++++++++++++++++++ cross/ios.txt | 20 ++++++++++++++++++++ cross/macos-arm64.txt | 20 ++++++++++++++++++++ cross/macos-x86_64.txt | 19 +++++++++++++++++++ meson.build | 32 +++++++++++++++++++++++--------- 5 files changed, 101 insertions(+), 9 deletions(-) create mode 100644 cross/ios-simulator.txt create mode 100644 cross/ios.txt create mode 100644 cross/macos-arm64.txt create mode 100644 cross/macos-x86_64.txt diff --git a/cross/ios-simulator.txt b/cross/ios-simulator.txt new file mode 100644 index 0000000..b03149c --- /dev/null +++ b/cross/ios-simulator.txt @@ -0,0 +1,19 @@ +[constants] +sysroot = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk' +common_args = [ '-isysroot', sysroot, '-arch', 'x86_64', '-mios-version-min=8' ] + +[host_machine] +cpu_family = 'x86_64' +cpu = 'x86_64' +system = 'darwin' +endian = 'little' + +[binaries] +c = 'cc' +cpp = 'c++' +strip = 'strip' + +[built-in options] +c_args = common_args +cpp_args = common_args + [ '-stdlib=libc++' ] +cpp_link_args = cpp_args diff --git a/cross/ios.txt b/cross/ios.txt new file mode 100644 index 0000000..c9a913a --- /dev/null +++ b/cross/ios.txt @@ -0,0 +1,20 @@ +[constants] +sysroot = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk' +common_args = [ '-isysroot', sysroot, '-arch', 'arm64', '-arch', 'armv7', '-mios-version-min=8' ] + +[host_machine] +cpu_family = 'aarch64' +cpu = 'aarch64' +system = 'darwin' +endian = 'little' + +[binaries] +c = 'cc' +cpp = 'c++' +strip = 'strip' + +[built-in options] +b_bitcode = true +c_args = common_args +cpp_args = common_args + [ '-stdlib=libc++' ] +cpp_link_args = cpp_args diff --git a/cross/macos-arm64.txt b/cross/macos-arm64.txt new file mode 100644 index 0000000..1a7c322 --- /dev/null +++ b/cross/macos-arm64.txt @@ -0,0 +1,20 @@ +[host_machine] +cpu_family = 'aarch64' +cpu = 'aarch64' +system = 'darwin' +endian = 'little' + +[properties] +needs_exe_wrapper = false + +[binaries] +c = 'cc' +cpp = 'c++' +strip = 'strip' + +[built-in options] +c_args = ['-arch', 'arm64'] +cpp_args = ['-arch', 'arm64'] +cpp_link_args = ['-arch', 'arm64'] + + diff --git a/cross/macos-x86_64.txt b/cross/macos-x86_64.txt new file mode 100644 index 0000000..ad979a4 --- /dev/null +++ b/cross/macos-x86_64.txt @@ -0,0 +1,19 @@ +[host_machine] +cpu_family = 'x86_64' +cpu = 'x86_64' +system = 'darwin' +endian = 'little' + +[properties] +needs_exe_wrapper = false + +[binaries] +c = 'cc' +cpp = 'c++' +strip = 'strip' + +[built-in options] +c_args = ['-arch', 'x86_64'] +cpp_args = ['-arch', 'x86_64'] +cpp_link_args = ['-arch', 'x86_64'] + diff --git a/meson.build b/meson.build index c7fcaff..9f5f8b8 100644 --- a/meson.build +++ b/meson.build @@ -295,19 +295,32 @@ if system == 'darwin' vamp_symbol_args += [ '-exported_symbols_list', meson.source_root() / 'vamp/vamp-plugin.list' ] + + have_version_min = false + foreach arg: get_option('cpp_args') + message('arg is ' + arg) + if arg.contains('version-min') + have_version_min = true + endif + endforeach + if architecture == 'aarch64' - config_summary += { 'Architecture': 'ARM (macOS 11 or newer)' } - arch_flags = [ - '-mmacosx-version-min=11', - '-arch', 'arm64' + mac_platform_arguments = [ + '-arch', 'arm64', ] + if not have_version_min + mac_platform_arguments += [ '-mmacosx-version-min=11' ] + endif elif architecture == 'x86_64' - config_summary += { 'Architecture': 'Intel (macOS 10.11 or newer)' } - arch_flags = [ - '-mmacosx-version-min=10.11', + mac_platform_arguments = [ '-arch', 'x86_64', ] - endif # architecture + if not have_version_min + mac_platform_arguments += [ '-mmacosx-version-min=10.13' ] + endif + else # begin architecture != 'aarch64' or 'x86_64' + error('Build for architecture ' + architecture + ' is not supported on this platform') + endif # end architecture elif system == 'windows' if cpp.get_id() == 'msvc' @@ -506,5 +519,6 @@ summary({'prefix': get_option('prefix'), 'datadir': get_option('datadir'), }, section: 'Directories') -summary(config_summary, section: 'Configuration', bool_yn: true) +summary(config_summary + { 'Architecture': architecture }, + section: 'Configuration', bool_yn: true) summary(target_summary, section: 'Build targets', bool_yn: true)