diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-11-22 04:26:27 +0530 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2022-12-07 00:59:12 +0000 |
commit | a3631176b56425625eec0da900ef67b23bb05a7d (patch) | |
tree | d20cee8a95c998dc6b31c597e43f5ec37a403701 | |
parent | e8cd7fee3b207dbaf2c085c424322a0733d2f11e (diff) |
cerbero: Fix ios cross-compile with cmake on M1
Without this, the cmake will insert `-arch arm64` when cross-compiling
to x86_64. This is in general the correct way to do cross-compilation.
See: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1039>
-rw-r--r-- | cerbero/build/build.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cerbero/build/build.py b/cerbero/build/build.py index dabbe250..bdc8d5a7 100644 --- a/cerbero/build/build.py +++ b/cerbero/build/build.py @@ -671,11 +671,18 @@ class CMake (MakefilesBase): self.make += ['VERBOSE=1'] if self.config.target_platform == Platform.WINDOWS: - self.configure_options += ['-DCMAKE_SYSTEM_NAME=Windows'] - elif self.config.target_platform == Platform.ANDROID: - self.configure_options += ['-DCMAKE_SYSTEM_NAME=Linux'] + system_name = 'Windows' + elif self.config.target_platform in (Platform.LINUX, Platform.ANDROID): + system_name = 'Linux' + elif self.config.target_platform == Platform.DARWIN: + system_name = 'Darwin' + elif self.config.target_platform == Platform.IOS: + system_name = 'iOS' - if self.config.target_platform == Platform.DARWIN: + if self.config.cross_compiling(): + self.configure_options += [f'-DCMAKE_SYSTEM_NAME={system_name}'] + + if self.config.target_platform in (Platform.DARWIN, Platform.IOS): self.configure_options += ['-DCMAKE_OSX_ARCHITECTURES=' + self.config.target_arch] # FIXME: Maybe export the sysroot properly instead of doing regexp magic |