diff options
author | Guillermo Ignacio Enriquez Gutierrez <ignacio@jp.ibm.com> | 2018-09-24 02:17:04 +0900 |
---|---|---|
committer | Guillermo Ignacio Enriquez Gutierrez <ignacio@jp.ibm.com> | 2018-09-24 02:17:57 +0900 |
commit | 9b7bb4aa92bc292230294929d35f3617cc48b0bf (patch) | |
tree | 9b9279c70df2cac03a81f87a741d26e928cf2d03 /mesonbuild/backend/xcodebackend.py | |
parent | f482b82a430e60aabca7bd6db0d7cdb20bf7db49 (diff) | |
download | meson-9b7bb4aa92bc292230294929d35f3617cc48b0bf.zip meson-9b7bb4aa92bc292230294929d35f3617cc48b0bf.tar.gz meson-9b7bb4aa92bc292230294929d35f3617cc48b0bf.tar.bz2 |
Partially fix targets that use precompiled header with --backend=xcode. Various compiled headers are not working yet [skip ci]
Diffstat (limited to 'mesonbuild/backend/xcodebackend.py')
-rw-r--r-- | mesonbuild/backend/xcodebackend.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 8c85df9..42f44cf 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -60,6 +60,12 @@ class XCodeBackend(backends.Backend): os.makedirs(os.path.join(self.environment.get_build_dir(), dirname), exist_ok=True) return dirname + def target_to_build_root(self, target): + if self.get_target_dir(target) == '': + return '' + directories = os.path.normpath(self.get_target_dir(target)).split(os.sep) + return os.sep.join(['..'] * len(directories)) + def write_line(self, text): self.ofile.write(self.indent * self.indent_level + text) if not text.endswith('\n'): @@ -749,6 +755,15 @@ class XCodeBackend(backends.Backend): self.write_line('GCC_GENERATE_DEBUGGING_SYMBOLS = YES;') self.write_line('GCC_INLINES_ARE_PRIVATE_EXTERN = NO;') self.write_line('GCC_OPTIMIZATION_LEVEL = 0;') + if target.has_pch: + # FIXME: GCC_PREFIX_HEADER accepts only one file so temporary we get the pch for the first language available and apply it to the entire target + # If more than pch are found we should add a compiler flag per each file + pch_headers = target.get_pch('c') + target.get_pch('cpp') + target.get_pch('objc') + target.get_pch('objcpp') + # Find path relative to target so we can use "$(PROJECT_DIR)" + relative_pch_path = os.path.join(self.get_target_dir(target), pch_headers[0]) + if relative_pch_path: + self.write_line('GCC_PRECOMPILE_PREFIX_HEADER = YES;') + self.write_line('GCC_PREFIX_HEADER = "$(PROJECT_DIR)/%s";' % relative_pch_path) self.write_line('GCC_PREPROCESSOR_DEFINITIONS = "";') self.write_line('GCC_SYMBOLS_PRIVATE_EXTERN = NO;') if len(headerdirs) > 0: |