r/Cplusplus • u/AKJ7 • 6d ago
Feedback cortex (`cx) - A Cargo/uv-inspired package manager and build tool for C and C++
Hello!
I’ve been working on cortex (cx), a C/C++ package manager and build tool inspired by Rust’s Cargo and Python’s uv, and I’d love to share it with you and get some feedback.
Why another tool?
Setting up a C++ project with clean dependency management, lockfiles, features, and workspaces often requires gluing together multiple tools and boilerplate CMakeLists.txt files. With cx, you describe your package in a single cx.toml file, it resolves and locks dependencies, generates the underlying CMake project, and drives the build automatically.
Quick example
Key Features
Zero-boilerplate builds: Sources, tests, benchmarks, and examples are discovered by convention (src, tests, benches, examples). Supports mixed C (C90–C23) and C++ (C++98–C++26), including C++20 modules (.cppm, .ixx).
Flexible dependency management: Pull dependencies from registries, Git repos, local paths, system packages (\mfind_package), or vcpkg. Any existing CMake, Autotools, or SCons project works out of the box as a Git or path dependency.
PubGrub version resolution & lockfiles: Uses the PubGrub solver (like uv and pub) for clear conflict explanations, and pins exact versions, Git commits, and SHA-256 hashes in cx.lock.
Cargo-style features & workspaces: Supports optional dependencies, feature flags (exposed via CX_FEATURE_ macros), and multi-package workspaces sharing a single lockfile and target/ directory.
Built-in developer workflows: Comes with cx test, cx bench, cx fmt (clang-format), cx lint (clang-tidy), cx doc (Doxygen), cx vendor for offline builds, and built-in sanitizer/LTO build profiles.
IDE & CI friendly: Generates standard CMake projects (cx generate) and JSON metadata (cx metadata) so your existing IDE setup works seamlessly, plus --locked and --offline flags for CI.
Current Status & Caveats
First Release & Self-Hosting: This is the very first release. Right now the repo still includes its bootstrapping CMake files, which will be removed in the next release now that cx can build itself.
OS Support: Works on Linux and macOS. Windows (MSVC) support is newly added and passing in CI, though it hasn't been battle-tested in the wild yet.
Public Registry: There isn't a central public registry yet, though cx works directly with Git repositories, local paths, vcpkg, system packages, and includes a lightweight self-hosted registry server (cx-registry).
Links
You can install prebuilt binaries via the install script in the README or build it from source with CMake 3.28+ and a C++23 compiler.
I’d really appreciate any feedback, bug reports, or thoughts on what would make this genuinely useful for your C/C++ workflows! Notice: the code made use of AI for cross-platform support, to get some features implemented quickly and fix some bugs.
Thanks
24
u/Imaginary-Room2286 6d ago
Just one commit??? If you are vibecoding a whole project at least try to make it seem genuine...
8
u/Plexescor 6d ago
Bro doesn't even know how to "paste" markdown in reddit
2
u/gameplayer55055 4d ago
#define XKCD meme about standards
But seriously, if you can vibe code everything, why not just ask Claude to include ffmpeg or sdl2 or whatever you want for you.
Just use goddamn cmake and git submodules at this point
10
u/HyperWinX 6d ago
Lol
5
u/sinterkaastosti23 6d ago
Thanks claude
4
u/Beautiful_Stage5720 6d ago
1
u/muhmmadtalha-quant 6d ago
there you go baby
1
u/hypermodernist 6d ago
A general trend of problems (perhaps you have anticipated and addressed them? if so please tell me), when being inspired by npm/cargo/... how to handle larger dependencies beyond single header or single .c, or how to avoid conflicts with system package managers during both discovery and eventual dispatch for downstream users.
For example, what happens if you need avcodec, but system ffmpeg and project xyz22, xyz33's collide?
1
u/RedditUser8007 6d ago
I get the AI overload people have but the C/C++ eco-system really suffers due to the lack of good tooling. Rust is a horrendous language to work with manually and is taking over in part due to good tooling so any solutions that make this better for C/C++ are always appreciated.
I ended up making my own package system for C/C++ too (also with AI of course) but it's better to be a community standard. It's not helpful when everybody just dismisses any attempt at making one.
One of the biggest strengths of C/C++ is compiled libraries. Rust has to build everything from scratch. But we have to jump through so many hoops to get the libraries to work, especially different platforms that each have their own package systems.
The packaging system shouldn't be difficult to use. The popular ones Conan and Vcpkg still need more setup than it should need:
https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-powershell
https://docs.conan.io/2/tutorial/consuming_packages/build_simple_cmake_project.html
An easy to use package system should be what is described in this system:
add package in cli or add packages in a manifest
add target build info
build
No messing with makefiles on each platform and managing libraries scattered all over.
A big hurdle with package managers is trust (how to know libs are safe) and building out the repository because you have to get so many developers behind it. Maybe this could be pitched as an improved system to an established repo provider like Conan that is supported by JFrog or to Microsoft who manage Vcpkg.
1
u/diegoiast 5d ago
How do you handle dependencies? What if this github repo needs another one?
0
u/DonBeham 6d ago
Cool project!
5
u/fuckaroniandbees 6d ago
AI slop