CLI Guide
cppx CLI drives a C++ project through the init -> add -> build -> run -> test -> pack workflow.
Usage
bash
npm --prefix packages run cppx -- <command> [options]Commands
install-tools
Prepare host tools for the active platform.
bash
npm --prefix packages run cppx -- install-tools
npm --prefix packages run cppx -- install-tools --compiler clang
npm --prefix packages run cppx -- install-tools --compiler gcc
npm --prefix packages run cppx -- install-tools --compiler mingw
npm --prefix packages run cppx -- install-tools --compiler msvc --msvc-installation-path "C:\Program Files\Microsoft Visual Studio\2022\BuildTools"Options:
| Option | Meaning |
|---|---|
| `--compiler <clang | gcc |
--msvc-installation-path <path> | Prefer a specific MSVC installation |
Provider summary:
- Windows: verified archive installs for
cmake,ninja,vcpkg,conan, and the managed MinGW toolchain, plus system MSVC detection - macOS 14+: Homebrew for core tools and archive/bootstrap for
vcpkg - Ubuntu LTS profiles (22.04, 24.04):
aptforcmake,ninja, and managedclang/gcc, archive/bootstrap forvcpkg, andpipxforconan - Other Linux: system detection only
Pinned exact-version note:
- configure pinned versions in the GUI or
.cppx/config.toml - official-host managed non-compiler tools accept exact pins
- macOS exact pins for
cmake,ninja, andconanuse verified archive/release assets - Ubuntu LTS profiles (22.04, 24.04) exact pins for
cmakeandninjause verified archives, and exactconanpins usepipx - non-Windows managed
cxxstill uses floating defaults (latest/default) - Ubuntu LTS profiles (22.04, 24.04) managed
cxxacceptspreferred_family = "clang"orpreferred_family = "gcc"
Linux note:
- Ubuntu LTS profiles (22.04, 24.04) are the official Linux managed host set in this slice.
- macOS 14+ and Ubuntu LTS profiles (22.04, 24.04) also allow
tools.cxx.mode = "system"for the compiler already visible onPATH. - Ubuntu LTS profiles (22.04, 24.04) managed
cxxusesclangorgccfromapt, depending onpreferred_family. - Linux
systemcompiler detection can useclang++org++fromPATH. - Unsupported Linux distributions still stay system-only.
init [workspace]
Create a new project.
bash
npm --prefix packages run cppx -- init ./myapp --name myapp
npm --prefix packages run cppx -- init ./myapp --name myapp --backend conanOptions:
| Option | Meaning |
|---|---|
-n, --name <name> | Project name |
| `--backend <vcpkg | conan |
If --backend is omitted, official hosts now start from none by default.
add <dependency> [workspace]
Add a dependency to .cppx/config.toml.
bash
npm --prefix packages run cppx -- add fmt ./myappvcpkg: written intobuild/.cppx/vcpkg.jsonon the next syncconan: written intobuild/.cppx/conanfile.txton the next syncnone: rejected
build [workspace]
Run configure + build for the selected preset.
bash
npm --prefix packages run cppx -- build ./myapp
npm --prefix packages run cppx -- build ./myapp --preset release-x64run [workspace]
Build first, then run the preset binary.
bash
npm --prefix packages run cppx -- run ./myapptest [workspace]
Run the CTest preset.
bash
npm --prefix packages run cppx -- test ./myapppack [workspace]
Run the CPack preset.
bash
npm --prefix packages run cppx -- pack ./myappstatus [workspace]
Inspect tool readiness and provenance.
bash
npm --prefix packages run cppx -- status
npm --prefix packages run cppx -- status ./myappThe output shows:
managedvssystem- provider (
archive,homebrew,apt,pipx,system,msvc) - ownership (
cppx-ownedvsexternal) - requested / resolved version
- executable path
doctor [workspace]
Show blockers, warnings, and next steps for the current host and workspace.
bash
npm --prefix packages run cppx -- doctor
npm --prefix packages run cppx -- doctor ./myappdoctor checks:
- host support tier and provider path
cmake,ninja,ctest,cpack,cxxvcpkgorconanwhen the active backend requires them.cppx/config.tomland generatedbuild/.cppxfiles
The command exits with code 1 when blockers remain.
Backend behavior
vcpkg: generatesbuild/.cppx/vcpkg.jsonand usesvcpkg.cmakeconan: generatesbuild/.cppx/conanfile.txtand runsconan installbefore configurenone: no dependency manifest andcppx addis disabled
Presets
[[presets]]defines the configure/build/test/pack matrixrunnable = falseexcludes a preset fromrun- when no presets exist,
cppxcreatesdebug-<host-arch>andrelease-<host-arch>