
I built a zero-dependency, self-hosting C/C++ build system configured entirely in C (Loom)
Hey r/cprogramming!
I've been working on a project called Loom, and I'd love to share it and get some feedback from the community. Basically it's a cross-platform C/C++ build system that is fully self-hosting, requires zero external dependencies, and uses pure C11 for its build configurations (build.c).
I built this because I was frustrated with CMake's bizarre syntax and having to learn complex new Domain Specific Languages (DSLs) or wrestling with Makefiles just to compile my C projects. I figured: if I'm writing C code, why not configure the build pipeline dynamically using a clean C API?
Here's the repository link, feel free to contribute, I'll be looking for more ways to improve the project.
Key Features
- "Configuration as code" (inspired by build.zig): You define your build targets using a clean, readable API in a
build.cfile. You get all the benefits of C (macros, variables, logic) with none of the typical CMake friction. - Zero-dependency and self-hosting: Written in strictly standard C11. Loom is capable of fully compiling and rebuilding itself perfectly.
- Truly cross-platform (native windows): It runs natively on macOS, Linux, FreeBSD, and Windows. I recently finished a complete Windows port where it leverages raw Win32 APIs (like CreateProcessA, FindFirstFileA) instead of relying on slow POSIX emulation layers like Cygwin or MSYS2.
- Fast and incremental: Features intelligent dependency tracking (parsing depfiles and using file hashes) so it only recompiles what actually changed. It also auto-detects your logical CPU cores and compiles asynchronously in parallel.
- Batteries included:
- Build Executables, Static Libraries (
.a/.lib), and Shared Libraries (.so/.dll). - Built-in wildcard/recursive globbing (
add_glob) to just throw a directory of sources at it. - Direct
pkg-configintegration (link_system_library). - Instant project scaffolding (
loom init).
- Build Executables, Static Libraries (
Example build.c
Here is what it looks like to configure a modern C project:
#include <loom.h>
void build(loom_build_t *b) {
loom_target_t *exe = add_executable(b, "my_awesome_app");
add_glob(exe, "src/*.c");
add_include_dir(exe, "include");
set_standard(exe, LOOM_C11);
set_optimization(exe, LOOM_OPT_RELEASE_FAST);
link_system_library(exe, "raylib");
}
Building this project from scratch has taught me an incredible amount about platform-specific process abstractions, caching logic, and avoiding standard POSIX traps on Windows.
I would love to hear your thoughts, feedback, or any critique on the codebase architecture! Let me know what you think.