aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-05-06 23:49:46 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-05-06 23:49:46 +0300
commitaddd6ff33184614c6ad191436d34ea7528b17878 (patch)
tree34a8efb72bfb266f9ab47d65522883eaac6e70a6
parent"toolchain" -> "toolset", part 1 (diff)
downloadcmake-common-addd6ff33184614c6ad191436d34ea7528b17878.tar.gz
cmake-common-addd6ff33184614c6ad191436d34ea7528b17878.zip
"toolchain" -> "toolset", part 2
-rw-r--r--README.md4
-rw-r--r--docs/boost.md4
-rw-r--r--docs/cmake.md2
-rw-r--r--project/boost/build.py24
-rw-r--r--project/boost/directory.py10
-rw-r--r--project/boost/toolset.py26
-rw-r--r--project/ci/boost.py2
-rw-r--r--project/ci/cmake.py2
-rw-r--r--project/ci/dirs.py4
-rw-r--r--project/cmake/build.py40
-rw-r--r--project/cmake/toolset.py30
-rw-r--r--project/platform.py4
-rw-r--r--project/toolset.py6
13 files changed, 79 insertions, 79 deletions
diff --git a/README.md b/README.md
index a99e950..0a2339f 100644
--- a/README.md
+++ b/README.md
@@ -29,8 +29,8 @@ Installation
| ci-boost | `python3 -m project.ci.boost`
| ci-cmake | `python3 -m project.ci.cmake`
-Toolchains
-----------
+Toolsets
+--------
Supported platform/build system/compiler combinations include, but are not
limited to:
diff --git a/docs/boost.md b/docs/boost.md
index 72cea4a..389630a 100644
--- a/docs/boost.md
+++ b/docs/boost.md
@@ -80,7 +80,7 @@ Windows & Clang
---------------
Building Boost using Clang on Windows is a sad story. As of 2020, there're
-three main ways to install the native Clang toolchain on Windows:
+three main ways to install the native Clang toolset on Windows:
* download the installer from llvm.org (`choco install llvm` does this)
a.k.a. the upstream,
@@ -98,7 +98,7 @@ clang-linux, and it's hardcoded to require the ar & ranlib executables to
create static libraries. Which is fine on Linux, since, and I'm quoting the
source, "ar is always available". But it's not fine on Windows, since
ar/ranlib are not, in fact, available there by default. Sure, you can install
-some kind of MinGW toolchain, and it might even work, but what the hell,
+some kind of MinGW toolset, and it might even work, but what the hell,
honestly?
Luckily, both the upstream distribution and the MSYS2 mingw-w64-x86_64-llvm
diff --git a/docs/cmake.md b/docs/cmake.md
index d4685f8..aac40e0 100644
--- a/docs/cmake.md
+++ b/docs/cmake.md
@@ -62,7 +62,7 @@ Cross-compilation
-----------------
If you want to e.g. build x86 binaries on x64 and vice versa, the easiest way
-seems to be to make a CMake "toolchain file", which initializes the proper
+seems to be to make a CMake "toolset file", which initializes the proper
compiler flags (like -m64/-m32, etc.). Such file could look like this:
set(CMAKE_C_COMPILER gcc)
diff --git a/project/boost/build.py b/project/boost/build.py
index d1766ee..565610a 100644
--- a/project/boost/build.py
+++ b/project/boost/build.py
@@ -31,8 +31,8 @@ import sys
import tempfile
from project.boost.directory import BoostDir
-from project.toolset import ToolchainType
-from project.boost.toolset import Toolchain
+from project.toolset import ToolsetHint
+from project.boost.toolset import Toolset
from project.configuration import Configuration
from project.linkage import Linkage
from project.platform import Platform
@@ -53,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=None, verbose=False, b2_args=None):
+ toolset_hint=None, verbose=False, b2_args=None):
boost_dir = normalize_path(boost_dir)
if build_dir is not None:
@@ -62,7 +62,7 @@ class BuildParameters:
configurations = configurations or DEFAULT_CONFIGURATIONS
link = link or DEFAULT_LINK
runtime_link = runtime_link or DEFAULT_RUNTIME_LINK
- toolset = toolset or ToolchainType.AUTO
+ toolset_hint = toolset_hint or ToolsetHint.AUTO
verbosity = B2_VERBOSE if verbose else B2_QUIET
if b2_args:
b2_args = verbosity + b2_args
@@ -75,7 +75,7 @@ class BuildParameters:
self.configurations = configurations
self.link = link
self.runtime_link = runtime_link
- self.toolset = toolset
+ self.toolset_hint = toolset_hint
self.b2_args = b2_args
@staticmethod
@@ -85,10 +85,10 @@ class BuildParameters:
def enum_b2_args(self):
with self._create_build_dir() as build_dir:
for platform in self.platforms:
- toolchain = Toolchain.make(self.toolset, platform)
+ toolset = Toolset.make(self.toolset_hint, platform)
for configuration in self.configurations:
for link, runtime_link in self._enum_linkage_options():
- with self._b2_args(build_dir, toolchain, platform, configuration, link, runtime_link) as args:
+ with self._b2_args(build_dir, toolset, platform, configuration, link, runtime_link) as args:
yield args
def _enum_linkage_options(self):
@@ -119,8 +119,8 @@ class BuildParameters:
return
@contextmanager
- def _b2_args(self, build_dir, toolchain, platform, configuration, link, runtime_link):
- with toolchain.b2_args() as result:
+ def _b2_args(self, build_dir, toolset, platform, configuration, link, runtime_link):
+ with toolset.b2_args() as result:
result.append(f'--build-dir={build_dir}')
result.append('--layout=system')
result += platform.b2_args(configuration)
@@ -168,9 +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, ToolchainType.all()))
- parser.add_argument('--toolset', metavar='TOOLSET',
- type=ToolchainType.parse, default=ToolchainType.AUTO,
+ 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('--build', metavar='DIR', dest='build_dir',
diff --git a/project/boost/directory.py b/project/boost/directory.py
index 7c39383..be660ab 100644
--- a/project/boost/directory.py
+++ b/project/boost/directory.py
@@ -6,7 +6,7 @@
import logging
import os.path
-from project.boost.toolset import Toolchain
+from project.boost.toolset import Toolset
from project.utils import cd, run
from project.os import on_windows
@@ -33,7 +33,7 @@ class BoostDir:
def bootstrap(self, params):
with self._go():
- run([self._bootstrap_path()] + self._bootstrap_args(params.toolset))
+ run([self._bootstrap_path()] + self._bootstrap_args(params.toolset_hint))
def _b2(self, params):
for b2_params in params.enum_b2_args():
@@ -52,10 +52,10 @@ class BoostDir:
@staticmethod
def _bootstrap_args(hint):
- toolchain = Toolchain.detect(hint)
+ toolset = Toolset.detect(hint)
if on_windows():
- return toolchain.get_bootstrap_bat_args()
- return toolchain.get_bootstrap_sh_args()
+ return toolset.get_bootstrap_bat_args()
+ return toolset.get_bootstrap_sh_args()
@staticmethod
def _b2_path():
diff --git a/project/boost/toolset.py b/project/boost/toolset.py
index c59ef23..7f9be10 100644
--- a/project/boost/toolset.py
+++ b/project/boost/toolset.py
@@ -13,7 +13,7 @@ import shutil
import project.mingw
import project.os
-from project.toolset import ToolchainType
+from project.toolset import ToolsetHint
from project.utils import temp_file
@@ -23,7 +23,7 @@ def _gcc_or_auto():
return []
-class Toolchain(abc.ABC):
+class Toolset(abc.ABC):
@contextmanager
def b2_args(self):
# Write the config file, etc.
@@ -41,31 +41,31 @@ class Toolchain(abc.ABC):
@staticmethod
def detect(hint):
- if hint is ToolchainType.AUTO:
+ if hint is ToolsetHint.AUTO:
return Auto
- if hint is ToolchainType.MSVC:
+ if hint is ToolsetHint.MSVC:
return MSVC
- if hint is ToolchainType.GCC:
+ if hint is ToolsetHint.GCC:
return GCC
- if hint is ToolchainType.MINGW:
+ if hint is ToolsetHint.MINGW:
return MinGW
- if hint is ToolchainType.CLANG:
+ if hint is ToolsetHint.CLANG:
return Clang
- if hint is ToolchainType.CLANG_CL:
+ if hint is ToolsetHint.CLANG_CL:
return ClangCL
raise NotImplementedError(f'unrecognized toolset: {hint}')
@staticmethod
def make(hint, platform):
- # Platform is required here, since some toolchains (MinGW-w64) require
+ # Platform is required here, since some toolsets (MinGW-w64) require
# it for the compiler path.
- cls = Toolchain.detect(hint)
+ cls = Toolset.detect(hint)
if cls is MinGW:
return MinGW(platform)
return cls()
-class Auto(Toolchain):
+class Auto(Toolset):
# Let Boost.Build do the detection. Most commonly it means GCC on
# Linux-likes and MSVC on Windows.
@@ -113,7 +113,7 @@ def _full_exe_name(exe):
return os.path.basename(path)
-class Custom(Toolchain):
+class Custom(Toolset):
COMPILER_VERSION = 'custom'
def __init__(self, compiler, path=None, build_options=None):
@@ -253,7 +253,7 @@ class Clang(Custom):
'''
-class ClangCL(Toolchain):
+class ClangCL(Toolset):
@contextmanager
def b2_args(self):
yield [
diff --git a/project/ci/boost.py b/project/ci/boost.py
index 6861603..8784e19 100644
--- a/project/ci/boost.py
+++ b/project/ci/boost.py
@@ -59,7 +59,7 @@ def build_ci(dirs, argv=None):
configurations=(dirs.get_configuration(),),
link=args.link,
runtime_link=args.runtime_link,
- toolset=dirs.get_toolset(),
+ toolset_hint=dirs.get_toolset(),
b2_args=args.b2_args)
build(params)
diff --git a/project/ci/cmake.py b/project/ci/cmake.py
index dbe31f6..9234a39 100644
--- a/project/ci/cmake.py
+++ b/project/ci/cmake.py
@@ -63,7 +63,7 @@ def build_ci(dirs, argv=None):
platform=dirs.get_platform(),
configuration=dirs.get_configuration(),
boost_dir=boost_dir,
- toolset=dirs.get_toolset(),
+ toolset_hint=dirs.get_toolset(),
cmake_args=dirs.get_cmake_args() + args.cmake_args)
build(params)
diff --git a/project/ci/dirs.py b/project/ci/dirs.py
index 6804ff4..7e3ce03 100644
--- a/project/ci/dirs.py
+++ b/project/ci/dirs.py
@@ -11,7 +11,7 @@ from project.boost.version import Version
from project.ci.appveyor.generator import Generator, Image
from project.configuration import Configuration
from project.platform import Platform
-from project.toolset import ToolchainType
+from project.toolset import ToolsetHint
from project.utils import env
@@ -47,7 +47,7 @@ class Dirs(abc.ABC):
@staticmethod
def get_toolset():
if 'TOOLSET' in os.environ:
- return ToolchainType.parse(os.environ['TOOLSET'])
+ return ToolsetHint.parse(os.environ['TOOLSET'])
return None
@staticmethod
diff --git a/project/cmake/build.py b/project/cmake/build.py
index b6f3e85..7ddc6b4 100644
--- a/project/cmake/build.py
+++ b/project/cmake/build.py
@@ -27,16 +27,16 @@ import os.path
import sys
import tempfile
-from project.cmake.toolset import Toolchain
+from project.cmake.toolset import Toolset
from project.configuration import Configuration
from project.platform import Platform
-from project.toolset import ToolchainType
+from project.toolset import ToolsetHint
from project.utils import normalize_path, mkdir_parent, run, setup_logging
DEFAULT_PLATFORM = Platform.AUTO
DEFAULT_CONFIGURATION = Configuration.DEBUG
-DEFAULT_TOOLSET = ToolchainType.AUTO
+DEFAULT_TOOLSET_HINT = ToolsetHint.AUTO
# This way of basically passing `-j` to make is more universal compared to
@@ -71,9 +71,9 @@ class GenerationPhase:
self.boost_dir = boost_dir
self.cmake_args = cmake_args
- def _cmake_args(self, toolchain):
+ def _cmake_args(self, toolset):
result = []
- result += toolchain.cmake_args()
+ result += toolset.cmake_args()
result += self.configuration.cmake_args()
result += self._cmake_boost_args()
result += self.cmake_args
@@ -105,8 +105,8 @@ class GenerationPhase:
]
return args
- def run(self, toolchain):
- run_cmake(self._cmake_args(toolchain))
+ def run(self, toolset):
+ run_cmake(self._cmake_args(toolset))
class BuildPhase:
@@ -119,22 +119,22 @@ class BuildPhase:
self.install_dir = install_dir
self.configuration = configuration
- def _cmake_args(self, toolchain):
+ def _cmake_args(self, toolset):
result = ['--build', self.build_dir]
result += ['--config', str(self.configuration)]
if self.install_dir is not None:
result += ['--target', 'install']
- result += ['--'] + toolchain.build_system_args()
+ result += ['--'] + toolset.build_system_args()
return result
- def run(self, toolchain):
- run_cmake(self._cmake_args(toolchain))
+ def run(self, toolset):
+ run_cmake(self._cmake_args(toolset))
class BuildParameters:
def __init__(self, src_dir, build_dir=None, install_dir=None,
platform=None, configuration=None, boost_dir=None,
- toolset=None, cmake_args=None):
+ toolset_hint=None, cmake_args=None):
src_dir = normalize_path(src_dir)
if build_dir is not None:
@@ -145,7 +145,7 @@ class BuildParameters:
configuration = configuration or DEFAULT_CONFIGURATION
if boost_dir is not None:
boost_dir = normalize_path(boost_dir)
- toolset = toolset or DEFAULT_TOOLSET
+ toolset_hint = toolset_hint or DEFAULT_TOOLSET_HINT
cmake_args = cmake_args or []
self.src_dir = src_dir
@@ -154,7 +154,7 @@ class BuildParameters:
self.platform = platform
self.configuration = configuration
self.boost_dir = boost_dir
- self.toolset = toolset
+ self.toolset_hint = toolset_hint
self.cmake_args = cmake_args
@staticmethod
@@ -180,7 +180,7 @@ class BuildParameters:
def build(params):
with params.create_build_dir() as build_dir:
- toolchain = Toolchain.detect(params.toolset, params.platform, build_dir)
+ toolset = Toolset.detect(params.toolset_hint, params.platform, build_dir)
gen_phase = GenerationPhase(params.src_dir, build_dir,
install_dir=params.install_dir,
@@ -188,10 +188,10 @@ def build(params):
configuration=params.configuration,
boost_dir=params.boost_dir,
cmake_args=params.cmake_args)
- gen_phase.run(toolchain)
+ gen_phase.run(toolset)
build_phase = BuildPhase(build_dir, install_dir=params.install_dir,
configuration=params.configuration)
- build_phase.run(toolchain)
+ build_phase.run(toolset)
def _parse_args(argv=None):
@@ -223,9 +223,9 @@ def _parse_args(argv=None):
type=normalize_path,
help='set Boost directory path')
- toolset_options = '/'.join(map(str, ToolchainType.all()))
- parser.add_argument('--toolset', metavar='TOOLSET',
- type=ToolchainType.parse, default=ToolchainType.AUTO,
+ 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('src_dir', metavar='DIR',
diff --git a/project/cmake/toolset.py b/project/cmake/toolset.py
index 0bf8e64..c3420ea 100644
--- a/project/cmake/toolset.py
+++ b/project/cmake/toolset.py
@@ -12,10 +12,10 @@ import shutil
import project.mingw
from project.os import on_windows
from project.platform import Platform
-from project.toolset import ToolchainType
+from project.toolset import ToolsetHint
-class Toolchain(abc.ABC):
+class Toolset(abc.ABC):
@abc.abstractmethod
def cmake_args(self):
pass
@@ -26,13 +26,13 @@ class Toolchain(abc.ABC):
@staticmethod
def detect(hint, platform, build_dir):
- if hint is ToolchainType.AUTO:
+ if hint is ToolsetHint.AUTO:
if on_windows():
# On Windows, 'auto' means 'msvc', and we need to specify the
# -A parameter. This might break if none of the Visual Studio
# generators are available, but the NMake one is, although I
# don't know how this can be possible normally.
- hint = ToolchainType.MSVC
+ hint = ToolsetHint.MSVC
else:
# On Linux, if the platform wasn't specified, auto-detect
# everything. There's no need to set -mXX flags, etc.
@@ -40,21 +40,21 @@ class Toolchain(abc.ABC):
return Auto()
# If a specific platform was requested, we might need to set
# some CMake/compiler flags, like -m32/-m64.
- hint = ToolchainType.GCC
- if hint is ToolchainType.MSVC:
+ hint = ToolsetHint.GCC
+ if hint is ToolsetHint.MSVC:
return MSVC(platform)
- if hint is ToolchainType.GCC:
+ if hint is ToolsetHint.GCC:
return GCC.setup(platform, build_dir)
- if hint is ToolchainType.MINGW:
+ if hint is ToolsetHint.MINGW:
return MinGW.setup(platform, build_dir)
- if hint is ToolchainType.CLANG:
+ if hint is ToolsetHint.CLANG:
return Clang.setup(platform, build_dir)
- if hint is ToolchainType.CLANG_CL:
+ if hint is ToolsetHint.CLANG_CL:
return ClangCL.setup(platform, build_dir)
raise NotImplementedError(f'unrecognized toolset: {hint}')
-class Auto(Toolchain):
+class Auto(Toolset):
def cmake_args(self):
return []
@@ -75,7 +75,7 @@ class MSVC(Auto):
return []
-class Makefile(Toolchain):
+class Makefile(Toolset):
def __init__(self, path):
self.path = path
@@ -117,7 +117,7 @@ class GCC(Makefile):
return f'''
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
-{platform.makefile_toolchain_file()}'''
+{platform.makefile_toolset_file()}'''
@staticmethod
def setup(platform, build_dir):
@@ -153,7 +153,7 @@ else()
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
endif()
-{platform.makefile_toolchain_file()}'''
+{platform.makefile_toolset_file()}'''
def _get_makefile_generator(self):
if on_windows():
@@ -175,7 +175,7 @@ class ClangCL(Clang):
set(CMAKE_C_COMPILER clang-cl)
set(CMAKE_CXX_COMPILER clang-cl)
set(CMAKE_SYSTEM_NAME Windows)
-{platform.makefile_toolchain_file()}'''
+{platform.makefile_toolset_file()}'''
@staticmethod
def setup(platform, build_dir):
diff --git a/project/platform.py b/project/platform.py
index 92890d0..44118b3 100644
--- a/project/platform.py
+++ b/project/platform.py
@@ -104,8 +104,8 @@ class Platform(Enum):
args += self.b2_stagedir(configuration)
return args
- def makefile_toolchain_file(self):
- # For Makefile generators, we make a special toolchain file that
+ def makefile_toolset_file(self):
+ # For Makefile generators, we make a special toolset file that
# specifies the -m32/-m64 flags, etc.
if self is Platform.AUTO:
# Let the compiler decide.
diff --git a/project/toolset.py b/project/toolset.py
index f92e536..fc4aa85 100644
--- a/project/toolset.py
+++ b/project/toolset.py
@@ -27,7 +27,7 @@ import argparse
from enum import Enum
-class ToolchainType(Enum):
+class ToolsetHint(Enum):
AUTO = 'auto' # This most commonly means GCC on Linux and MSVC on Windows.
MSVC = 'msvc' # Force MSVC.
GCC = 'gcc' # Force GCC.
@@ -40,11 +40,11 @@ class ToolchainType(Enum):
@staticmethod
def all():
- return tuple(ToolchainType)
+ return tuple(ToolsetHint)
@staticmethod
def parse(s):
try:
- return ToolchainType(s)
+ return ToolsetHint(s)
except ValueError as e:
raise argparse.ArgumentTypeError(f'invalid toolset: {s}') from e