Skip to content

Commit

Permalink
cmake: Always use all compilers for LLVM (fixes mesonbuild#10249)
Browse files Browse the repository at this point in the history
  • Loading branch information
mensinda authored and eli-schwartz committed Apr 12, 2022
1 parent 0176419 commit 589600c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mesonbuild/dependencies/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ def _original_module_name(self, module: str) -> str:
# 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
Expand Down
1 change: 0 additions & 1 deletion mesonbuild/dependencies/data/CMakeListsLLVM.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} )

set(PACKAGE_FOUND FALSE)

Expand Down
13 changes: 12 additions & 1 deletion mesonbuild/dependencies/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,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
Expand Down

0 comments on commit 589600c

Please sign in to comment.