From 0e4c358f357e23ad4d2f86d6801da2648dbf8ec2 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 24 Apr 2021 19:44:16 +0300 Subject: [PATCH] Xcode: add objective C flags to plain C because Xcode requires it. --- mesonbuild/backend/xcodebackend.py | 11 +++++++++-- run_tests.py | 4 +--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index dca045f39..ff0bae70d 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -1445,14 +1445,21 @@ class XCodeBackend(backends.Backend): targs = target.get_extra_args(lang) args = warn_args + std_args + pargs + gargs + targs if args: - langname = LANGNAMEMAP[lang] lang_cargs = cargs if compiler and target.implicit_include_directories: # It is unclear what is the cwd when xcode runs. -I. does not seem to # add the root build dir to the search path. So add an absolute path instead. # This may break reproducible builds, in which case patches are welcome. lang_cargs += self.get_custom_target_dir_include_args(target, compiler, absolute_path=True) - langargs[langname] = args + # Xcode can not handle separate compilation flags for C and ObjectiveC. They are both + # put in OTHER_CFLAGS. + if lang == 'objc': + lang = 'c' + langname = LANGNAMEMAP[lang] + if langname in langargs: + langargs[langname] += args + else: + langargs[langname] = args langargs[langname] += lang_cargs symroot = os.path.join(self.environment.get_build_dir(), target.subdir) bt_dict = PbxDict() diff --git a/run_tests.py b/run_tests.py index 4d737ee7b..b2a25f01c 100755 --- a/run_tests.py +++ b/run_tests.py @@ -225,9 +225,7 @@ def get_backend_commands(backend: Backend, debug: bool = False) -> \ test_cmd = cmd + ['RUN_TESTS.vcxproj'] elif backend is Backend.xcode: cmd = ['xcodebuild'] - # In Xcode9 new build system's clean command fails when using a custom build directory. - # Maybe use it when CI uses Xcode10 we can remove '-UseNewBuildSystem=FALSE' - clean_cmd = cmd + ['-alltargets', 'clean', '-UseNewBuildSystem=FALSE'] + clean_cmd = cmd + ['-alltargets', 'clean'] test_cmd = cmd + ['-target', 'RUN_TESTS'] elif backend is Backend.ninja: global NINJA_CMD