aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/cmake
diff options
context:
space:
mode:
authorAlf Henrik Sauge <alf.henrik.sauge@gmail.com>2022-08-11 15:18:27 +0200
committerEli Schwartz <eschwartz93@gmail.com>2022-08-26 17:12:40 -0400
commit06bf9a5cdae6a185a29e5ea5bcaf18ad3e3e042a (patch)
treea909a90a2734935d732dcc087dc173d80da76425 /mesonbuild/cmake
parent47a0ed5924ea05ac58a9a36f60670b79e76c6273 (diff)
downloadmeson-06bf9a5cdae6a185a29e5ea5bcaf18ad3e3e042a.zip
meson-06bf9a5cdae6a185a29e5ea5bcaf18ad3e3e042a.tar.gz
meson-06bf9a5cdae6a185a29e5ea5bcaf18ad3e3e042a.tar.bz2
Fix purely white space issues reported by flake8
Diffstat (limited to 'mesonbuild/cmake')
-rw-r--r--mesonbuild/cmake/common.py52
-rw-r--r--mesonbuild/cmake/executor.py2
-rw-r--r--mesonbuild/cmake/fileapi.py14
-rw-r--r--mesonbuild/cmake/interpreter.py168
-rw-r--r--mesonbuild/cmake/toolchain.py34
-rw-r--r--mesonbuild/cmake/traceparser.py30
-rw-r--r--mesonbuild/cmake/tracetargets.py4
7 files changed, 152 insertions, 152 deletions
diff --git a/mesonbuild/cmake/common.py b/mesonbuild/cmake/common.py
index 7130248..60764cc 100644
--- a/mesonbuild/cmake/common.py
+++ b/mesonbuild/cmake/common.py
@@ -161,7 +161,7 @@ def check_cmake_args(args: T.List[str]) -> T.List[str]:
class CMakeInclude:
def __init__(self, path: Path, isSystem: bool = False):
- self.path = path
+ self.path = path
self.isSystem = isSystem
def __repr__(self) -> str:
@@ -169,11 +169,11 @@ class CMakeInclude:
class CMakeFileGroup:
def __init__(self, data: T.Dict[str, T.Any]) -> None:
- self.defines = data.get('defines', '') # type: str
- self.flags = _flags_to_list(data.get('compileFlags', '')) # type: T.List[str]
+ self.defines = data.get('defines', '') # type: str
+ self.flags = _flags_to_list(data.get('compileFlags', '')) # type: T.List[str]
self.is_generated = data.get('isGenerated', False) # type: bool
- self.language = data.get('language', 'C') # type: str
- self.sources = [Path(x) for x in data.get('sources', [])] # type: T.List[Path]
+ self.language = data.get('language', 'C') # type: str
+ self.sources = [Path(x) for x in data.get('sources', [])] # type: T.List[Path]
# Fix the include directories
self.includes = [] # type: T.List[CMakeInclude]
@@ -199,21 +199,21 @@ class CMakeFileGroup:
class CMakeTarget:
def __init__(self, data: T.Dict[str, T.Any]) -> None:
- self.artifacts = [Path(x) for x in data.get('artifacts', [])] # type: T.List[Path]
- self.src_dir = Path(data.get('sourceDirectory', '')) # type: Path
- self.build_dir = Path(data.get('buildDirectory', '')) # type: Path
- self.name = data.get('name', '') # type: str
- self.full_name = data.get('fullName', '') # type: str
- self.install = data.get('hasInstallRule', False) # type: bool
- self.install_paths = [Path(x) for x in set(data.get('installPaths', []))] # type: T.List[Path]
- self.link_lang = data.get('linkerLanguage', '') # type: str
- self.link_libraries = _flags_to_list(data.get('linkLibraries', '')) # type: T.List[str]
- self.link_flags = _flags_to_list(data.get('linkFlags', '')) # type: T.List[str]
- self.link_lang_flags = _flags_to_list(data.get('linkLanguageFlags', '')) # type: T.List[str]
- # self.link_path = Path(data.get('linkPath', '')) # type: Path
- self.type = data.get('type', 'EXECUTABLE') # type: str
- # self.is_generator_provided = data.get('isGeneratorProvided', False) # type: bool
- self.files = [] # type: T.List[CMakeFileGroup]
+ self.artifacts = [Path(x) for x in data.get('artifacts', [])] # type: T.List[Path]
+ self.src_dir = Path(data.get('sourceDirectory', '')) # type: Path
+ self.build_dir = Path(data.get('buildDirectory', '')) # type: Path
+ self.name = data.get('name', '') # type: str
+ self.full_name = data.get('fullName', '') # type: str
+ self.install = data.get('hasInstallRule', False) # type: bool
+ self.install_paths = [Path(x) for x in set(data.get('installPaths', []))] # type: T.List[Path]
+ self.link_lang = data.get('linkerLanguage', '') # type: str
+ self.link_libraries = _flags_to_list(data.get('linkLibraries', '')) # type: T.List[str]
+ self.link_flags = _flags_to_list(data.get('linkFlags', '')) # type: T.List[str]
+ self.link_lang_flags = _flags_to_list(data.get('linkLanguageFlags', '')) # type: T.List[str]
+ # self.link_path = Path(data.get('linkPath', '')) # type: Path
+ self.type = data.get('type', 'EXECUTABLE') # type: str
+ # self.is_generator_provided = data.get('isGeneratorProvided', False) # type: bool
+ self.files = [] # type: T.List[CMakeFileGroup]
for i in data.get('fileGroups', []):
self.files += [CMakeFileGroup(i)]
@@ -240,10 +240,10 @@ class CMakeTarget:
class CMakeProject:
def __init__(self, data: T.Dict[str, T.Any]) -> None:
- self.src_dir = Path(data.get('sourceDirectory', '')) # type: Path
- self.build_dir = Path(data.get('buildDirectory', '')) # type: Path
- self.name = data.get('name', '') # type: str
- self.targets = [] # type: T.List[CMakeTarget]
+ self.src_dir = Path(data.get('sourceDirectory', '')) # type: Path
+ self.build_dir = Path(data.get('buildDirectory', '')) # type: Path
+ self.name = data.get('name', '') # type: str
+ self.targets = [] # type: T.List[CMakeTarget]
for i in data.get('targets', []):
self.targets += [CMakeTarget(i)]
@@ -259,8 +259,8 @@ class CMakeProject:
class CMakeConfiguration:
def __init__(self, data: T.Dict[str, T.Any]) -> None:
- self.name = data.get('name', '') # type: str
- self.projects = [] # type: T.List[CMakeProject]
+ self.name = data.get('name', '') # type: str
+ self.projects = [] # type: T.List[CMakeProject]
for i in data.get('projects', []):
self.projects += [CMakeProject(i)]
diff --git a/mesonbuild/cmake/executor.py b/mesonbuild/cmake/executor.py
index 526620d..afd21ef 100644
--- a/mesonbuild/cmake/executor.py
+++ b/mesonbuild/cmake/executor.py
@@ -33,7 +33,7 @@ if T.TYPE_CHECKING:
from ..mesonlib import MachineChoice
from ..programs import ExternalProgram
-TYPE_result = T.Tuple[int, T.Optional[str], T.Optional[str]]
+TYPE_result = T.Tuple[int, T.Optional[str], T.Optional[str]]
TYPE_cache_key = T.Tuple[str, T.Tuple[str, ...], str, T.FrozenSet[T.Tuple[str, str]]]
class CMakeExecutor:
diff --git a/mesonbuild/cmake/fileapi.py b/mesonbuild/cmake/fileapi.py
index 710e4ed..fce2891 100644
--- a/mesonbuild/cmake/fileapi.py
+++ b/mesonbuild/cmake/fileapi.py
@@ -23,13 +23,13 @@ STRIP_KEYS = ['cmake', 'reply', 'backtrace', 'backtraceGraph', 'version']
class CMakeFileAPI:
def __init__(self, build_dir: Path):
- self.build_dir = build_dir
- self.api_base_dir = self.build_dir / '.cmake' / 'api' / 'v1'
- self.request_dir = self.api_base_dir / 'query' / 'client-meson'
- self.reply_dir = self.api_base_dir / 'reply'
- self.cmake_sources = [] # type: T.List[CMakeBuildFile]
+ self.build_dir = build_dir
+ self.api_base_dir = self.build_dir / '.cmake' / 'api' / 'v1'
+ self.request_dir = self.api_base_dir / 'query' / 'client-meson'
+ self.reply_dir = self.api_base_dir / 'reply'
+ self.cmake_sources = [] # type: T.List[CMakeBuildFile]
self.cmake_configurations = [] # type: T.List[CMakeConfiguration]
- self.kind_resolver_map = {
+ self.kind_resolver_map = {
'codemodel': self._parse_codemodel,
'cmakeFiles': self._parse_cmakeFiles,
}
@@ -103,7 +103,7 @@ class CMakeFileAPI:
src_dir = Path(dir_entry.get('source', '.'))
bld_dir = Path(dir_entry.get('build', '.'))
src_dir = src_dir if src_dir.is_absolute() else source_dir / src_dir
- bld_dir = bld_dir if bld_dir.is_absolute() else build_dir / bld_dir
+ bld_dir = bld_dir if bld_dir.is_absolute() else build_dir / bld_dir
src_dir = src_dir.resolve()
bld_dir = bld_dir.resolve()
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py
index d22b572..72f1d20 100644
--- a/mesonbuild/cmake/interpreter.py
+++ b/mesonbuild/cmake/interpreter.py
@@ -59,8 +59,8 @@ if T.TYPE_CHECKING:
from ..backend.backends import Backend
from ..environment import Environment
-TYPE_mixed = T.Union[str, int, bool, Path, BaseNode]
-TYPE_mixed_list = T.Union[TYPE_mixed, T.Sequence[TYPE_mixed]]
+TYPE_mixed = T.Union[str, int, bool, Path, BaseNode]
+TYPE_mixed_list = T.Union[TYPE_mixed, T.Sequence[TYPE_mixed]]
TYPE_mixed_kwargs = T.Dict[str, TYPE_mixed_list]
# Disable all warnings automatically enabled with --trace and friends
@@ -131,7 +131,7 @@ class OutputTargetMap:
rm_so_version = re.compile(r'(\.[0-9]+)+$')
def __init__(self, build_dir: Path):
- self.tgt_map = {} # type: T.Dict[str, T.Union['ConverterTarget', 'ConverterCustomTarget']]
+ self.tgt_map = {} # type: T.Dict[str, T.Union['ConverterTarget', 'ConverterCustomTarget']]
self.build_dir = build_dir
def add(self, tgt: T.Union['ConverterTarget', 'ConverterCustomTarget']) -> None:
@@ -210,36 +210,36 @@ class OutputTargetMap:
class ConverterTarget:
def __init__(self, target: CMakeTarget, env: 'Environment', for_machine: MachineChoice) -> None:
- self.env = env
- self.for_machine = for_machine
- self.artifacts = target.artifacts
- self.src_dir = target.src_dir
- self.build_dir = target.build_dir
- self.name = target.name
- self.cmake_name = target.name
- self.full_name = target.full_name
- self.type = target.type
- self.install = target.install
- self.install_dir = None # type: T.Optional[Path]
+ self.env = env
+ self.for_machine = for_machine
+ self.artifacts = target.artifacts
+ self.src_dir = target.src_dir
+ self.build_dir = target.build_dir
+ self.name = target.name
+ self.cmake_name = target.name
+ self.full_name = target.full_name
+ self.type = target.type
+ self.install = target.install
+ self.install_dir = None # type: T.Optional[Path]
self.link_libraries = target.link_libraries
- self.link_flags = target.link_flags + target.link_lang_flags
- self.depends_raw = [] # type: T.List[str]
- self.depends = [] # type: T.List[T.Union[ConverterTarget, ConverterCustomTarget]]
+ self.link_flags = target.link_flags + target.link_lang_flags
+ self.depends_raw = [] # type: T.List[str]
+ self.depends = [] # type: T.List[T.Union[ConverterTarget, ConverterCustomTarget]]
if target.install_paths:
self.install_dir = target.install_paths[0]
- self.languages = set() # type: T.Set[str]
- self.sources = [] # type: T.List[Path]
- self.generated = [] # type: T.List[Path]
- self.generated_ctgt = [] # type: T.List[CustomTargetReference]
- self.includes = [] # type: T.List[Path]
- self.sys_includes = [] # type: T.List[Path]
- self.link_with = [] # type: T.List[T.Union[ConverterTarget, ConverterCustomTarget]]
- self.object_libs = [] # type: T.List[ConverterTarget]
- self.compile_opts = {} # type: T.Dict[str, T.List[str]]
- self.public_compile_opts = [] # type: T.List[str]
- self.pie = False
+ self.languages = set() # type: T.Set[str]
+ self.sources = [] # type: T.List[Path]
+ self.generated = [] # type: T.List[Path]
+ self.generated_ctgt = [] # type: T.List[CustomTargetReference]
+ self.includes = [] # type: T.List[Path]
+ self.sys_includes = [] # type: T.List[Path]
+ self.link_with = [] # type: T.List[T.Union[ConverterTarget, ConverterCustomTarget]]
+ self.object_libs = [] # type: T.List[ConverterTarget]
+ self.compile_opts = {} # type: T.Dict[str, T.List[str]]
+ self.public_compile_opts = [] # type: T.List[str]
+ self.pie = False
# Project default override options (c_std, cpp_std, etc.)
self.override_options = [] # type: T.List[str]
@@ -247,11 +247,11 @@ class ConverterTarget:
# Convert the target name to a valid meson target name
self.name = _sanitize_cmake_name(self.name)
- self.generated_raw = [] # type: T.List[Path]
+ self.generated_raw = [] # type: T.List[Path]
for i in target.files:
- languages = set() # type: T.Set[str]
- src_suffixes = set() # type: T.Set[str]
+ languages = set() # type: T.Set[str]
+ src_suffixes = set() # type: T.Set[str]
# Insert suffixes
for j in i.sources:
@@ -345,10 +345,10 @@ class ConverterTarget:
self.depends_raw = trace.targets[self.cmake_name].depends
rtgt = resolve_cmake_trace_targets(self.cmake_name, trace, self.env)
- self.includes += [Path(x) for x in rtgt.include_directories]
- self.link_flags += rtgt.link_flags
+ self.includes += [Path(x) for x in rtgt.include_directories]
+ self.link_flags += rtgt.link_flags
self.public_compile_opts += rtgt.public_compile_opts
- self.link_libraries += rtgt.libraries
+ self.link_libraries += rtgt.libraries
elif self.type.upper() not in ['EXECUTABLE', 'OBJECT_LIBRARY']:
mlog.warning('CMake: Target', mlog.bold(self.cmake_name), 'not found in CMake trace. This can lead to build errors')
@@ -372,7 +372,7 @@ class ConverterTarget:
for i in self.languages:
supported += list(lang_suffixes[i])
supported = [f'.{x}' for x in supported]
- self.sources = [x for x in self.sources if any([x.name.endswith(y) for y in supported])]
+ self.sources = [x for x in self.sources if any([x.name.endswith(y) for y in supported])]
self.generated_raw = [x for x in self.generated_raw if any([x.name.endswith(y) for y in supported])]
# Make paths relative
@@ -397,7 +397,7 @@ class ConverterTarget:
path_is_in_root(x, root_src_dir) or
path_is_in_root(x, Path(self.env.get_build_dir()))
)
- ):
+ ):
mlog.warning('CMake: path', mlog.bold(x.as_posix()), 'is inside the root project but', mlog.bold('not'), 'inside the subproject.')
mlog.warning(' --> Ignoring. This can lead to build errors.')
return None
@@ -425,9 +425,9 @@ class ConverterTarget:
self.generated += [gen_file]
# Remove delete entries
- self.includes = [x for x in self.includes if x is not None]
+ self.includes = [x for x in self.includes if x is not None]
self.sys_includes = [x for x in self.sys_includes if x is not None]
- self.sources = [x for x in self.sources if x is not None]
+ self.sources = [x for x in self.sources if x is not None]
# Make sure '.' is always in the include directories
if Path('.') not in self.includes:
@@ -461,7 +461,7 @@ class ConverterTarget:
return res
self.link_libraries = handle_frameworks(self.link_libraries)
- self.link_flags = handle_frameworks(self.link_flags)
+ self.link_flags = handle_frameworks(self.link_flags)
# Handle explicit CMake add_dependency() calls
for i in self.depends_raw:
@@ -500,14 +500,14 @@ class ConverterTarget:
self.generated = [x for x in self.generated if not any([x.name.endswith('.' + y) for y in obj_suffixes])]
def _append_objlib_sources(self, tgt: 'ConverterTarget') -> None:
- self.includes += tgt.includes
- self.sources += tgt.sources
- self.generated += tgt.generated
+ self.includes += tgt.includes
+ self.sources += tgt.sources
+ self.generated += tgt.generated
self.generated_ctgt += tgt.generated_ctgt
- self.includes = list(OrderedSet(self.includes))
- self.sources = list(OrderedSet(self.sources))
- self.generated = list(OrderedSet(self.generated))
- self.generated_ctgt = list(OrderedSet(self.generated_ctgt))
+ self.includes = list(OrderedSet(self.includes))
+ self.sources = list(OrderedSet(self.sources))
+ self.generated = list(OrderedSet(self.generated))
+ self.generated_ctgt = list(OrderedSet(self.generated_ctgt))
# Inherit compiler arguments since they may be required for building
for lang, opts in tgt.compile_opts.items():
@@ -609,20 +609,20 @@ class ConverterCustomTarget:
if not self.name:
self.name = f'custom_tgt_{ConverterCustomTarget.tgt_counter}'
ConverterCustomTarget.tgt_counter += 1
- self.cmake_name = str(self.name)
+ self.cmake_name = str(self.name)
self.original_outputs = list(target.outputs)
- self.outputs = [x.name for x in self.original_outputs]
- self.conflict_map = {} # type: T.Dict[str, str]
- self.command = [] # type: T.List[T.List[T.Union[str, ConverterTarget]]]
- self.working_dir = target.working_dir
- self.depends_raw = target.depends
- self.inputs = [] # type: T.List[T.Union[str, CustomTargetReference]]
- self.depends = [] # type: T.List[T.Union[ConverterTarget, ConverterCustomTarget]]
- self.current_bin_dir = target.current_bin_dir # type: Path
- self.current_src_dir = target.current_src_dir # type: Path
- self.env = env
- self.for_machine = for_machine
- self._raw_target = target
+ self.outputs = [x.name for x in self.original_outputs]
+ self.conflict_map = {} # type: T.Dict[str, str]
+ self.command = [] # type: T.List[T.List[T.Union[str, ConverterTarget]]]
+ self.working_dir = target.working_dir
+ self.depends_raw = target.depends
+ self.inputs = [] # type: T.List[T.Union[str, CustomTargetReference]]
+ self.depends = [] # type: T.List[T.Union[ConverterTarget, ConverterCustomTarget]]
+ self.current_bin_dir = target.current_bin_dir # type: Path
+ self.current_src_dir = target.current_src_dir # type: Path
+ self.env = env
+ self.for_machine = for_machine
+ self._raw_target = target
# Convert the target name to a valid meson target name
self.name = _sanitize_cmake_name(self.name)
@@ -766,28 +766,28 @@ class ConverterCustomTarget:
class CMakeInterpreter:
def __init__(self, build: 'Build', subdir: Path, src_dir: Path, install_prefix: Path, env: 'Environment', backend: 'Backend'):
- self.build = build
- self.subdir = subdir
- self.src_dir = src_dir
- self.build_dir_rel = subdir / '__CMake_build'
- self.build_dir = Path(env.get_build_dir()) / self.build_dir_rel
+ self.build = build
+ self.subdir = subdir
+ self.src_dir = src_dir
+ self.build_dir_rel = subdir / '__CMake_build'
+ self.build_dir = Path(env.get_build_dir()) / self.build_dir_rel
self.install_prefix = install_prefix
- self.env = env
- self.for_machine = MachineChoice.HOST # TODO make parameter
- self.backend_name = backend.name
- self.linkers = set() # type: T.Set[str]
- self.fileapi = CMakeFileAPI(self.build_dir)
+ self.env = env
+ self.for_machine = MachineChoice.HOST # TODO make parameter
+ self.backend_name = backend.name
+ self.linkers = set() # type: T.Set[str]
+ self.fileapi = CMakeFileAPI(self.build_dir)
# Raw CMake results
- self.bs_files = [] # type: T.List[Path]
+ self.bs_files = [] # type: T.List[Path]
self.codemodel_configs = None # type: T.Optional[T.List[CMakeConfiguration]]
- self.cmake_stderr = None # type: T.Optional[str]
+ self.cmake_stderr = None # type: T.Optional[str]
# Analysed data
- self.project_name = ''
- self.languages = [] # type: T.List[str]
- self.targets = [] # type: T.List[ConverterTarget]
- self.custom_targets = [] # type: T.List[ConverterCustomTarget]
+ self.project_name = ''
+ self.languages = [] # type: T.List[str]
+ self.targets = [] # type: T.List[ConverterTarget]
+ self.custom_targets = [] # type: T.List[ConverterCustomTarget]
self.trace: CMakeTraceParser
self.output_target_map = OutputTargetMap(self.build_dir)
@@ -1027,8 +1027,8 @@ class CMakeInterpreter:
# Add the targets
processing = [] # type: T.List[str]
- processed = {} # type: T.Dict[str, T.Dict[str, T.Optional[str]]]
- name_map = {} # type: T.Dict[str, str]
+ processed = {} # type: T.Dict[str, T.Dict[str, T.Optional[str]]]
+ name_map = {} # type: T.Dict[str, str]
def extract_tgt(tgt: T.Union[ConverterTarget, ConverterCustomTarget, CustomTargetReference]) -> IdNode:
tgt_name = None
@@ -1056,13 +1056,13 @@ class CMakeInterpreter:
detect_cycle(tgt)
# First handle inter target dependencies
- link_with = [] # type: T.List[IdNode]
- objec_libs = [] # type: T.List[IdNode]
- sources = [] # type: T.List[Path]
- generated = [] # type: T.List[T.Union[IdNode, IndexNode]]
- generated_filenames = [] # type: T.List[str]
- custom_targets = [] # type: T.List[ConverterCustomTarget]
- dependencies = [] # type: T.List[IdNode]
+ link_with = [] # type: T.List[IdNode]
+ objec_libs = [] # type: T.List[IdNode]
+ sources = [] # type: T.List[Path]
+ generated = [] # type: T.List[T.Union[IdNode, IndexNode]]
+ generated_filenames = [] # type: T.List[str]
+ custom_targets = [] # type: T.List[ConverterCustomTarget]
+ dependencies = [] # type: T.List[IdNode]
for i in tgt.link_with:
assert isinstance(i, ConverterTarget)
if i.name not in processed:
diff --git a/mesonbuild/cmake/toolchain.py b/mesonbuild/cmake/toolchain.py
index b70a5bc..c854828 100644
--- a/mesonbuild/cmake/toolchain.py
+++ b/mesonbuild/cmake/toolchain.py
@@ -37,20 +37,20 @@ class CMakeExecScope(Enum):
class CMakeToolchain:
def __init__(self, cmakebin: 'CMakeExecutor', env: 'Environment', for_machine: MachineChoice, exec_scope: CMakeExecScope, build_dir: Path, preload_file: T.Optional[Path] = None) -> None:
- self.env = env
- self.cmakebin = cmakebin
- self.for_machine = for_machine
- self.exec_scope = exec_scope
- self.preload_file = preload_file
- self.build_dir = build_dir
- self.build_dir = self.build_dir.resolve()
+ self.env = env
+ self.cmakebin = cmakebin
+ self.for_machine = for_machine
+ self.exec_scope = exec_scope
+ self.preload_file = preload_file
+ self.build_dir = build_dir
+ self.build_dir = self.build_dir.resolve()
self.toolchain_file = build_dir / 'CMakeMesonToolchainFile.cmake'
- self.cmcache_file = build_dir / 'CMakeCache.txt'
- self.minfo = self.env.machines[self.for_machine]
- self.properties = self.env.properties[self.for_machine]
- self.compilers = self.env.coredata.compilers[self.for_machine]
- self.cmakevars = self.env.cmakevars[self.for_machine]
- self.cmakestate = self.env.coredata.cmake_cache[self.for_machine]
+ self.cmcache_file = build_dir / 'CMakeCache.txt'
+ self.minfo = self.env.machines[self.for_machine]
+ self.properties = self.env.properties[self.for_machine]
+ self.compilers = self.env.coredata.compilers[self.for_machine]
+ self.cmakevars = self.env.cmakevars[self.for_machine]
+ self.cmakestate = self.env.coredata.cmake_cache[self.for_machine]
self.variables = self.get_defaults()
self.variables.update(self.cmakevars.get_variables())
@@ -165,7 +165,7 @@ class CMakeToolchain:
# Only set these in a cross build. Otherwise CMake will trip up in native
# builds and thing they are cross (which causes TRY_RUN() to break)
if self.env.is_cross_build(when_building_for=self.for_machine):
- defaults['CMAKE_SYSTEM_NAME'] = [SYSTEM_MAP.get(self.minfo.system, self.minfo.system)]
+ defaults['CMAKE_SYSTEM_NAME'] = [SYSTEM_MAP.get(self.minfo.system, self.minfo.system)]
defaults['CMAKE_SYSTEM_PROCESSOR'] = [self.minfo.cpu_family]
defaults['CMAKE_SIZEOF_VOID_P'] = ['8' if self.minfo.is_64_bit else '4']
@@ -216,8 +216,8 @@ class CMakeToolchain:
# Generate the CMakeLists.txt
mlog.debug('CMake Toolchain: Calling CMake once to generate the compiler state')
- languages = list(self.compilers.keys())
- lang_ids = [language_map.get(x, x.upper()) for x in languages]
+ languages = list(self.compilers.keys())
+ lang_ids = [language_map.get(x, x.upper()) for x in languages]
cmake_content = dedent(f'''
cmake_minimum_required(VERSION 3.7)
project(CompInfo {' '.join(lang_ids)})
@@ -253,7 +253,7 @@ class CMakeToolchain:
for lang in languages:
lang_cmake = language_map.get(lang, lang.upper())
- file_name = f'CMake{lang_cmake}Compiler.cmake'
+ file_name = f'CMake{lang_cmake}Compiler.cmake'
vars = vars_by_file.setdefault(file_name, {})
vars[f'CMAKE_{lang_cmake}_COMPILER_FORCED'] = ['1']
self.cmakestate.update(lang, vars)
diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py
index 04c40a9..1dd636f 100644
--- a/mesonbuild/cmake/traceparser.py
+++ b/mesonbuild/cmake/traceparser.py
@@ -56,17 +56,17 @@ class CMakeTarget:
name: str,
target_type: str,
properties: T.Optional[T.Dict[str, T.List[str]]] = None,
- imported: bool = False,
- tline: T.Optional[CMakeTraceLine] = None
+ imported: bool = False,
+ tline: T.Optional[CMakeTraceLine] = None
):
if properties is None:
properties = {}
- self.name = name
- self.type = target_type
- self.properties = properties
- self.imported = imported
- self.tline = tline
- self.depends = [] # type: T.List[str]
+ self.name = name
+ self.type = target_type
+ self.properties = properties
+ self.imported = imported
+ self.tline = tline
+ self.depends = [] # type: T.List[str]
self.current_bin_dir = None # type: T.Optional[Path]
self.current_src_dir = None # type: T.Optional[Path]
@@ -95,9 +95,9 @@ class CMakeGeneratorTarget(CMakeTarget):
class CMakeTraceParser:
def __init__(self, cmake_version: str, build_dir: Path, env: 'Environment', permissive: bool = True) -> None:
- self.vars: T.Dict[str, T.List[str]] = {}
- self.vars_by_file: T.Dict[Path, T.Dict[str, T.List[str]]] = {}
- self.targets: T.Dict[str, CMakeTarget] = {}
+ self.vars: T.Dict[str, T.List[str]] = {}
+ self.vars_by_file: T.Dict[Path, T.Dict[str, T.List[str]]] = {}
+ self.targets: T.Dict[str, CMakeTarget] = {}
self.cache: T.Dict[str, CMakeCacheEntry] = {}
self.explicit_headers = set() # type: T.Set[Path]
@@ -203,7 +203,7 @@ class CMakeTraceParser:
fn(l)
# Evaluate generator expressions
- strlist_gen: T.Callable[[T.List[str]], T.List[str]] = lambda strlist: parse_generator_expressions(';'.join(strlist), self).split(';') if strlist else []
+ strlist_gen: T.Callable[[T.List[str]], T.List[str]] = lambda strlist: parse_generator_expressions(';'.join(strlist), self).split(';') if strlist else []
pathlist_gen: T.Callable[[T.List[str]], T.List[Path]] = lambda strlist: [Path(x) for x in parse_generator_expressions(';'.join(strlist), self).split(';')] if strlist else []
self.vars = {k: strlist_gen(v) for k, v in self.vars.items()}
@@ -303,10 +303,10 @@ class CMakeTraceParser:
"""
# DOC: https://cmake.org/cmake/help/latest/command/set.html
- cache_type = None
+ cache_type = None
cache_force = 'FORCE' in tline.args
try:
- cache_idx = tline.args.index('CACHE')
+ cache_idx = tline.args.index('CACHE')
cache_type = tline.args[cache_idx + 1]
except (ValueError, IndexError):
pass
@@ -466,7 +466,7 @@ class CMakeTraceParser:
cbinary_dir = self.var_to_str('MESON_PS_CMAKE_CURRENT_BINARY_DIR')
csource_dir = self.var_to_str('MESON_PS_CMAKE_CURRENT_SOURCE_DIR')
- target.working_dir = Path(working_dir) if working_dir else None
+ target.working_dir = Path(working_dir) if working_dir else None
target.current_bin_dir = Path(cbinary_dir) if cbinary_dir else None
target.current_src_dir = Path(csource_dir) if csource_dir else None
target._outputs_str = self._guess_files(target._outputs_str)
diff --git a/mesonbuild/cmake/tracetargets.py b/mesonbuild/cmake/tracetargets.py
index 21aad86..2169a6b 100644
--- a/mesonbuild/cmake/tracetargets.py
+++ b/mesonbuild/cmake/tracetargets.py
@@ -110,8 +110,8 @@ def resolve_cmake_trace_targets(target_name: str,
processed_targets += [curr]
res.include_directories = sorted(set(res.include_directories))
- res.link_flags = sorted(set(res.link_flags))
+ res.link_flags = sorted(set(res.link_flags))
res.public_compile_opts = sorted(set(res.public_compile_opts))
- res.libraries = sorted(set(res.libraries))
+ res.libraries = sorted(set(res.libraries))
return res