diff options
| author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-20 07:20:18 +0530 |
|---|---|---|
| committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-21 01:36:08 +0530 |
| commit | 69e83d6aed89745bad540295e4a93ef37265e1b3 (patch) | |
| tree | d8ab0f3f1a9481e9f22bd38884c42b52290b5b3a | |
| parent | 003e0a0610582020d1b213e0c8d16fe63bc6eabe (diff) | |
| download | meson-69e83d6aed89745bad540295e4a93ef37265e1b3.tar.gz | |
Support passing of options to compilers and linkers
If you pass options, the last element in the array won't be the
compiler basename, so just check if the basename is in the exelist
somewhere.
Includes a test.
| -rw-r--r-- | mesonbuild/environment.py | 6 | ||||
| -rwxr-xr-x | run_unittests.py | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index fe89f0eba..b184b3fc6 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -407,8 +407,7 @@ class Environment: if isinstance(compiler, str): compiler = [compiler] try: - basename = os.path.basename(compiler[-1]).lower() - if basename == 'cl' or basename == 'cl.exe': + if 'cl' in compiler or 'cl.exe' in compiler: arg = '/?' else: arg = '--version' @@ -657,8 +656,7 @@ class Environment: linker = [self.vs_static_linker] else: linker = [self.default_static_linker] - basename = os.path.basename(linker[-1]).lower() - if basename == 'lib' or basename == 'lib.exe': + if 'lib' in linker or 'lib.exe' in linker: arg = '/?' else: arg = '--version' diff --git a/run_unittests.py b/run_unittests.py index 162291648..10aa8ac7c 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -801,17 +801,17 @@ class AllPlatformTests(BasePlatformTests): self.assertIsInstance(linker, lib) self.assertEqual(cc.id, 'msvc') # Set evar ourselves to a wrapper script that just calls the same - # exelist. This is meant to test that setting something like - # `ccache gcc` or `distcc ccache gcc` works fine. + # exelist + some argument. This is meant to test that setting + # something like `ccache gcc -pipe` or `distcc ccache gcc` works. wrapper = os.path.join(testdir, 'compiler wrapper.py') - wrappercc = [sys.executable, wrapper] + cc.get_exelist() + wrappercc = [sys.executable, wrapper] + cc.get_exelist() + cc.get_always_args() wrappercc_s = '' for w in wrappercc: wrappercc_s += shlex.quote(w) + ' ' os.environ[evar] = wrappercc_s wcc = getattr(env, 'detect_{}_compiler'.format(lang))(False) # Check static linker too - wrapperlinker = [sys.executable, wrapper] + linker.get_exelist() + wrapperlinker = [sys.executable, wrapper] + linker.get_exelist() + linker.get_always_args() wrapperlinker_s = '' for w in wrapperlinker: wrapperlinker_s += shlex.quote(w) + ' ' |
