I created a little side project over the past few days, a new build system for C and C++: https://github.com/blueOkiris/acbs/
I’ve seen a lot of discourse over C build tools. None of them really seem solid except for (some) Makefiles (some Makefiles are atrocious; you just can’t rely on people these days). Bazel, cmake - they’re just not straight forward like a clean Makefile is, basically black magic, but setting up a Makefile from scratch is a skill. Many copy the same one over each time. Wouldn’t it be nice if that Makefile didn’t even need to be copied over?
Building C should be straight forward. Grab the C files and headers I want, set some flags, include some libraries, build, link. Instead project build systems are way way way overcomplicated! Like have you ever tried building any of Google’s C projects? Nearly impossible to figure out and integrate with projects.
So I’ve designed a simplistic build system for C (also C++) that is basically set up to work like a normal Makefile with gcc but where you don’t have to set it up each time. The only thing you are required to provide is the name of the binary (although you can override defaults for your project, and yes, not just binaries are possible but libs as well). It also includes things like delta building without needing to configure.
Now there is one thing I haven’t added yet - parallel building. It should be as simple as adding separate threads when building files (right now it’s a for loop). I know that’s something a lot of people will care about, but it’s not there yet. It’s also really intended to only work with Linux rn, but it could probably pretty easily be adjusted to work with Windows.
Lay your project out like the minimal example, adjust the project layout, and get building! The project itself is actually bootstrapped and built using whatever the latest release is, so it’s its own example haha.
It’s dead simple and obvious to the point I would claim that if your project can’t work with this, your project is wrong and grossly over-complicated in its design, and you should rework the build system. C is simple, and so should the build system you use with it!
So yeah. Check it out when y’all get a chance
sigh
All build tools are simple as long as nobody uses it. Even CMake was simple before KDE and Co. started to rely on it.
A build tool can be simple, if you use conventions over configuration. Unfortunately that ship has sailed for the C and C++ eco system decades ago… Every project is widely different from every other project out there. Heck, we can not even agree on file extensions for c++ files, let alone a directory structure for project source code to live in or the tooling we want to be available.
So you need to have every little detail configurable… and since all projects are so very different, users will need to tweak all those settings… as the first bigger project adopting abcs will dictate their defaults into your code (where you have not gone with your defaults before).
Seriously, you need a language leadership team that considers tooling as important from the very start or you will not have a simple build tool ever. See rust: There the leaders pushed for tooling from the start. Every rust project looks basically the same because of that. These strong conventions enable the language to have a simple build tool.
C++ is on thenfar side of that. Even in 2020 when introducing modules the committee choose not to mandate even the most basic interoperability features like file extensions. The cmake people had to get several compiler developers to add things to make modules toolable. And even with that effort the meson people seem to say c++ modules are entirely untoolable still.
Update: I went ahead and implemented the multithreading
That’s a lovely project! Just came here to say that while many of the C and C++ build systems seem to be overcomplicated to use sometimes, I must say that I had a pretty good time with meson. It lets you have a very simple build file while also being extensible for more complex projects. Perhaps it could give you some inspiration!
At first glance it looks interesting. Gonna check it out in more detail soon:tm:.
Can it also use .h files in a cpp project?
Not currently, but that was an explicit choice, so it’s easy to change
Maybe I should add a flag to allow searching for h files when building C++
I would rather add a config field which allows you to set a list of file extensions to search for.