cmake: minor code fixes

pull/5185/head
Daniel Mensinger 6 years ago
parent 1280ef238b
commit 6a2faacdf9
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 4
      mesonbuild/dependencies/base.py
  2. 16
      mesonbuild/dependencies/dev.py

@ -971,10 +971,10 @@ class CMakeDependency(ExternalDependency):
def _gen_exception(self, msg): def _gen_exception(self, msg):
return DependencyException('Dependency {} not found: {}'.format(self.name, msg)) return DependencyException('Dependency {} not found: {}'.format(self.name, msg))
def _main_cmake_file(self): def _main_cmake_file(self) -> str:
return 'CMakeLists.txt' return 'CMakeLists.txt'
def _extra_cmake_opts(self): def _extra_cmake_opts(self) -> List[str]:
return [] return []
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]]:

@ -28,6 +28,8 @@ from .base import (
) )
from .misc import ThreadDependency from .misc import ThreadDependency
from typing import List, Tuple
def get_shared_library_suffix(environment, native): def get_shared_library_suffix(environment, native):
"""This is only gauranteed to work for languages that compile to machine """This is only gauranteed to work for languages that compile to machine
@ -406,28 +408,28 @@ class LLVMDependencyCMake(CMakeDependency):
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
incDirs = self.get_cmake_var('PACKAGE_INCLUDE_DIRS') inc_dirs = self.get_cmake_var('PACKAGE_INCLUDE_DIRS')
defs = self.get_cmake_var('PACKAGE_DEFINITIONS') defs = self.get_cmake_var('PACKAGE_DEFINITIONS')
temp = list(map(lambda x: '-I{}'.format(x), incDirs)) + defs temp = ['-I' + x for x in inc_dirs] + defs
self.compile_args += [x for x in temp if x not in self.compile_args] self.compile_args += [x for x in temp if x not in self.compile_args]
def _main_cmake_file(self): def _main_cmake_file(self) -> str:
# Use a custom CMakeLists.txt for LLVM # Use a custom CMakeLists.txt for LLVM
return 'CMakeListsLLVM.txt' return 'CMakeListsLLVM.txt'
def _extra_cmake_opts(self): 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)),
'-DLLVM_MESON_OPT_MODULES={}'.format(';'.join(self.llvm_opt_modules))] '-DLLVM_MESON_OPT_MODULES={}'.format(';'.join(self.llvm_opt_modules))]
def _map_module_list(self, modules): def _map_module_list(self, modules: List[Tuple[str, bool]]) -> List[Tuple[str, bool]]:
modules = [(x, True) for x in self.get_cmake_var('MESON_RESOLVED_LLVM_MODULES')] modules = [(x, True) for x in self.get_cmake_var('MESON_RESOLVED_LLVM_MODULES')]
modules += [(x, False) for x in self.get_cmake_var('MESON_RESOLVED_LLVM_MODULES_OPT')] modules += [(x, False) for x in self.get_cmake_var('MESON_RESOLVED_LLVM_MODULES_OPT')]
return modules return modules
def need_threads(self): def need_threads(self) -> bool:
return True return True
def log_details(self): def log_details(self) -> str:
modules = self.get_cmake_var('MESON_RESOLVED_LLVM_MODULES') modules = self.get_cmake_var('MESON_RESOLVED_LLVM_MODULES')
if modules: if modules:
return 'modules: ' + ', '.join(modules) return 'modules: ' + ', '.join(modules)

Loading…
Cancel
Save