diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-10-05 11:30:51 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-10-25 10:03:34 -0700 |
commit | 3e004ae61170e919be4c72fc6ddc2a6d1d6354a2 (patch) | |
tree | 76d9757bfc2c0f070b6c405d66b0a617b98e72df | |
parent | cadf5f3c044b823be9cd1de81cbf90c9fc61be2f (diff) | |
download | meson-3e004ae61170e919be4c72fc6ddc2a6d1d6354a2.zip meson-3e004ae61170e919be4c72fc6ddc2a6d1d6354a2.tar.gz meson-3e004ae61170e919be4c72fc6ddc2a6d1d6354a2.tar.bz2 |
llvm: check for components (modules) before libs.
For statically linking we need to pass the modules to llvm-config, so we
need to validate them and have them ready to use before then.
-rw-r--r-- | mesonbuild/dependencies/dev.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index 87a032f..d41963f 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -136,7 +136,7 @@ class LLVMDependency(ExternalDependency): # It's necessary for LLVM <= 3.8 to use the C++ linker. For 3.9 and 4.0 # the C linker works fine if only using the C API. super().__init__('llvm-config', environment, 'cpp', kwargs) - self.modules = [] + self.provided_modules = [] self.llvmconfig = None self.__best_found = None # FIXME: Support multiple version requirements ala PkgConfigDependency @@ -169,6 +169,16 @@ class LLVMDependency(ExternalDependency): # for users who want the patch version. self.version = out.strip().rstrip('svn') + p, out = Popen_safe([self.llvmconfig, '--components'])[:2] + if p.returncode != 0: + raise DependencyException('Could not generate modules for LLVM.') + self.provided_modules = shlex.split(out) + + modules = stringlistify(extract_as_list(kwargs, 'modules')) + self.check_components(modules) + opt_modules = stringlistify(extract_as_list(kwargs, 'optional_modules')) + self.check_components(opt_modules, required=False) + p, out = Popen_safe( [self.llvmconfig, '--libs', '--ldflags'])[:2] if p.returncode != 0: @@ -180,17 +190,6 @@ class LLVMDependency(ExternalDependency): cargs = mesonlib.OrderedSet(shlex.split(out)) self.compile_args = list(cargs.difference(self.__cpp_blacklist)) - p, out = Popen_safe([self.llvmconfig, '--components'])[:2] - if p.returncode != 0: - raise DependencyException('Could not generate modules for LLVM.') - self.modules = shlex.split(out) - - modules = stringlistify(extract_as_list(kwargs, 'modules')) - self.check_components(modules) - - opt_modules = stringlistify(extract_as_list(kwargs, 'optional_modules')) - self.check_components(opt_modules, required=False) - def check_components(self, modules, required=True): """Check for llvm components (modules in meson terms). @@ -198,7 +197,7 @@ class LLVMDependency(ExternalDependency): is required. """ for mod in sorted(set(modules)): - if mod not in self.modules: + if mod not in self.provided_modules: mlog.log('LLVM module', mod, 'found:', mlog.red('NO'), '(optional)' if not required else '') if required: |