diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2022-04-08 17:21:54 +0200 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-04-19 22:43:25 +0530 |
commit | 44907fb96b1d13928c5a3e08ed8f998256c9e953 (patch) | |
tree | 853a83e66c50babf6cfc91e3e8b9afe1b82dcf53 | |
parent | d5301b7a6cf7835a87745bbe3bb7e4cb91f66d5d (diff) | |
download | meson-44907fb96b1d13928c5a3e08ed8f998256c9e953.zip meson-44907fb96b1d13928c5a3e08ed8f998256c9e953.tar.gz meson-44907fb96b1d13928c5a3e08ed8f998256c9e953.tar.bz2 |
cmake: Always use all compilers for LLVM (fixes #10249)
-rw-r--r-- | mesonbuild/dependencies/cmake.py | 4 | ||||
-rw-r--r-- | mesonbuild/dependencies/data/CMakeListsLLVM.txt | 1 | ||||
-rw-r--r-- | mesonbuild/dependencies/dev.py | 13 |
3 files changed, 14 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/cmake.py b/mesonbuild/dependencies/cmake.py index cff0e58..e9a4aa3 100644 --- a/mesonbuild/dependencies/cmake.py +++ b/mesonbuild/dependencies/cmake.py @@ -76,10 +76,10 @@ class CMakeDependency(ExternalDependency): # one module return module - def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any], language: T.Optional[str] = None) -> None: + def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any], language: T.Optional[str] = None, force_use_global_compilers: bool = False) -> None: # Gather a list of all languages to support self.language_list = [] # type: T.List[str] - if language is None: + if language is None or force_use_global_compilers: compilers = None if kwargs.get('native', False): compilers = environment.coredata.compilers.build diff --git a/mesonbuild/dependencies/data/CMakeListsLLVM.txt b/mesonbuild/dependencies/data/CMakeListsLLVM.txt index 9d3e412..da23189 100644 --- a/mesonbuild/dependencies/data/CMakeListsLLVM.txt +++ b/mesonbuild/dependencies/data/CMakeListsLLVM.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} ) set(PACKAGE_FOUND FALSE) diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index 793b38a..49d62a5 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -403,7 +403,18 @@ class LLVMDependencyCMake(CMakeDependency): def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]) -> None: self.llvm_modules = stringlistify(extract_as_list(kwargs, 'modules')) self.llvm_opt_modules = stringlistify(extract_as_list(kwargs, 'optional_modules')) - super().__init__(name, env, kwargs, language='cpp') + + compilers = None + if kwargs.get('native', False): + compilers = env.coredata.compilers.build + else: + compilers = env.coredata.compilers.host + if not compilers or not all(x in compilers for x in ('c', 'cpp')): + self.is_found = False + mlog.warning('The LLVM dependency was not found via CMake since both a C and C++ compiler are required.') + return + + super().__init__(name, env, kwargs, language='cpp', force_use_global_compilers=True) # Cmake will always create a statically linked binary, so don't use # cmake if dynamic is required |