|
|
@ -20,7 +20,7 @@ import glob |
|
|
|
import os |
|
|
|
import os |
|
|
|
import re |
|
|
|
import re |
|
|
|
|
|
|
|
|
|
|
|
from .. import mesonlib |
|
|
|
from .. import mesonlib, mlog |
|
|
|
from ..mesonlib import version_compare, stringlistify, extract_as_list, MachineChoice |
|
|
|
from ..mesonlib import version_compare, stringlistify, extract_as_list, MachineChoice |
|
|
|
from .base import ( |
|
|
|
from .base import ( |
|
|
|
DependencyException, DependencyMethods, ExternalDependency, PkgConfigDependency, |
|
|
|
DependencyException, DependencyMethods, ExternalDependency, PkgConfigDependency, |
|
|
@ -405,7 +405,6 @@ class LLVMDependencyCMake(CMakeDependency): |
|
|
|
def __init__(self, env, kwargs): |
|
|
|
def __init__(self, env, kwargs): |
|
|
|
self.llvm_modules = stringlistify(extract_as_list(kwargs, 'modules')) |
|
|
|
self.llvm_modules = stringlistify(extract_as_list(kwargs, 'modules')) |
|
|
|
self.llvm_opt_modules = stringlistify(extract_as_list(kwargs, 'optional_modules')) |
|
|
|
self.llvm_opt_modules = stringlistify(extract_as_list(kwargs, 'optional_modules')) |
|
|
|
self.module_map = {} |
|
|
|
|
|
|
|
super().__init__(name='LLVM', environment=env, language='cpp', kwargs=kwargs) |
|
|
|
super().__init__(name='LLVM', environment=env, language='cpp', kwargs=kwargs) |
|
|
|
|
|
|
|
|
|
|
|
# Extract extra include directories and definitions |
|
|
|
# Extract extra include directories and definitions |
|
|
@ -419,22 +418,27 @@ class LLVMDependencyCMake(CMakeDependency): |
|
|
|
return 'CMakeListsLLVM.txt' |
|
|
|
return 'CMakeListsLLVM.txt' |
|
|
|
|
|
|
|
|
|
|
|
def _extra_cmake_opts(self) -> List[str]: |
|
|
|
def _extra_cmake_opts(self) -> List[str]: |
|
|
|
return ['-DLLVM_MESON_MODULES={}'.format(';'.join(self.llvm_modules)), |
|
|
|
return ['-DLLVM_MESON_MODULES={}'.format(';'.join(self.llvm_modules + self.llvm_opt_modules))] |
|
|
|
'-DLLVM_MESON_OPT_MODULES={}'.format(';'.join(self.llvm_opt_modules))] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _map_module_list(self, modules: List[Tuple[str, bool]]) -> List[Tuple[str, bool]]: |
|
|
|
def _map_module_list(self, modules: List[Tuple[str, bool]]) -> List[Tuple[str, bool]]: |
|
|
|
res_modules = self.get_cmake_var('MESON_RESOLVED_LLVM_MODULES') |
|
|
|
res = [] |
|
|
|
res_opt_modules = self.get_cmake_var('MESON_RESOLVED_LLVM_MODULES_OPT') |
|
|
|
for mod, required in modules: |
|
|
|
modules = [(x, True) for x in res_modules] |
|
|
|
cm_targets = self.get_cmake_var('MESON_LLVM_TARGETS_{}'.format(mod)) |
|
|
|
modules += [(x, False) for x in res_opt_modules] |
|
|
|
if not cm_targets: |
|
|
|
self.module_map = { |
|
|
|
if required: |
|
|
|
**dict(zip(res_modules, self.llvm_modules)), |
|
|
|
raise self._gen_exception('LLVM module {} was not found'.format(mod)) |
|
|
|
**dict(zip(res_opt_modules, self.llvm_opt_modules)) |
|
|
|
else: |
|
|
|
} |
|
|
|
mlog.warning('Optional LLVM module', mlog.bold(mod), 'was not found') |
|
|
|
return modules |
|
|
|
continue |
|
|
|
|
|
|
|
for i in cm_targets: |
|
|
|
|
|
|
|
res += [(i, required)] |
|
|
|
|
|
|
|
return res |
|
|
|
|
|
|
|
|
|
|
|
def _original_module_name(self, module: str) -> str: |
|
|
|
def _original_module_name(self, module: str) -> str: |
|
|
|
return self.module_map.get(module, module) |
|
|
|
orig_name = self.get_cmake_var('MESON_TARGET_TO_LLVM_{}'.format(module)) |
|
|
|
|
|
|
|
if orig_name: |
|
|
|
|
|
|
|
return orig_name[0] |
|
|
|
|
|
|
|
return module |
|
|
|
|
|
|
|
|
|
|
|
def need_threads(self) -> bool: |
|
|
|
def need_threads(self) -> bool: |
|
|
|
return True |
|
|
|
return True |
|
|
|