r/C_Programming • u/AKJ7 • 1d ago
Cortex: A Cargo/uv-inspired package manager and build tool for C and C++
https://github.com/AKJ7/cortexHey ,
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
```bash
cx new hello
cd hello
cx add nlohmann_json --git https://github.com/nlohmann/json --tag v3.12.0
cx run
```
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 (find_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.
• Cargo-style features & workspaces: Supports optional dependencies, feature flags, 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.
• 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
• Github
• Docs
You can install prebuilt binaries via the install script in the README or build it from source.
I’d really appreciate any feedback, bug reports, or thoughts on what would make this genuinely useful for your C/C++ workflows!
Thanks and please leave a star.
3
u/mikeblas 1d ago
What role did AI have in the creation of your project?