diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-07 16:48:07 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-07 17:24:30 +0300 |
commit | ce359a1ae006b588b4427ef8784224a36ada4caf (patch) | |
tree | 2cafe6790d1a1e766ef4113c20d2a8c03df4312e /project/boost | |
parent | v2.3 (diff) | |
download | cmake-common-ce359a1ae006b588b4427ef8784224a36ada4caf.tar.gz cmake-common-ce359a1ae006b588b4427ef8784224a36ada4caf.zip |
project.toolset: support versioned MSVC toolsets
You can now use something like msvc-141, vs-2017, etc.
Diffstat (limited to 'project/boost')
-rw-r--r-- | project/boost/build.py | 18 | ||||
-rw-r--r-- | project/boost/directory.py | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/project/boost/build.py b/project/boost/build.py index 53fdf42..cb3688c 100644 --- a/project/boost/build.py +++ b/project/boost/build.py @@ -35,7 +35,7 @@ from project.configuration import Configuration from project.linkage import Linkage from project.os import on_linux_like from project.platform import Platform -from project.toolset import Toolset, ToolsetHint +from project.toolset import Toolset, ToolsetVersion from project.utils import normalize_path, setup_logging @@ -45,6 +45,7 @@ DEFAULT_CONFIGURATIONS = (Configuration.DEBUG, Configuration.RELEASE,) # binaries from a CI, etc. and run them everywhere): DEFAULT_LINK = (Linkage.STATIC,) DEFAULT_RUNTIME_LINK = Linkage.STATIC +DEFAULT_TOOLSET_VERSION = ToolsetVersion.default() B2_QUIET = ['warnings=off', '-d0'] B2_VERBOSE = ['warnings=all', '-d2', '--debug-configuration'] @@ -52,7 +53,7 @@ B2_VERBOSE = ['warnings=all', '-d2', '--debug-configuration'] class BuildParameters: def __init__(self, boost_dir, build_dir=None, platforms=None, configurations=None, link=None, runtime_link=None, - toolset_hint=None, verbose=False, b2_args=None): + toolset_version=None, verbose=False, b2_args=None): boost_dir = normalize_path(boost_dir) if build_dir is not None: @@ -61,7 +62,7 @@ class BuildParameters: configurations = configurations or DEFAULT_CONFIGURATIONS link = link or DEFAULT_LINK runtime_link = runtime_link or DEFAULT_RUNTIME_LINK - toolset_hint = toolset_hint or ToolsetHint.AUTO + toolset_version = toolset_version or DEFAULT_TOOLSET_VERSION verbosity = B2_VERBOSE if verbose else B2_QUIET if b2_args: b2_args = verbosity + b2_args @@ -74,7 +75,7 @@ class BuildParameters: self.configurations = configurations self.link = link self.runtime_link = runtime_link - self.toolset_hint = toolset_hint + self.toolset_version = toolset_version self.b2_args = b2_args @staticmethod @@ -84,7 +85,7 @@ class BuildParameters: def enum_b2_args(self): with self._create_build_dir() as build_dir: for platform in self.platforms: - toolset = Toolset.make(self.toolset_hint, platform) + toolset = Toolset.make(self.toolset_version, platform) for configuration in self.configurations: for link, runtime_link in self._enum_linkage_options(): with self._b2_args(build_dir, toolset, platform, configuration, link, runtime_link) as args: @@ -167,10 +168,9 @@ def _parse_args(argv=None): type=Linkage.parse, default=DEFAULT_RUNTIME_LINK, help=f'how the libraries link to the runtime ({linkage_options})') - toolset_options = '/'.join(map(str, ToolsetHint.all())) - parser.add_argument('--toolset', metavar='TOOLSET', dest='toolset_hint', - type=ToolsetHint.parse, default=ToolsetHint.AUTO, - help=f'toolset to use ({toolset_options})') + parser.add_argument('--toolset', metavar='TOOLSET', dest='toolset_version', + type=ToolsetVersion.parse, default=DEFAULT_TOOLSET_VERSION, + help=f'toolset to use ({ToolsetVersion.usage()})') parser.add_argument('--build', metavar='DIR', dest='build_dir', type=normalize_path, diff --git a/project/boost/directory.py b/project/boost/directory.py index 4da58a7..be633fe 100644 --- a/project/boost/directory.py +++ b/project/boost/directory.py @@ -33,7 +33,7 @@ class BoostDir: def bootstrap(self, params): with self._go(): - run([self._bootstrap_path()] + self._bootstrap_args(params.toolset_hint)) + run([self._bootstrap_path()] + self._bootstrap_args(params.toolset_version)) def _b2(self, params): for b2_params in params.enum_b2_args(): @@ -51,8 +51,8 @@ class BoostDir: return f'bootstrap{ext}' @staticmethod - def _bootstrap_args(hint): - toolset = Toolset.detect(hint) + def _bootstrap_args(toolset_version): + toolset = Toolset.detect(toolset_version) if on_windows(): return toolset.bootstrap_bat_args() return toolset.bootstrap_sh_args() |