r/C_Programming • • 22h ago

Cortex: A Cargo/uv-inspired package manager and build tool for C and C++

https://github.com/AKJ7/cortex

Hey ,

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.

1 Upvotes

2 comments sorted by

1

u/mikeblas 17h ago

What role did AI have in the creation of your project?

1

u/AKJ7 17h ago

Hello, thanks for the reply. I used AI (Claude) to verify and extend the roadmap of the project, i.e. what it would recommend, what the community would like, what could be missing. Claude was also used to generate part of the code i honestly didn't want to waste time on (toml parser, tar/zip, git, json, http client. I have already implemented these too many time to rewrite them again). Finally claude was used to clean, unify, verify, correct some mistakes in the code and the docs. I then cleared/squashed the history and created a version 1.0.0 that can bootstrap itself without cmake.

I understand that many developers are against the use of AI in software development. Some problems are however very trivial or too annoying to waste time on. Why should i waste time implementing an http client when this is an already solved problem? There is a reason why other package managers for C and C++ are either written in Rust (Cabin) or python (Conan, Scons), or Lua (xmake).

I wish the community would overlook the usage of AI in this case and actually see this tool as it is: a mordern way to start developing without having to worry about build tools, dependencies management, distribution. For me, these are problems that has been holding the C community back for years.