cx::pm docs

Describe your C++ project in C++.

cxpm builds, tests, packs, installs and shares C and C++ projects. You describe a project in a package.cpp; cxpm fetches and builds what it depends on, and hands the result to the package manager of the system it is installed on.

#include <cx/pm/project.hpp>
#include <cx/pm/target.hpp>

using namespace cx::pm;

auto package = cx::pm::target()
                  .name_set("greeter")
                  .version_set("0.1.0")
                  .type_set("static-library")
                  .sources_append({"src/*.cpp"})
                  .include_directories_append({"include"})
                  .options_append({compiler_options::standard_cxx23,
                                   compiler_options::warnings_all})
                  .dependencies_append({"fmt >= 10"})
                  .create();

auto project = cx::pm::project().target_set(package).tests_append("tests").create();
cxpm build      # fetch and configure what is needed, then compile
cxpm test       # build and run the tests projects
cxpm pack       # a package for pacman, rpm, dpkg, or a plain archive
cxpm install    # install that package

One project, one target

A project builds one thing: an executable, a library, headers or data. Tests, examples and tools are projects of their own that depend on it, so nothing is special-cased.

A lifecycle, not a script

fetch, configure, build, pack, install. Each stage runs the ones before it when they are out of date, and only then.

A sysroot per project

Dependencies built from source are installed into .cxpm/sysroot, not into your system. A toolchain can point at another sysroot to build for another distribution.

Native packages

cxpm pack writes a pacman, rpm or deb package and cxpm install gives it to that package manager, so the system knows what cxpm installed.

Confined manifests and builds

A package.cpp is code. It is compiled, loaded and run in a process that sees the project and nothing else, with no network.

Start here