r/C_Programming • • 1d 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.

0 Upvotes

4 comments sorted by

3

u/mikeblas 1d ago

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

-6

u/AKJ7 1d 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.

2

u/LatinateLuddite 3h ago

If you stopped after the first paragraph, you wouldn't sound like a dick, and you'd receive better reaction.

Trying so hard to justify using AI for reasonable things like hooking in what is often a copy/paste job like a config parser makes you sound like you're trying to downplay a much larger reliance on a AI crutch; especially when you're telling the recipient audience they should just embrace something they don't like and fit your vision, so they aren't behind by years.

1

u/AKJ7 2h ago

If you stopped after the first paragraph, you wouldn't sound like a dick, and you'd receive better reaction.

I was neither trying to sound like a dick or not. What i wrote was what i felt and thought.

Trying so hard to justify using AI for reasonable things like hooking in what is often a copy/paste job like a config parser makes you sound like you're trying to downplay a much larger reliance on a AI crutch;

I am trying to downplay the AI complains. Again, this project is very different from every project i have worked on so far. It is quite complicated and requires a lot of effort to accomplish. If it were so easy to do, it would have already been successfully implemented. cabinpkg had the same idea for 9-10 years now, but their registry is still in alpha status.

Yes, AI was used. There were some missing elements, i just couldn't believe didn't exist that i deferred to Claude. Yes, AI helped with the architectural design. All Claude, Gemini and ChatGPT helped. I tried to get as much advice as i could find to produce something good for the community.

I made the mistake of squashing the work before the first release. But this was because i wanted the cortex to exist once it is able to bootstrap itself. Basically the package manager is valid once it packages itself. Now that this base version is done, the work since then (except for cross-platforming) has been manual.

especially when you're telling the recipient audience they should just embrace something they don't like and fit your vision, so they aren't behind by years.

I wouldn't call it my vision. I wrote with AI assistance a tool that mirrors uv and Cargo's architectures, as we all know they are great tools. This post sets the basis of what the tool is supposed to do and get some feedback from the community.

Please understand, this is not a "i built a minimalistic 3d renderer in C" side project. It is a complete cross-platform, cross-architecture, cross system, cross-compiler package manager; and the only way i could achieve the base state in an affordable amount of time was with AI's help. This was the only way, else it would be written in rust, python or Lua like the others who have tried did it.

Example: Check this out. This c++ toml parser https://github.com/marzer/tomlplusplus/tree/master got Claude support. Should it be discarded for this? The toml parser in cortex was written by Claude too, because i didn't like tomlc++ error handling.

Is there anything you want clarification on?