caxe (cx) 🪓
caxe (pronounced "c-axe") is a modern project manager for C and C++ designed to cut through the complexity of legacy build systems.
It provides a unified workflow for scaffolding, building, testing, formatting, and managing dependencies—giving C/C++ developers the modern experience they deserve.
Zero Configuration. Lightning Fast. Batteries Included.
✨ Features
- ⚡ Zero Config Start: Create a Hello World C/C++ project in seconds.
- 📦 Smart Dependency Management:
- Git Libraries: Auto-download from GitHub. Supports Pinning (Tag/Branch/Commit) for stability.
- System Packages: Native support for
pkg-config(e.g., GTK, OpenSSL). - Header-Only Support: Automatically detects libraries that don't need linking (e.g., nlohmann/json).
- 🎨 Code Formatting: Built-in
cx fmtcommand (viaclang-format). - 🚀 Parallel & Incremental Builds: Lock-free parallel compilation engine for maximum speed.
- 💾 Global Caching: Libraries are downloaded once and shared across all projects. Use
cx updateto refresh them. - 👁️ Watch Mode: Automatically recompiles and runs your project when you save a file.
- 🛠️ Flexible Configuration: Custom binary names, environment variable support (
CC,CXX), and build scripts.
📦 Installation
Automatic Script (Recommended)
Windows (PowerShell):
iwr https://raw.githubusercontent.com/dhimasardinata/caxe/main/install.ps1 -useb | iex
Unix (Linux/macOS):
|
Option 2: Install via Cargo
Option 3: Manual Download
Download the latest binary from Releases and add it to your PATH.
🚀 Quick Start
Interactive Mode
Simply run cx new without arguments to start the wizard.
# ? What is your project name? › my-app
# ? Select a template: › console
# ? Select language: › cpp
CLI Arguments Mode
# Default (Hello World)
# Web Server (cpp-httplib)
# Raylib Game Config
📖 CLI Reference
cx new <name>
Creates a new project.
--lang <c|cpp>: Set language.--template <console|web|raylib>: Choose template.
cx run
Compiles and runs the project.
--release: Enable optimizations (-O3).-- <args>: Pass arguments to your executable.
cx build
Compiles the project without running it.
cx add <lib>
Adds a Git dependency to cx.toml. Supports version pinning.
- Alias (New!):
cx add raylib(No URL needed!) - Standard:
cx add nlohmann/json - Tag:
cx add nlohmann/json --tag v3.11.2 - Branch:
cx add raysan5/raylib --branch master - Commit:
cx add fmtlib/fmt --rev a3b1c2d
cx remove <lib>
Removes a dependency from cx.toml.
cx update
Updates all dependencies in your cache to the latest version (unless pinned).
cx fmt
Formats all source code in src/. Requires clang-format.
cx clean
Removes the build/ directory and metadata files.
cx watch
Watches for file changes and auto-runs.
cx test
Compiles and runs files in tests/ directory.
cx info
Displays diagnostic information (OS, Cache Path, Compilers).
⚙️ Configuration (cx.toml)
Comprehensive configuration example:
[]
= "my-awesome-app"
= "0.1.0"
= "c++20"
[]
= "app" # Output: app.exe
= ["-O2", "-Wall", "-Wextra"]
= ["pthread", "m"]
[]
# 1. Simple Git (HEAD)
= "https://github.com/fmtlib/fmt.git"
# 2. Pinned Version (Recommended for production)
= { = "https://github.com/nlohmann/json.git", = "v3.11.2" }
# Pin to specific commit hash
= { = "...", = "a1b2c3d4" }
# 3. System Dependency (pkg-config)
= { = "gtk4" }
# 4. Complex Build (Library with source code)
# 'output' field tells caxe to link this file.
# If 'output' is missing, caxe treats it as Header-Only.
= { = "...", = "make", = "src/libraylib.a" }
[]
= "echo Compiling..."
= "echo Done!"
🛠️ Advanced
Header-Only Libraries
caxe is smart. If you add a library like nlohmann/json or fmt and do not specify an output file in cx.toml, caxe assumes it is a Header-Only library. It will add the include paths (-I) but will not attempt to link any static library.
Environment Variables
Override the compiler without changing config:
# Windows (PowerShell)
$env:CXX="g++";
Unit Testing
Create a tests/ directory and add .cpp files.
📝 License
MIT