diff options
Diffstat (limited to '')
-rw-r--r-- | project/boost/build.py | 15 | ||||
-rw-r--r-- | project/boost/toolchain.py | 41 |
2 files changed, 25 insertions, 31 deletions
diff --git a/project/boost/build.py b/project/boost/build.py index b262e47..7cf1364 100644 --- a/project/boost/build.py +++ b/project/boost/build.py @@ -40,7 +40,7 @@ from project.os import on_linux_like from project.utils import normalize_path, setup_logging -DEFAULT_PLATFORMS = (Platform.native(),) +DEFAULT_PLATFORMS = (Platform.AUTO,) DEFAULT_CONFIGURATIONS = (Configuration.DEBUG, Configuration.RELEASE,) # For my development, I link everything statically (to be able to pull the # binaries from a CI, etc. and run them everywhere): @@ -71,7 +71,6 @@ class BuildParameters: self.boost_dir = boost_dir self.build_dir = build_dir - self.stage_dir = 'stage' self.platforms = platforms self.configurations = configurations self.link = link @@ -126,12 +125,11 @@ class BuildParameters: def _build_params(self, build_dir, toolchain, configuration, link, runtime_link): params = [] params.append(self._build_dir(build_dir)) - params.append(self._stagedir(toolchain, configuration)) - params.append('--layout=system') - params += toolchain.get_b2_args() - params.append(self._variant(configuration)) params.append(self._link(link)) params.append(self._runtime_link(runtime_link)) + params.append('--layout=system') + params += toolchain.b2_args(configuration) + params += configuration.b2_args() params += self.b2_args return params @@ -139,11 +137,6 @@ class BuildParameters: def _build_dir(build_dir): return f'--build-dir={build_dir}' - def _stagedir(self, toolchain, configuration): - platform = str(toolchain.platform) - configuration = str(configuration) - return f'--stagedir={os.path.join(self.stage_dir, platform, configuration)}' - @staticmethod def _link(link): return f'link={link}' diff --git a/project/boost/toolchain.py b/project/boost/toolchain.py index 08bc49c..5422a62 100644 --- a/project/boost/toolchain.py +++ b/project/boost/toolchain.py @@ -104,11 +104,8 @@ class Toolchain(abc.ABC): def __init__(self, platform): self.platform = platform - def get_b2_args(self): - return [ - # Always pass the address-model explicitly. - f'address-model={self.platform.get_address_model()}' - ] + def b2_args(self, configuration): + return self.platform.b2_args(configuration) @staticmethod @contextmanager @@ -139,8 +136,8 @@ class Auto(Toolchain): class MSVC(Auto): - def get_b2_args(self): - return super().get_b2_args() + [ + def b2_args(self, configuration): + return super().b2_args(configuration) + [ 'toolset=msvc', ] @@ -187,14 +184,16 @@ class BoostBuildToolset: self.options = options @property - def toolset_id(self): + def toolset(self): if self.version: return f'{self.compiler}-{self.version}' return self.compiler - @property - def b2_arg(self): - return f'toolset={self.toolset_id}' + def b2_toolset(self): + return f'toolset={self.toolset}' + + def b2_args(self): + return [self.b2_toolset()] def _format_using_options(self): return ''.join(f'\n <{name}>{val}' for name, val in self.options) @@ -232,13 +231,14 @@ class ConfigFile(Toolchain): with tmp as path: yield cls(platform, path, toolset) - def get_b2_args(self): + def b2_args(self, configuration): # All the required options and the toolset definition should be in the # user configuration file. - return super().get_b2_args() + [ - f'--user-config={self.config_path}', - self.toolset.b2_arg, - ] + args = [] + args += super().b2_args(configuration) + args.append(f'--user-config={self.config_path}') + args += self.toolset.b2_args() + return args class GCC(ConfigFile): @@ -273,8 +273,9 @@ class MinGW(GCC): @staticmethod def get_toolset(platform): - path = project.mingw.get_gxx(platform) - return BoostBuildToolset(MinGW.COMPILER, path, MinGW.get_options()) + paths = project.mingw.MinGW(platform) + compiler = paths.gxx() + return BoostBuildToolset(MinGW.COMPILER, compiler, MinGW.get_options()) class Clang(ConfigFile): @@ -320,8 +321,8 @@ class Clang(ConfigFile): class ClangCL(Toolchain): - def get_b2_args(self): - return super().get_b2_args() + [ + def b2_args(self, configuration): + return super().b2_args(configuration) + [ 'toolset=clang-win', 'define=BOOST_USE_WINDOWS_H', ] |