aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-10-02 22:34:53 +0300
committerGitHub <noreply@github.com>2018-10-02 22:34:53 +0300
commitc6eaf373f3aeeaf36fea8d71407f7e971c770cd8 (patch)
tree40cfd26a4e7466ee42efc2e4f05fc994f0876f9c
parent1478cd41cd637f2eaf1b1abc61aa0c48524bf3b2 (diff)
parentaff3930464aa89e3871a49d8cc05a48eed43d97b (diff)
downloadmeson-c6eaf373f3aeeaf36fea8d71407f7e971c770cd8.zip
meson-c6eaf373f3aeeaf36fea8d71407f7e971c770cd8.tar.gz
meson-c6eaf373f3aeeaf36fea8d71407f7e971c770cd8.tar.bz2
Merge pull request #4296 from nacho4d/feature/fix-xcode-configure-file
Xcode does not include configured files in its header search path
-rw-r--r--mesonbuild/backend/xcodebackend.py30
-rw-r--r--test cases/common/14 configure file/meson.build43
2 files changed, 38 insertions, 35 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py
index b0fcfa4..11f8bb8 100644
--- a/mesonbuild/backend/xcodebackend.py
+++ b/mesonbuild/backend/xcodebackend.py
@@ -786,6 +786,7 @@ class XCodeBackend(backends.Backend):
self.write_line('PRODUCT_NAME = %s;' % product_name)
self.write_line('SECTORDER_FLAGS = "";')
self.write_line('SYMROOT = "%s";' % symroot)
+ self.write_build_setting_line('SYSTEM_HEADER_SEARCH_PATHS', [self.environment.get_build_dir()])
self.write_line('USE_HEADERMAP = NO;')
self.write_build_setting_line('WARNING_CFLAGS', ['-Wmost', '-Wno-four-char-constants', '-Wno-unknown-pragmas'])
self.indent_level -= 1
@@ -860,16 +861,29 @@ class XCodeBackend(backends.Backend):
self.write_line('};')
self.ofile.write('/* End XCConfigurationList section */\n')
- def write_build_setting_line(self, flag_name, flag_values):
+ def write_build_setting_line(self, flag_name, flag_values, explicit=False):
if flag_values:
- self.write_line('%s = (' % flag_name)
- self.indent_level += 1
- for value in flag_values:
- self.write_line('"%s",' % value)
- self.indent_level -= 1
- self.write_line(');')
+ if len(flag_values) == 1:
+ value = flag_values[0]
+ if (' ' in value):
+ # If path contains spaces surround it with double colon
+ self.write_line('%s = "\\"%s\\"";' % (flag_name, value))
+ else:
+ self.write_line('"%s",' % value)
+ else:
+ self.write_line('%s = (' % flag_name)
+ self.indent_level += 1
+ for value in flag_values:
+ if (' ' in value):
+ # If path contains spaces surround it with double colon
+ self.write_line('"\\"%s\\"",' % value)
+ else:
+ self.write_line('"%s",' % value)
+ self.indent_level -= 1
+ self.write_line(');')
else:
- self.write_line('%s = "";' % flag_name)
+ if explicit:
+ self.write_line('%s = "";' % flag_name)
def generate_prefix(self):
self.ofile.write('// !$*UTF8*$!\n{\n')
diff --git a/test cases/common/14 configure file/meson.build b/test cases/common/14 configure file/meson.build
index d7beeb1..a3601aa 100644
--- a/test cases/common/14 configure file/meson.build
+++ b/test cases/common/14 configure file/meson.build
@@ -12,20 +12,20 @@ assert(conf.get('var', 'default') == 'mystring', 'Get function is not working.')
assert(conf.get('notthere', 'default') == 'default', 'Default value getting is not working.')
cfile = configure_file(input : 'config.h.in',
-output : 'config.h',
-configuration : conf)
+ output : 'config.h',
+ configuration : conf)
e = executable('inctest', 'prog.c',
# Note that you should NOT do this. Don't add generated headers here
# This tests that we do the right thing even if people add in conf files
# to their sources.
-cfile)
+ cfile)
test('inctest', e)
# Test if we can also pass files() as input
configure_file(input : files('config.h.in'),
- output : 'config2.h',
- configuration : conf)
+ output : 'config2.h',
+ configuration : conf)
# Now generate a header file with an external script.
genprog = import('python3').find_python()
@@ -93,8 +93,7 @@ dump = configuration_data()
dump.set('ZERO', 0)
config_templates = files(['config4a.h.in', 'config4b.h.in'])
foreach config_template : config_templates
- configure_file(input : config_template, output : '@BASENAME@',
- configuration : dump)
+ configure_file(input : config_template, output : '@BASENAME@', configuration : dump)
endforeach
test('Substituted', executable('prog4', 'prog4.c'))
@@ -123,8 +122,7 @@ conf5.set('var2', 'error')
configure_file(
input : 'config5.h.in',
output : '@BASENAME@',
- configuration : conf5
-)
+ configuration : conf5)
test('test5', executable('prog5', 'prog5.c'))
# Test escaping
@@ -134,8 +132,7 @@ conf6.set('var2', 'bar')
configure_file(
input : 'config6.h.in',
output : '@BASENAME@',
- configuration : conf6
-)
+ configuration : conf6)
test('test6', executable('prog6', 'prog6.c'))
# test empty install dir string
@@ -152,8 +149,7 @@ configure_file(
input : 'config7.h.in',
output : '@BASENAME@',
format : 'cmake',
- configuration : conf7
-)
+ configuration : conf7)
test('test7', executable('prog7', 'prog7.c'))
# Test copying of an empty configuration data object
@@ -182,24 +178,21 @@ configure_file(
input : 'config8.h.in',
output : '@BASENAME@',
encoding : 'koi8-r',
- configuration : conf8
-)
+ configuration : conf8)
# Test that passing an empty configuration_data() object to a file with
# #mesondefine substitutions does not print the warning.
configure_file(
input: 'nosubst-nocopy1.txt.in',
output: 'nosubst-nocopy1.txt',
- configuration : configuration_data()
-)
+ configuration : configuration_data())
# test that passing an empty configuration_data() object to a file with
# @foo@ substitutions does not print the warning.
configure_file(
input: 'nosubst-nocopy2.txt.in',
output: 'nosubst-nocopy2.txt',
- configuration : configuration_data()
-)
+ configuration : configuration_data())
# test that passing a configured file object to test() works, and that passing
# an empty configuration_data() object to a file that leads to no substitutions
@@ -207,27 +200,23 @@ configure_file(
test_file = configure_file(
input: 'test.py.in',
output: 'test.py',
- configuration: configuration_data()
-)
+ configuration: configuration_data())
# Test that overwriting an existing file creates a warning.
configure_file(
input: 'test.py.in',
output: 'double_output.txt',
- configuration: conf
-)
+ configuration: conf)
configure_file(
input: 'test.py.in',
output: 'double_output.txt',
- configuration: conf
-)
+ configuration: conf)
# Test that the same file name in a different subdir will not create a warning
configure_file(
input: 'test.py.in',
output: 'no_write_conflict.txt',
- configuration: conf
-)
+ configuration: conf)
test('configure-file', test_file)