diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-23 18:52:49 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-23 18:52:49 +0300 |
commit | 8b3d24461ff1946fee8f599bfdc77453691f388d (patch) | |
tree | 82439782d9127464de224c71dc343dfbecb0d1c6 /project | |
parent | project.boost.build: refactoring & cleanup (diff) | |
download | cmake-common-8b3d24461ff1946fee8f599bfdc77453691f388d.tar.gz cmake-common-8b3d24461ff1946fee8f599bfdc77453691f388d.zip |
project: minor refactoring
Diffstat (limited to 'project')
-rw-r--r-- | project/boost/toolchain.py | 6 | ||||
-rw-r--r-- | project/cmake/build.py | 4 | ||||
-rw-r--r-- | project/cmake/toolchain.py | 16 |
3 files changed, 13 insertions, 13 deletions
diff --git a/project/boost/toolchain.py b/project/boost/toolchain.py index f79cc17..cd1a422 100644 --- a/project/boost/toolchain.py +++ b/project/boost/toolchain.py @@ -205,7 +205,7 @@ class BoostBuildToolset: ;''' -class ConfigFile(Toolchain): +class CustomToolchain(Toolchain): def __init__(self, platform, config_path, toolset): super().__init__(platform) self.config_path = config_path @@ -240,7 +240,7 @@ class ConfigFile(Toolchain): return args -class GCC(ConfigFile): +class GCC(CustomToolchain): # Force GCC. We don't care whether it's a native Linux GCC or a # MinGW-flavoured GCC on Windows. COMPILER = 'gcc' @@ -277,7 +277,7 @@ class MinGW(GCC): return BoostBuildToolset(MinGW.COMPILER, compiler, MinGW.get_options()) -class Clang(ConfigFile): +class Clang(CustomToolchain): COMPILER = 'clang' @staticmethod diff --git a/project/cmake/build.py b/project/cmake/build.py index 4669c5e..9f9bc00 100644 --- a/project/cmake/build.py +++ b/project/cmake/build.py @@ -66,7 +66,7 @@ class GenerationPhase: def _cmake_args(self, toolchain): result = [] - result += toolchain.get_cmake_args() + result += toolchain.cmake_args() result += self.configuration.cmake_args() result += self._cmake_boost_args() result += self.cmake_args @@ -112,7 +112,7 @@ class BuildPhase: result += ['--config', str(self.configuration)] if self.install_dir is not None: result += ['--target', 'install'] - result += ['--'] + toolchain.get_build_args() + result += ['--'] + toolchain.build_system_args() return result def run(self, toolchain): diff --git a/project/cmake/toolchain.py b/project/cmake/toolchain.py index 22f99df..3311d04 100644 --- a/project/cmake/toolchain.py +++ b/project/cmake/toolchain.py @@ -16,11 +16,11 @@ from project.toolchain import ToolchainType class Toolchain(abc.ABC): @abc.abstractmethod - def get_cmake_args(self): + def cmake_args(self): pass @abc.abstractmethod - def get_build_args(self): + def build_system_args(self): pass @staticmethod @@ -55,10 +55,10 @@ class Toolchain(abc.ABC): class Auto(Toolchain): - def get_cmake_args(self): + def cmake_args(self): return [] - def get_build_args(self): + def build_system_args(self): return [] @@ -66,12 +66,12 @@ class MSVC(Auto): def __init__(self, platform): self.platform = platform - def get_cmake_args(self): + def cmake_args(self): # This doesn't actually specify the generator of course, but I don't # want to implement VS detection logic. return ['-A', self.platform.msvc_arch()] - def get_build_args(self): + def build_system_args(self): return ['/m'] @@ -99,7 +99,7 @@ class Makefile(Toolchain): file.write(contents) return cls(path) - def get_cmake_args(self): + def cmake_args(self): return [ '-D', f'CMAKE_TOOLCHAIN_FILE={self.path}', # The Visual Studio generator is the default on Windows, override @@ -107,7 +107,7 @@ class Makefile(Toolchain): '-G', self._get_makefile_generator(), ] - def get_build_args(self): + def build_system_args(self): return [] |