From e80a13af730867f484f017bc99059a5ddc654d4b Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 23 Apr 2021 19:55:38 +0300 Subject: [PATCH] Xcode: do not reuse objs in both_libraries because Xcode fails on targets with no sources. --- mesonbuild/interpreter/interpreter.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 1010494b8..d17d7f09a 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -2732,7 +2732,18 @@ Try setting b_lundef to false instead.'''.format(self.coredata.options[OptionKey elif key in self.environment.coredata.options: pic = self.environment.coredata.options[key].value - if pic: + if self.backend.name == 'xcode': + # Xcode is a bit special in that you can't (at least for the moment) + # form a library only from object file inputs. The simple but inefficient + # solution is to use the sources directly. This will lead to them being + # built twice. This is unfortunate and slow, but at least it works. + # Feel free to submit patches to get this fixed if it is an + # issue for you. + reuse_object_files = False + else: + reuse_object_files = pic + + if reuse_object_files: # Exclude sources from args and kwargs to avoid building them twice static_args = [args[0]] static_kwargs = kwargs.copy()