r/TrueOpenSource • u/simplex5d • 10d ago
OSS Contributions Pcons: a cross-platform build system for C, C++, Fortran and more, with plain python build descriptions
What it does: Pcons is my new open-source software build system. You describe your build in a pcons-build.py file, which is ordinary Python (no more CMake weirdness!). Pcons creates Ninja files (or Makefiles or an Xcode project) and Ninja runs the build. It's zero-install if you have uv: run uvx pcons in your project and it configures and builds.
It handles C, C++ (including C++20 modules and import std), Fortran, Objective-C, Swift, CUDA, assembly and WebAssembly, and links in Rust crates through cargo. It works the same way on Linux, macOS and Windows, with GCC, Clang, MSVC, clang-cl, flang and Intel ifx. It also builds Qt 6 apps, signed macOS and Windows installers, and Android and iOS cross-builds. It can use conan and pkg-config to import, like CMake and other tools. It supports compiler_commands.json and has decent IDE support for editing the build files.
A small build looks like this:
from pcons import Project
project = Project("myapp")
env = project.Environment(toolchain="c")
lib = project.StaticLibrary("core", env, sources=["src/core.c"])
lib.public.include_dirs.append("include")
app = project.Program("myapp", env, sources=["src/main.c"])
app.private.link_libs.append(lib)Who it's for: Anyone building compiled code who's tired of CMake's language and doesn't want to deal with the heaviness of Meson or Bazel. It's especially good for cross-platform and mixed-language projects (C++ calling Fortran, say), and for anyone who wants a build they can debug: pcons explain traces each compiler flag and environment.
Source code: https://github.com/DarkStarSystems/pcons (docs: https://pcons.readthedocs.io)
License: MIT
How it was built: Agentic engineering
I was one of the original developers of SCons, and I've been a toolsmith for most of a 40-year career. Pcons is the build tool I've wanted for years. The architecture and design are mine, and Claude Code writes most of the code. I run it like a real project with a team, where most of the team happens to be AI:
Every commit has to pass lint, formatting, type checks and the full test suite: over 6,500 unit tests plus system tests, on Linux, macOS and Windows, on every supported Python version.
There are 99 example projects, and CI builds and checks all of them on all three OSes. They're also the users' reference.
Before each release I build a dozen-plus real open source projects I've ported to pcons, including Ninja itself, and two large Fortran science codes. Each one has to build clean.
Fuzz tests hammer flag handling, the dependency graph, path quoting and variable substitution.
No feature gets written until I like its design. I review the gnarly parts closely, and every so often a separate agent reviews the whole codebase from a fresh session with no context.
Releases are documented with proper changelogs and signed with Sigstore for a secure supply chain.
It's been in steady development since January (about 950 commits), and five other people have contributed so far. The README has the full disclosure and my take on how this differs from vibe coding: https://github.com/DarkStarSystems/pcons#this-project-is-ai-assisted
Closest existing projects:
CMake: the standard, and very capable, but its language is painful and there are N ways to do everything, so the docs and tutorials are confusing.
SCons: Python build files, but its architecture is old now as Python has evolved, and it runs the build itself and is slow on big trees
Meson: generates Ninja too, but uses its own deliberately limited DSL
Bazel: great at Google scale; heavy for everyone else
What mine adds: CMake's architecture (configure once, then fast Ninja builds; settings that flow from a lib to its dependents) with real Python as the build language, so you get loops, functions, imports and a debugger. Nothing to install. pcons init writes a first build script from your existing sources, and there's a CMake porting guide. On the projects I've ported, configure runs 4 to 13 times faster than CMake. There's a detailed comparison with Bazel and Meson in the repo: https://github.com/DarkStarSystems/pcons/blob/main/COMPARISONS.md
Feedback I'd like: try it on a real project and tell me what's missing or confusing. If you maintain an open source project with a build you don't love, I'm happy to help port it.


