Apple M1: Enable CMake cross compilation

Modify the build script to use CMake's cross compilation infrastructure instead
of running CMake natively in x86_64 and arm64 mode to configure the two project
files. This should fix the builds with CMake executables installed through
homebrew and should pave the way for building universal binaries on x86_64
systems.
This commit is contained in:
Skyler Saleh 2021-05-02 01:50:43 -07:00
parent 7a44a7ee39
commit b72c47f442

View File

@ -234,9 +234,12 @@ def build(config):
env['CMAKE_OSX_ARCHITECTURES'] = arch
subprocess.check_call([
'arch', '-'+arch,
'cmake', '../../', '-G', config['generator'],
'-DCMAKE_BUILD_TYPE=' + config['build_type'],
# System name needs to be specified for CMake to use
# the specified CMAKE_SYSTEM_PROCESSOR
'-DCMAKE_SYSTEM_NAME=Darwin',
'-DCMAKE_SYSTEM_PROCESSOR='+arch,
'-DCMAKE_OSX_DEPLOYMENT_TARGET='
+ config[arch+"_mac_os_deployment_target"],
'-DMACOS_CODE_SIGNING_IDENTITY='
@ -249,8 +252,8 @@ def build(config):
threads = multiprocessing.cpu_count()
subprocess.check_call(['cmake', '--build', '.',
'--config', config['build_type'],
'--parallel', '{}'.format(threads)], cwd=arch)
'--config', config['build_type'],
'--parallel', '{}'.format(threads)], cwd=arch)
dst_app = config["dst_app"]