summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-06-02 19:27:49 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-06-04 01:36:15 +0530
commite4fd3df0e6b8c09124ebe08662ea62665c11eacb (patch)
treed8b630ecd4226c116e6b571530e82da402301830
parentfffbb9f75216e4f68df152747ed645fb6bc9b9e7 (diff)
downloadmeson-nirbheek/add-apple-bitcode-support.tar.gz
Warn when Apple bitcode support is enabled and in-usenirbheek/add-apple-bitcode-support
We have to disable some options, so tell the user about them and point to the documentation so they can read more about it.
-rw-r--r--mesonbuild/interpreter.py12
-rwxr-xr-xrun_unittests.py8
2 files changed, 17 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 49e9381a4..0e4dc826e 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2421,7 +2421,13 @@ to directly access options of other subprojects.''')
self.add_base_options(comp)
return success
+ def emit_base_options_warnings(self, enabled_opts):
+ if 'b_bitcode' in enabled_opts:
+ mlog.warning('Base option \'b_bitcode\' is enabled, which is incompatible with many linker options. Incompatible options such as such as \'b_asneeded\' have been disabled.')
+ mlog.warning('Please see https://mesonbuild.com/Builtin-options.html#Notes_about_Apple_Bitcode_support for more details.')
+
def add_base_options(self, compiler):
+ enabled_opts = []
proj_opt = self.environment.cmd_line_options.projectoptions
for optname in compiler.base_options:
if optname in self.coredata.base_options:
@@ -2429,9 +2435,13 @@ to directly access options of other subprojects.''')
oobj = compilers.base_options[optname]
for po in proj_opt:
if po.startswith(optname + '='):
- oobj.set_value(po.split('=', 1)[1])
+ opt, value = po.split('=', 1)
+ oobj.set_value(value)
+ if oobj.value:
+ enabled_opts.append(opt)
break
self.coredata.base_options[optname] = oobj
+ self.emit_base_options_warnings(enabled_opts)
def program_from_cross_file(self, prognames, silent=False):
bins = self.environment.cross_info.config['binaries']
diff --git a/run_unittests.py b/run_unittests.py
index c21eab5b7..6605e0c0c 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -3157,13 +3157,17 @@ endian = 'little'
to inspect the compiler database.
'''
if not is_osx():
- raise unittest.SkipTest('Apple bitcode not relevant')
+ raise unittest.SkipTest('Apple bitcode only works on macOS')
testdir = os.path.join(self.common_test_dir, '4 shared')
# Try with bitcode enabled
- self.init(testdir, extra_args='-Db_bitcode=true')
+ out = self.init(testdir, extra_args='-Db_bitcode=true')
+ # Warning was printed
+ self.assertRegex(out, 'WARNING:.*b_bitcode')
+ # Compiler options were added
compdb = self.get_compdb()
self.assertIn('-fembed-bitcode', compdb[0]['command'])
build_ninja = os.path.join(self.builddir, 'build.ninja')
+ # Linker options were added
with open(build_ninja, 'r', encoding='utf-8') as f:
contents = f.read()
m = re.search('LINK_ARGS =.*-bitcode_bundle', contents)