Skip to content

cx 1.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 28 Nov 17:10

The first release.

Added

  • cx init --from: import an existing build. --from CMakeLists.txt
    and/or --from vcpkg.json draft the cx.toml: package, standard,
    find_package/FetchContent/CPM/vendored and vcpkg dependencies with their
    link targets (platform- and test-only ones in their sections), defines,
    flags and [[bin]]s. Nothing is evaluated; what can't be translated is
    printed and listed at the end of the cx.toml. --dry-run prints it instead.
    (Importing an existing project)

  • Example 15-popular-libraries: fmt, spdlog and nlohmann/json from git
    (spdlog built against that fmt), Catch2 as a dev-dependency, Asio from vcpkg
    and Qt 6 from the system, the last two behind the features net and gui.

  • Example 16-migrate-cmake: a CMake project with a vendored CMake
    library, next to the cx.toml cx init --from CMakeLists.txt drafted from
    it; the end-to-end tests check that the importer still drafts it.

  • The cx Book works on phones. A new style (docs/theme/): a readable text
    column, code blocks that scroll sideways instead of breaking lines, tables
    that scroll on their own, and below 768px a top bar whose buttons open the
    chapters and the search box as a drawer. Light and dark schemes follow the
    system.

  • cx doc works like cargo doc. It documents the package and every cx
    package it depends on into target/doc/<name>/, linked to each other
    through Doxygen tag files, with target/doc/index.html listing them all.
    The public API (include/) by default; --document-private-items adds
    src/. --no-deps, --features, --locked; fresh packages are not
    generated again. (Formatting, linting and documentation)

  • Doxygen is a managed tool: tools.doxygen / CX_DOXYGEN, downloaded
    (1.18.0) when it isn't in PATH on Linux x86-64, macOS and Windows x64, and
    by cx tools install. (External tools)

  • Examples, as in Cargo: cx run --example and cx run --bin without a
    name list what's available; cx build --example <NAME> (repeatable) builds
    just those examples. (Commands)

  • package.authors as in uv: authors = [{ name = "...", email = "..." }],
    with a name, an email or both, checked when the manifest is read
    ("Name <email>" strings still work). cx new/cx init fill it in from git
    (--author-from auto|git|none), and cx metadata reports it. (cx.toml)

  • Examples of foreign dependencies: 12-cmake-dependencies (fmt and
    doctest from git), 13-vcpkg-dependencies (fmt and zlib from vcpkg) and
    14-configure-dependencies (an Autotools project).

  • examples/: eleven small cx projects, one feature each, from a
    single binary to workspaces, features, CMake interop, code generation,
    shared libraries, platform-specific dependencies and modules. The
    end-to-end tests build and run all of them. (examples/README.md)

  • Releases and cx self update. Tagging v<version> builds cx and
    cx-registry for Linux (static, x86-64 and aarch64), macOS (Intel and Apple
    silicon) and Windows, and publishes them with cx-release.toml (checksums,
    signed once CX_RELEASE_SIGNING_KEY is set), SHA256SUMS, build
    provenance and install scripts (install.sh, install.ps1).
    cx self update [VERSION] replaces the running cx after checking the
    checksum, the signature and that the new cx runs; cx self version shows
    which cx this is. cx index sign also signs a single file. A static Linux
    cx finds the system's CA certificates where the distribution keeps them.
    (Installation)

  • Dependencies with other build systems. { vcpkg = true } installs a
    vcpkg port (vcpkg install in manifest mode, once per set of ports and
    triplet) and finds it with find_package(). Git and path dependencies with
    a configure script (or configure.ac) or an SConstruct are built at
    build time and linked as <name>::<name>; build-system, libs and
    include-dirs say how. cx add --vcpkg/--build-system/--lib. New tools:
    tools.python and tools.scons (downloaded when missing), tools.vcpkg,
    tools.make and tools.autoreconf (found only). (Dependencies)

  • cx cache info|gc|clean and cx clean --gc. cx records when it uses
    each cache entry (<cache>/last-use.toml); gc removes what wasn't used
    for --max-age (default 90 days) or beyond --max-size, keeping what the
    project's cx.lock needs. cache.auto-gc / CX_CACHE_AUTO_GC cleans up
    automatically, at most once a day. (Build caches)

  • Compressed package archives. cx package compresses with cx's own
    deterministic deflate encoder (about as small as gzip -6); archives stay
    reproducible. (Publishing)

  • cx check: syntax-only compiles (-fsyntax-only, MSVC /Zs) with a
    build's exact flags, incremental through depfiles, with the same
    diagnostics and JSON output as cx build. (Formatting, linting and docs)

  • Language-standard-aware resolution. Index entries record each version's
    language and standard; versions that need a newer standard than the
    package uses are avoided ([resolver] incompatible-standards = "fallback",
    the default), refused ("deny") or ignored ("allow"); max-standard
    raises the limit. (Dependencies)

  • Build-dependencies. [build-dependencies] are cx packages whose
    binaries [[generate]] commands run as {bin:<package>/<binary>}. They are
    locked like other dependencies, never linked, and built for the host when
    cross-compiling (target/host/<profile>/). cx add --build.
    (Code generation and build scripts)

  • A shared artifact store. build.artifact-store (a URL or directory)
    shares the artifact cache: missing compiled dependencies are downloaded
    after configuring, and with build.artifact-store-write new ones are
    uploaded. Entries carry SHA-256 checksums of their files and can be
    Ed25519-signed (build.artifact-keys, build.artifact-signing-key).
    (Build caches)

  • Public and private dependencies. public = true on a dependency makes
    it part of a library's interface; others are linked privately, so users of
    the library don't get their headers. A dependency without public that the
    package's include/ headers include stays public, with a warning to say
    so. cx add --public writes the key.
    (Dependencies)

  • Platform-specific dependencies. [target.'cfg(...)'.dependencies]
    (and .dev-dependencies, or a triple instead of cfg(...)) with unix,
    windows, target_os, target_arch, target_env, target_vendor,
    target_family, all, any and not. They are chosen for the
    --target triple or the host; cx.lock covers every platform. Index
    entries carry them as target = "cfg(...)". cx add --platform and
    cx tree --target.
    (Dependencies)

  • Credential providers. [registries.<name>] credential-provider and
    [registry] global-credential-providers: cx:token (credentials.toml),
    cx:keychain (macOS keychain, Windows Credential Manager, Secret
    Service), cx:token-from-stdout <COMMAND>, or a helper program speaking a
    small stdin protocol. Providers run only when a request needs a token.
    cx login/cx logout use the registry's first provider.
    (Configuration)

  • cx-registry, a small registry server installed next to cx:
    init, serve (static index files with ETags, plus the publish and yank
    API, with every upload checked against its cx.toml and index files signed
    again) and token add|list|remove (stored as SHA-256 hashes, with scopes
    and package globs). (Publishing)

  • A registry's api in config.toml may be relative to the index URL.

  • Managed external tools. CMake, Ninja, clang-format and clang-tidy no
    longer have to be installed. cx uses the ones in PATH, and downloads a
    pinned release of any that's missing (or, for CMake, older than 3.25),
    checked by SHA-256, into <cache>/tools/. On Windows, Ninja isn't
    downloaded automatically. tools.<name> in config.toml (or CX_CMAKE,
    CX_NINJA, CX_CLANG_FORMAT, CX_CLANG_TIDY) picks "auto",
    "system", "managed" or a program. tools.mirror / CX_TOOLS_MIRROR
    downloads from a mirror. cx tools list shows what cx runs, and
    cx tools install downloads ahead of time.
    (External tools)

  • cortex is a cx package. The repository's cx.toml lets a built cx
    build and test itself (cx build, cx test). The CMake build is unchanged
    and stays the way to bootstrap cx. Both builds use the same pinned
    dependencies (through cmake/deps/) and read the version from cx.toml.
    (Installation)

  • CI builds cortex with the cx it just built, on Linux and macOS.

  • Agent skills in skills/ teach Claude Code to use cx: project setup,
    dependencies, migrating from CMake, publishing, CI and troubleshooting.
    (skills/README.md)

  • The README lists cx's features.

  • Toolchains and cross-compilation. [toolchain] (cc, cxx,
    min-version) and [target.<triple>] (cmake-toolchain-file, sysroot,
    runner, cc, cxx), in cx.toml or the configuration files. Use
    --target <triple> on build, run, test, bench, lint, metadata
    and clean; output goes to target/<triple>/<profile>/, and run/test
    go through the runner. CC/CXX win over both.
    (Toolchains)

  • Compiler caches. build.compiler-cache (auto by default: sccache or
    ccache when installed) sets the compiler launcher. CX_COMPILER_CACHE
    overrides it. (Build caches)

  • An artifact cache for dependencies (opt-in, with build.artifact-cache
    or CX_ARTIFACT_CACHE=1). Compiled registry and git cx packages are stored
    once, keyed by a SHA-256 of their sources, features, compiler and flags, and
    imported instead of rebuilt.

  • cx install and cx uninstall. Install a package's binaries into
    ~/.local (or --root, CX_INSTALL_ROOT) from the current directory,
    --path, --git or the registry (NAME@REQ). --lib also installs the
    library, its headers, its bundled cx dependencies and a CMake package
    config, so plain CMake projects can find_package() a cx library.
    (Installing and CMake export)

  • Code generation. [[generate]] runs commands at build time, with
    inputs and outputs. Generated sources join the library, and generated
    headers are on the include path. A build.cmake next to cx.toml is
    included after the package's targets, with documented CX_* variables.
    Registry entries mark such packages with build-script = true, and cx
    points them out once. (Code generation)

  • C++20 modules. .cppm/.ixx files in src/ are module units of the
    library, which dependents can import. import-std = true turns on
    import std; where CMake supports it. (C++20 modules)

  • A test can span several files: each tests/<name>/main.cpp directory is one
    test program, built from every source in it. Subdirectories without a
    main.* still only hold helpers. (Package layout)

  • Signed registry indexes. List a registry's trusted Ed25519 keys with
    [registries.<name>] index = "..." and keys = ["ed25519:..."]. Every index
    file then needs a valid <file>.sig; a missing or bad signature is an error.
    Signatures are checked before anything is parsed, cached copies included.
    The index's config.toml can list additional keys for key rotation.
    (Security)

  • cx index keygen, cx index sign and cx index pubkey to sign a static
    registry, and --sign-key on cx publish and cx yank to re-sign what
    they change.

  • cx audit checks cx.lock against an advisory database: a git repository or
    directory of TOML advisories, set with --db, audit.database or
    CX_AUDIT_DB. It exits non-zero on vulnerabilities, and on informational
    advisories with --deny warnings.

  • cx verify downloads every locked registry archive again, without the cache,
    and checks it against cx.lock and the index. It also checks that locked git
    commits exist and locked tags haven't moved.

  • cx vendor [--dir DIR] copies the sources of every locked registry and git
    dependency into a directory. With [source] vendor = "vendor" (or
    CX_VENDOR), builds use only those sources: no network, no cache and no
    registry configuration, and cx.lock stays the same. Edited vendored files
    are detected. (Vendoring)

  • "dep?/feature" feature items enable a dependency's feature only if the
    dependency is enabled anyway. (Features)

  • "dep/KEY=VALUE" feature items set CMake options of plain CMake
    dependencies. Two features setting different values for the same key are an
    error.

  • cx fmt [--check] (clang-format), cx lint [--fix] (clang-tidy, in
    parallel, after a build) and cx doc [--open] (Doxygen with the
    doxygen-awesome-css theme). Each uses the project's .clang-format,
    .clang-tidy or Doxyfile when there is one.
    (Formatting, linting and docs)

  • --message-format json on build, run, test, bench, tree and
    generate writes one JSON object per line to stdout: resolved,
    compiler-message, artifact, build-finished and generated, each with
    "format_version": 1. (Build output and JSON)

  • cx metadata prints the resolved packages, their targets, and the build and
    compile_commands.json paths as one JSON document, for IDEs.

  • Configuration keys source.vendor, audit.database and
    registries.<name>.keys, and environment variables CX_VENDOR and
    CX_AUDIT_DB.

  • New dependency: Monocypher 4.0.2, for Ed25519, pinned by SHA-256.

  • Configuration files. ~/.config/cx/config.toml for personal defaults and
    .cx/config.toml for a project, with keys registries.<name>,
    net.offline, net.retries, build.jobs and term.color. The order of
    precedence is flags, then environment variables, then the project file, then
    the user file. (Configuration)

  • cx config get/set/unset/list; list shows where each value comes from.

  • cx login and cx logout store registry tokens in
    ~/.config/cx/credentials.toml (mode 0600, refused if other users can read
    it). CX_TOKEN and CX_TOKEN_<NAME> also work. Tokens are only sent to the
    registry's own host, and never printed.

  • Failed HTTP requests (connection errors, 5xx, 429) are retried net.retries
    times (default 2).

  • Profiles. [profile.<name>] with inherits, opt-level, debug,
    lto, sanitizers, defines, flags and link-flags, selected with
    --profile. Each profile builds into target/<profile>/. Sanitizers and LTO
    apply to every package. (Profiles)

  • More targets. Binaries in src/bin/, examples in examples/ and
    benchmarks in benches/. [[bin]], [[example]] and [[bench]] with
    required-features, and package.default-run.
    (Package layout)

  • cx run --bin and --example, cx build --examples/--benches/--all-targets,
    and cx bench.

  • [lib] kind = "shared" or "both". Every compiled library gets a generated
    <name>/export.hpp with an <ID>_EXPORT macro, and binaries find the shared
    library next to themselves.

  • Publishing. cx package builds a reproducible archive and checks that it
    builds. cx publish publishes into a static index directory (--index) or
    through a registry's HTTP API (api in the index's config.toml).
    cx yank [--undo] hides a version from new resolutions.
    package.include and package.exclude adjust the packaged files.
    (Publishing)

  • Workspaces. [workspace] with members, exclude and
    [workspace.dependencies] (used as name = { workspace = true }), and
    virtual workspaces. Members share one cx.lock and one target/. -p and
    --workspace choose members. (Workspaces)

  • Windows and MSVC support (new, so far only tested in CI): a
    CreateProcessW process layer, Windows paths for the cache and
    configuration, and Schannel for TLS. Visual Studio's multi-config generators
    are supported.

  • A CI workflow: Linux with GCC and Clang, macOS, and Windows with MSVC.

  • cx new, cx init, cx build, cx run, cx test, cx clean, cx add,
    cx remove, cx update, cx tree and cx generate.

  • cx.toml with [package], [dependencies], [dev-dependencies],
    [features] and [build]; the package layout is found by convention.

  • Registry, git, path and system dependencies. Git and path dependencies can
    be cx packages or plain CMake projects.

  • Version solving with PubGrub, with readable failure reports, and cx.lock
    v2 with commits and checksums.

  • Registries over HTTPS, HTTP or a local directory, with an on-disk cache,
    conditional requests, parallel downloads, checksum verification and
    --offline.

  • Cargo-style features, including optional dependencies and dependency
    features. Builds get CX_FEATURE_<PACKAGE>_<FEATURE> definitions.

  • Colored, Cargo-style status output, controlled with --color, NO_COLOR and
    CLICOLOR_FORCE.

Changed

  • Git dependencies are fetched shallowly. cx fetches only the commit the
    tag, branch or default branch points at (--depth 1), then a locked commit
    by itself if the branch has moved on: adding nlohmann/json at a tag takes
    about 3 s and 10 MB instead of 90 s and 350 MB. Short revs still fetch
    everything. Caches made by older versions keep working.
    (Dependencies)

  • cx no longer needs tar. Registry packages, artifact-store entries,
    cx package's verification, uploads to cx-registry, cx self update and
    the downloaded tools are unpacked by cx's own .tar.gz reader (ustar, pax and
    GNU archives). It refuses entries and symbolic links that would point outside
    the destination, and cx-registry caps how large an upload may unpack.
    (Installation)

  • cx is licensed under the Apache License 2.0 instead of GPL-3.0
    (LICENSE, package.license = "Apache-2.0").

  • The cx Book is built with Doxygen instead of mdBook. The Doxyfile at
    the root builds it with cx doc (target/doc/cx/), the CMake docs
    target (build/docs/html/) or doxygen Doxyfile; CI uses the CMake
    target with the Doxygen release cx pins. The chapter order moved from
    SUMMARY.md to @subpage lines in introduction.md, and broken links
    now fail the build.

  • cx doc writes target/doc/<package>/index.html (before: target/doc/index.html
    for a single package, which is now the list of documented packages).

  • The artifact cache's key no longer changes when CMake configures again
    (CMAKE_CXX_STANDARD_LIBRARY is only set on the first configure), so
    reconfiguring no longer misses the cache. The key now also covers the
    compiler's target and library architecture.

  • A library's dependencies are private by default (see above). Code that
    used the headers of a dependency's dependency without declaring it must now
    declare it, or the dependency must say public = true.

  • cx test runs the ctest next to the cmake cx uses, not the one in
    PATH.

  • CMake 4.4 and newer get -Wno-unused-cli instead of the deprecated
    --no-warn-unused-cli, which made them warn on every configure.

  • The version is written only in cx.toml. The CMake build reads it from
    there and fails if [build] defines passes a different CX_VERSION.
    src/cx/version.hpp is a plain header now, not generated by
    configure_file.

  • The unit tests are built with the same warning flags as the rest of cx.

  • Changing the compiler or toolchain file now starts the build directory's
    CMake cache over. Before, CMake reset it on its own and lost the other
    configure settings.

  • Public include directories in the generated CMake are wrapped in
    $<BUILD_INTERFACE:...>, so exported targets are relocatable.

  • On a terminal, builds show a progress bar instead of the build tool's raw
    output. Diagnostics still appear as they arrive, and warnings are summarized
    per package at the end. Output is unchanged with --verbose, with
    --quiet, when stderr isn't a terminal, or with TERM=dumb.

  • --locked now fails with a clear message when a locked package would come
    from a different source (dependency confusion), instead of only reporting
    that cx.lock needs to change.

  • With several binaries, cx run needs --bin or package.default-run, and
    says so.

  • Registries can be configured in the configuration files as well as with
    CX_REGISTRY / CX_REGISTRY_<NAME>. The environment variables still win.

  • Every compiled library now gets a generated export header. Static libraries
    define <ID>_STATIC_DEFINE.

Fixed

  • Tests, examples and benches of a shared library on Windows find its
    .dll: cx test puts target/<profile>/ first in the tests' PATH, and
    examples and benches get a copy of the DLL in their directory. Before, they
    couldn't start, and Windows waited on an error dialog, so cx test hung. cx now also starts
    programs with Windows' error dialogs off, so a missing DLL or a crash fails
    right away. (Package layout)
  • C++20 modules with a compiler CMake can't scan (AppleClang, or Clang
    without clang-scan-deps) now fail at configure with a message saying
    what to install, instead of with CMake's error or ...-NOTFOUND: not found
    in the middle of the build. (C++20 modules)
  • --message-format json paths on Windows: compiler-message file
    values from MSVC use / like every other path cx reports, instead of
    MSVC's \. (Build output and JSON)
  • cx new no longer takes git's guessed identity as the author. Without
    user.name/user.email (or GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL), git
    makes one up from the login and host name (runner@Mac-1234.local on
    macOS); --author-from auto now leaves authors out and git fails.
    (Getting started)
  • macOS build: process_posix.cpp calls sigemptyset and friends
    unqualified (macOS defines them as macros), and creates pipes without
    pipe2(), which macOS lacks: pipe() plus FD_CLOEXEC, under a lock shared
    with spawning so no child inherits a half-made pipe. The deprecation of
    posix_spawn_file_actions_addchdir_np in macOS 26 no longer warns.
  • MSVC build: headers and sources include every standard header they use
    (version_set.hpp used std::optional without <optional>, which only
    GCC's and Clang's libraries happened to provide).
  • MSVC build: file times go through fs::unix_seconds, because MSVC's
    file_clock has to_utc() but no to_sys() (cx cache and cx clean --gc
    didn't compile on Windows). The to_utc() path is only compiled where the
    library has utc_clock, which libc++ (macOS) doesn't.
  • The Linux Clang CI job builds with clang-20 from Ubuntu's archive.
    With Clang 18, the runner's default, libstdc++ declares no std::expected,
    and nothing compiled. Configuring with such a compiler now stops with an
    error that says which compilers work. Building cx needs Clang 19 or newer
    (Clang 18 only with libc++).