meson: Autodetect when building for iOS

Instead of relying on `system` to be set correctly in the
cross-compile file, detect when we're building for iOS/watchOS/tvOS.
This commit is contained in:
Nirbheek Chauhan 2020-05-29 00:31:35 +05:30
parent c6af3c7749
commit 3c78d0cec6

View File

@ -33,6 +33,16 @@ endif
host_system = host_machine.system()
if host_system == 'darwin'
ios_test_code = '''#include <TargetConditionals.h>
#if ! TARGET_OS_IPHONE
#error "Not iOS/tvOS/watchOS/iPhoneSimulator"
#endif'''
if cc.compiles(ios_test_code, name : 'building for iOS')
host_system = 'ios'
endif
endif
glib_version = meson.project_version()
glib_api_version = '2.0'
version_arr = glib_version.split('.')