livery.extensions.cmake._build¶
livery.extensions.cmake._build ¶
The gate build of a CMake project: configure, compile, and run its tests.
The build lands in the package's build/gate directory, configured
with the Ninja generator and a compilation database for the tools that
read one. The tests run through ctest. While coverage is listed, this
extension's [for.coverage] table applies (measures): the build
is instrumented and each run is measured by the compiler family CMake
detected, gcov for gcc, llvm-cov for clang, Microsoft's engine for
MSVC, whose output _readings turns into the package's part; while
it is not, the build is not instrumented and ctest runs alone. On
Windows with no compiler chosen, the build enters the newest Visual
Studio's C++ environment itself. Nothing here names a language: CMake
chooses the compilers its project asks for.
Every tool here is a tool of the store, reached through its toolroom
handle, so the version is the one this checkout's lock pins. A handle
spawns its tool by name, so a machine that never deployed one raises
OSError, which becomes a refusal naming the sync that supplies it.
Functions:
| Name | Description |
|---|---|
measurer_for |
The measurer for compiler_id as CMake spells it; empty without one. |
measures |
Whether package's gate build is measured: cmake contributes to coverage. |
toolchain_env |
The environment the gate's build tools run in. |
vswhere_path |
Where this machine keeps vswhere, present or not. |
configure |
Configure package into the gate's build directory; arguments go to cmake. |
compile |
Build the configured package, arguments to cmake's build; incremental. |
gate_build |
Configure and build package into the gate's build directory. |
test |
Run ctest over the gate build: every test, or selection's alone. |
compiler_of |
The gate build's C++ compiler id and path, as CMake detected them. |
compile_commands |
Where the package's gate build writes its compilation database. |
Attributes:
| Name | Type | Description |
|---|---|---|
GATE_BUILD_DIR |
|
|
COVERAGE_CMAKE |
|
|
NAME |
|
|
MEASURED_FOR |
|
|
PROJECT_INCLUDE |
|
|
PROFILE_DIR |
|
|
FAMILIES |
|
|
SHELL |
|
|
VSWHERE |
|
|
MSVC_TOOLS |
|
|
MSVC_TOOLS_X64 |
|
|
ENGINE_RUNTIME |
|
FAMILIES
module-attribute
¶
MSVC_TOOLS
module-attribute
¶
MSVC_TOOLS_X64
module-attribute
¶
ENGINE_RUNTIME
module-attribute
¶
ENGINE_RUNTIME = re.compile('(static_)?covrun\\d*\\.dll', re.IGNORECASE)
measurer_for ¶
The measurer for compiler_id as CMake spells it; empty without one.
measures ¶
Whether package's gate build is measured: cmake contributes to coverage.
True while the workspace package belongs to lists coverage and
this extension's [for.coverage] table applies
(livery.workshop.contributions_for).
Source code in packages/extensions/cmake/src/livery/extensions/cmake/_build.py
toolchain_env ¶
The environment the gate's build tools run in.
This process's environment, entered into MSVC's on Windows: with
no CXX set and no cl on PATH, vswhere names the newest
Visual Studio that has the C++ build tools for this architecture,
and the environment its vcvars batch file leaves is read back
through set. CC and CXX then name cl, so CMake
takes MSVC over a MinGW gcc that is also on PATH: on Windows the
gate builds with MSVC unless CXX says otherwise, and a person
who sets it chooses. Read once per process; a copy each call.
Raises:
| Type | Description |
|---|---|
Failed
|
on Windows with no compiler chosen and no Visual Studio installation with the C++ build tools to enter. |
Source code in packages/extensions/cmake/src/livery/extensions/cmake/_build.py
vswhere_path ¶
Where this machine keeps vswhere, present or not.
Under the 32-bit program files directory env names, this process's when env is None; the key is read in both spellings, since Windows upper-cases the ones a process inherits.
Source code in packages/extensions/cmake/src/livery/extensions/cmake/_build.py
configure ¶
Configure package into the gate's build directory; arguments go to cmake.
CMake configures against the host's toolchain with the Ninja
generator, in the environment toolchain_env enters, and
exports the compile commands clang-tidy reads. A measured build
(measures) includes coverage.cmake, and an unmeasured one
removes the include from the cache. A dependency the project's
CMakeLists.txt cannot find fails the configure with cmake's own
message.
Source code in packages/extensions/cmake/src/livery/extensions/cmake/_build.py
compile ¶
Build the configured package, arguments to cmake's build; incremental.
Source code in packages/extensions/cmake/src/livery/extensions/cmake/_build.py
gate_build ¶
Configure and build package into the gate's build directory.
What the package's ctest runs on, in one call, for the affected
gate's test-only step; the two halves are the build.configure
and build.compile steps.
Source code in packages/extensions/cmake/src/livery/extensions/cmake/_build.py
test ¶
test(package: Package, root: Path, *, selection: tuple[str, ...] = (), arguments: tuple[str, ...] = ()) -> None
Run ctest over the gate build: every test, or selection's alone.
arguments go to ctest after the workshop's own.
A selected test file maps to the ctest named after its stem
(tests/test_acme.cpp runs test_acme), which is how the
template registers tests; a selection no ctest answers to is a
refusal naming the rule. A measured run (measures) is measured by
the family of the compiler CMake configured the gate build with: gcov
and llvm-cov read the counters a green run left, and Microsoft's
engine collects around the run itself. The lines reached land as
the package's part in the line format at the workspace root
(write_part), and the package's part of an earlier run goes
first, so a red run leaves none; a family without a measurer
refuses by name, since a suite that ran unmeasured never passes as
measured. A run that is not measured runs ctest alone and leaves no
part.
Source code in packages/extensions/cmake/src/livery/extensions/cmake/_build.py
compiler_of ¶
The gate build's C++ compiler id and path, as CMake detected them.
Read from the compiler file CMake writes on configure; both empty for a package whose gate build is not configured.
Source code in packages/extensions/cmake/src/livery/extensions/cmake/_build.py
compile_commands ¶
Where the package's gate build writes its compilation database.