Skip to content

Compile C/C++ with nothing but pip

No MinGW. No Visual Studio. No Xcode. CLAP bootstraps a pinned, hash-verified private toolchain and builds your code on a completely clean machine.

$ pip install clap-compiler
$ clap init hello && cd hello
$ clap run
# → Hello from CLAP

Русская версия →

Zero setup means zero setup

No compiler installed, empty cache, fresh machine. One command downloads the pinned, SHA-256-verified toolchain into the user cache — no admin rights, no Visual Studio, no MinGW hunting — then builds and runs. Every machine, every time, the same compiler.

Watch mode: save and it reloads

Edit your source and CLAP notices, rebuilds incrementally, and restarts the program — no manual loop, no stale binaries.

$ clap run main.c --watch
Watching for changes (1 files)...
v1
Change detected; restarting...
v2 - reloaded

Add a library in one word

Adopting existing code? clap init --adopt writes only clap.toml around your sources — nothing is scaffolded over them. Then one word adds a library: seventy-two curated pins ship in the CLI itself — from doctest, sqlite and miniaudio to cglm and cgltf (bare clap add lists them all), every download re-verified against the pin before anything is written. No URL hunting, no hash copying, no flags.

$ clap init --adopt .
$ clap add cjson
$ clap run
{"answer":42}

The dependency model →

When the first build fails

The moment that decides whether a beginner keeps going: progress lines say what is happening in words, not shell noise — and the compiler error owns the screen, with the caret, the line, and the fix hint. Fix it, re-run, move on. No log archaeology.

$ clap build main.c
[1/2] compiling main.c
main.c:3:26: error: expected ';' after expression
    printf("hello world")
                          ^
                          ;

Your editor already knows how

The VS Code extension puts the whole workflow where your hands are: project scaffolding from the Command Palette, doctest cases discovered into the native Test Explorer — click the arrow, watch them go green. Tasks, diagnostics, IntelliSense and F5 debugging included; the extension drives the same clap binary, no parallel implementation.

# inside the editor
CLAP: New Project from Template
CLAP: Watch Run
test_math — 3 passed, 0 failed

VS Code Marketplace →  ·  other editors: clangd, neovim, CLion →

Everything else, also proven on camera

Every feature below is a real recording of a real run, not a mockup — they lazy-load as you scroll.

clap add quickjs vendors a full JavaScript engine — ES2023 in five translation units. Six sources build with zero flags and the embedded runtime evaluates the answer: 42.

A web server in one dependency

clap add mongoose vendors the embedded HTTP library hash-pinned — and on Windows the pin links ws2_32 by itself through the dependency links key. Sixteen lines of C later, curl gets an answer from a server that needed zero setup, zero flags, zero package managers.

C++ server and client in one binary

clap add cpp-httplib vendors the most-used C++ HTTP library — one header, hash-pinned, ws2_32 linked by the pin on Windows. Twenty lines of modern C++ later the same process serves a request and reads it back as a client: the round-trip answers cpp-answer=42 with zero setup, zero flags.

Discover the registry without leaving the terminal

clap search json answers "which JSON library" — seventy-two curated pins filterable by name, description, or category, platform exclusions annotated honestly. Then one word adds what you found: hash-verified, vendored, canonical include printed. The parse answers search-found=42.

Test frameworks never reach production

clap add doctest --dev pins into [dev-dependencies] — grep proves it straight from clap.toml. The scaffolded test runs green, and clap deps annotates the scope as [dev] without any JSON. Production builds cannot even see the header: the dependency is invisible outside test builds by construction.

An archiver in sixteen lines

clap add zip vendors the zip library hash-pinned — the pin even carries the upstream configuration switch strict toolchains need. Sixteen lines of C later a real archive is written, read back, and byte-verified. Compression utilities without a build system.

Any GitHub repo, one command

clap add owner/repo resolves the repository’s HEAD through git itself and pins exactly that commit — reproducible forever. It prints the canonical include, and when the library ships compilable sources it tells you the exact line to write into the pin. Then it just builds.

Even assembly in the tree

zstd ships hand-written x86-64 asm for its hot path — adoption discovers the .S file, compiles it like any other unit, derives the includes. One honest exclude line for the optional zlib shim, and the real Zstandard CLI compresses 898 KiB into 193 KiB, byte-identical on the roundtrip.

Real trees adopt themselves

lz4’s canonical lib/programs shape: adoption recurses, skips the bench/tests, derives includes = ["lib"] from the headers on its own. Zero edits — the binary compresses 346 KB to 123 KB and roundtrips byte-identical.

SQLite in seven seconds

The most deployed database in the world — 265,908 lines of amalgamated C — adopts itself with zero flags and builds in seconds. The shell answers real SQL.

A real codebase, adopted in seconds

Point clap init --adopt at a third-party C project and it just builds — this is Lua 5.4.7: 33 sources, zero flags, correct interpreter binary, no makefile surgery.

TDD out of the box

clap init --template greatest scaffolds real C unit tests — and bare clap test runs them red or green. Tests link your project sources, so they exercise real code, not toys.

Dependencies that stay fresh

clap update diffs your pins against the registry and re-pins what drifted — verify-before-write, forks left untouched. The dependency lifecycle is closed: add, sync, remove, update.

Release engineering in one command

clap dist cross-compiles the release matrix and packs per-platform archives with SHA-256 checksums — Windows zip, Linux tarballs, done.

Real test assertions, zero hunting

Include <doctest/doctest.h> and it just compiles — the pinned, hash-verified single header bootstraps itself into the cache on first use.

Your editor, already set up

The VS Code extension builds and runs with one click, streams output into the integrated terminal, surfaces real compiler diagnostics in Problems, and discovers tests in the native Test Explorer — no…

Coverage that CI understands

One flag produces a Cobertura coverage.xml for CI ingestion, a self-contained HTML summary, and machine-checkable thresholds — real compiler instrumentation, not an approximation.

Undefined behaviour, caught

A release build prints garbage and moves on. The same binary built with --sanitize undefined aborts on the exact line — and even plain debug builds trap UB out of the box, because the pinned…

One host, every target

Cross-compilation profiles turn any machine into a build box for the others — verified end to end on real PE, ELF, and Mach-O artifacts. clap targets lists every preset.

Static Linux binaries, one command

The musl profiles produce executables with zero runtime dependencies — no glibc version roulette, no container base-image gymnastics. Build on any host, copy the single file, run it on any Linux of…

C to WebAssembly, same one command

--target accepts any zig triple — including wasm32-wasi. The pinned toolchain already carries everything needed: one command turns C into a real wasm module that runs in Node.js, wasmtime, or the…

Your CMake project, zero host tooling

Already have a CMake project? Keep it — CLAP drives it with the real CMake/Ninja backend, except the cmake, ninja and compiler are all pinned and provisioned by CLAP itself. A machine with no Visual…

Cross-compile becomes cross-run

On a Linux host with qemu-user, foreign-architecture binaries don’t just build — they execute. The clip below is an x86_64 machine running a freshly built aarch64 static binary through plain…

Every target, one command

Repeat --profile and CLAP matrix-builds each target in a single invocation — release engineering for a multi-platform binary without a CI matrix just to produce artifacts.

It compiles real software

No porting, no build-system files: the SQLite amalgamation — about 260,000 lines in one translation unit — builds in eighteen seconds on a modest VM and answers SQL. Lua 5.4 builds in four. Same…

Dependencies, declared once

Pin a library in clap.toml and clap sync reproduces it anywhere — SHA-256-verified before a single byte is written. Builds add the include root automatically: no flags, no package manager, no drift.

…or vendored imperatively

One-off dependency? clap vendor downloads a pinned, SHA-256-verified copy of a single header or a whole release archive — extraction is safe against path traversal, --list inventories what you have,…

Compiled libraries, zero configuration

Some libraries are meant to be compiled, not just included — cJSON, SQLite, miniz. Declare their source files once and they build as part of your project: the pin is content-verified, the include…

CI in one flag

clap init --ci scaffolds the project together with a cross-platform GitHub Actions workflow built on the setup-clap composite action — pinned versions, toolchain caching, no YAML archaeology on day…

Windows is a first-class citizen

Most "works everywhere" claims quietly mean "works everywhere except Windows, where you need Visual Studio first." CLAP needs nothing installed beyond Python — the same pinned Zig toolchain drives…

Built for humans and agents

Every command speaks JSON

CI pipelines and AI coding agents get the same stable interface: --json on build, run, test, inspect, doctor, deps and coverage — structured diagnostics with file, line and column instead of scraped console text. The site serves a machine-readable summary at llms.txt so agents can check capabilities before writing a single command.

$ clap build main.c --json
{
  "success": true,
  "output": "/home/demo/main",
  "diagnostics": [],
  "toolchain": {
    "name": "zig",
    "version": "0.17.1",
    "source": "private"
  },
  "timing": {"compile": 0.09, "total": 0.10}
}
$ clap doctor --json   # versions, paths,
                       # cache state — all structured

Honest positioning

CLAP is not a build system replacement and not a new language — it is a thin, predictable frontend over real compilers:

CLAPraw CMakeMeson / xmake
Windows compiler setuppinned Zig downloaded and checksum-verified automaticallyinstall MSVC/MinGW yourselfinstall a compiler yourself
Build languagenone — compile files directly or drive existing CMake projectsCMake languagetheir own DSLs
First hello buildclap init hello && clap runwrite CMakeLists, configure, buildwrite build file, setup, compile
Reproducible toolchainpinned version plus SHA-256 verification in the user cachesystem-dependentsystem-dependent
IDE integrationVS Code extension, tasks, diagnostics, compile_commands.jsonCMake tools extensionvaries

If you already have a working CMake or Meson setup, keep it — CLAP drives CMake projects rather than replacing them.

Install

ChannelCommandStatus
One-liner installerirm https://bratan-corp.github.io/clap/install.ps1 | iex (Windows) · curl -fsSL https://bratan-corp.github.io/clap/install.sh | sh (Linux/macOS)rustup-style — Windows brings its own Python, validated end-to-end in a sterile container
PyPIpip install clap-compilerpublished, validated on Windows/macOS/Linux
uv / pipxuv tool install clap-compilersame PyPI artifact, validated end to end
Scoopscoop bucket add clap https://github.com/BRATAN-CORP/scoop-clappublished, validated end to end
Portable zipclap-portable.zip from releasesfully self-contained — no Python needed, validated on stripped-PATH Windows
VS CodeCLAP Compiler extensionpublished on the Marketplace
Snap / winget / Chocolateyartifacts built and validated — store submission in progress

Documentation

Tutorial

Your first ten minutes: zero to a tested project — every command verified before it was written.

Command reference

Every command, flag, template, profile, and dependency feature in one page.

README

The sixty-second introduction. На русском.

Configuration

Every clap.toml key in one reference — unknown keys fail fast instead of being silently ignored.

Cross-compilation

Every target from one install — verified artifact shapes, static musl binaries, honest caveats.

Library recipes

Copy-paste vendoring recipes for nlohmann/json, stb, cJSON and more — every one executed before documenting.

Troubleshooting

Real problems with real fixes — every entry reproduced before documenting.

IDE integration

Real clangd IntelliSense from your actual build flags — VS Code, neovim, CLion. No custom language server, just the standard compilation database.

Coverage

HTML/JSON/Cobertura reports and CI threshold gates.

Performance

Measured cold/no-op/incremental/parallel benchmark evidence.

Platform validation

Native Windows/macOS/Linux evidence, not assumptions.

Roadmap

Where the project is heading, with completed milestones visible.

Measured, not promised

Numbers from an ordinary Linux VM. Every one reproducible with the commands on this page.

0.22s — hello world

Cold compile+link of a fresh clap init scaffold, toolchain already cached. A no-change check costs 0.11s; object-cache rebuild 0.14s.

~40s — one-time bootstrap

First run on a clean machine: the pinned toolchain downloads, hash-verifies, extracts once. Everything after is offline-capable — watch it in the cold-start video above.

18s — SQLite, 4.1s — Lua

Real amalgamated C: sqlite3.c is ~250k lines in 18s cold; the whole Lua interpreter 4.1s. Dependency objects cache like everything else.

The honest overhead: ~120ms

CLAP is Python, so a trivial build pays ~120ms of fixed startup over invoking the compiler directly (60ms raw vs 180ms warm for a toy file). On anything real it is noise — 0.7% of the SQLite build. We measured it because you would.

Same speed, any target

Cross-compiling is codegen, not emulation — building for windows-x86_64 or aarch64-linux-musl costs the same as native. Foreign binaries only cost extra when you run them under qemu.

Honest answers

Is CLAP a compiler?

No — CLAP is a compiler frontend. It downloads, verifies, and drives a private zig toolchain (zig cc/c++ — clang underneath) so you never install or configure anything. The compiler is real clang; the zero-setup part is CLAP.

What does "zero setup" literally mean?

A machine with nothing but Python: pip install clap-compiler, write hello.c, clap run hello.c. On first use CLAP downloads the pinned toolchain into its own cache, hash-verified. No Visual Studio, no MinGW, no Xcode command line tools prompt, no PATH editing. The cold-start recording on this page is exactly that, cache provably absent.

Does it work offline?

After the first toolchain download, yes — builds, tests, watch mode, cross-compilation all run offline. Downloading dependencies obviously needs the network once; afterwards the vendored tree is local and pinned.

Is this a package manager?

No, and it does not pretend to be one. Libraries shipped as source archives (single-header libraries, amalgamations, cJSON-style small libs) vendor with hash pins and zero configuration. Libraries with real build systems of their own — curl, openssl — integrate through the honest path: pkg-config with clap lock/clap deps, or their own CMake build. The boundary is documented, not papered over.

Why not just use CMake + a system compiler?

Because "install a system compiler" is exactly the step that eats the afternoon — on Windows especially. CLAP's bet: the toolchain should be a detail, not a quest. If you already have a working setup, CLAP still gives you one-command cross-compilation, hash-pinned dependencies, and the same build on every machine including CI.

What about my existing CMake project?

clap cmake . drives it with the private toolchain — no host cmake or ninja installation needed. Verified on real projects; see the recording above.

How fast is it?

Full evidence in the benchmark page: no-op rebuilds in tens of milliseconds thanks to the ninja backend, parallel compilation, and an object cache with integrity self-healing. Numbers are measured, not estimated.

What is wrong with just gcc main.c -o hello?

Nothing — if gcc is already on your machine, one file is genuinely that simple, and CLAP is not needed for it. Two honest buts. First: a fresh machine has no gcc — on Windows there never was one, and the usual answers (MSVC installer, MinGW mirrors, MSYS2) are afternoons, not minutes. Second: one file is where the real questions start, not where they end — the second file, the first test, the first library, the static binary for a server. CLAP exists for everything after gcc main.c stops being the whole story, and for the first hour before gcc exists at all.

I refuse to install Python for a C tool.

Understandable — use the portable zip from releases: self-contained, Python included, nothing to install system-wide, delete the folder to uninstall. Python is CLAP's delivery vehicle and glue, not a dependency you have to care about; the compiler itself is real clang and never touches Python at runtime.

Isn't clap already the Rust argument parser?

Yes — the Rust crate came first and the collision is real. Here it is CLAP as in "C Like A Python", and the PyPI package and binary are clap-compiler/clap in a different ecosystem's namespace. If the project ever outgrows the joke, renaming is on the table — tracked in issue #414.

Does it phone home or need accounts?

No accounts, no telemetry, no activation. The only network traffic is the toolchain and library downloads you ask for, each pinned and hash-verified. --offline disables even that.

Is the toolchain safe?

Every download is pinned to an exact version and verified against a SHA-256 that lives in the source tree. Object-cache entries are integrity-checked too — corruption self-heals by recompiling instead of failing opaquely.

Who verifies all these claims?

Every feature ships with its verification: real recordings on this page (inspect the final frames), native Windows/macOS/Linux validation in platform validation, and a test suite that runs in CI on all three operating systems. Where something doesn't work — cross-running a Windows binary on Linux, for example — the docs say so plainly.