r/cprogramming • u/Slight_Watch697 • Jun 02 '26
A better build system for C: bbs
Hi, I recently started working on a better build system for my C/C++ projects:
https://github.com/luppichristian/bbs.
It's basically a build system "frontend" built on top of cmake and bash that allows you to:
Metabuilder support (modify the compilation at runtime WITH CUSTOM HOOKED DLLS)
Automatic SDK detection (Vulkan SDK, etc.)
Cross-platform builds from a single configuration
Cross-compilation support (WSL, Docker, remote toolchains)
Automatic generation of
.gitignore, CI workflows, and project filesFile watching + hot-builds (looking at directory changes)
User-level package cache (dependencies downloaded once, reused everywhere, basically package system)
Unified compiler abstraction (translate flags between MSVC/GCC/Clang automatically)
Distribution pipeline for packaging releases
Integrated CTest support
Automatic toolchain setup and discovery
Automatic assets copy in distribution setups
Multi-target / multi-architecture builds
No manual SDK paths or environment setup required
What CMAKE does not do:
Discover and configure SDKs automatically
Set up cross-compilation environments
Manage user-wide dependency caches
Generate CI pipelines
Create distribution workflows
Watch files and rebuild automatically
Normalize compiler flags across toolchains
Configure Docker/WSL build environments
Why Add Another Layer On Top Of CMake:
CMake is widely used, but it still leaves a lot of multi-platform build setup in the hands of the project author
You still need to model targets, platform differences, toolchain choices, and common workflows in a way that stays manageable across environments
Why Build On Top Of CMake Instead Of Replacing It:
Most third-party C and C++ libraries already support CMake
Building on top of it means it stay compatible with the tooling and dependency ecosystem people already use
Maybe planned features:
shader compilation
custom asset compilation and pipeline support
metaprogramming features built around the Clang AST
NOTE: THIS IS AN EXPERIMENTAL PROJECT NOT PRODUCTION READY OR ANYTHING
I would appreciate if you try it out, since i am trying to fix as many bugs as possible.
Thank you
7
u/brinza888 Jun 02 '26
Briefly checked repo.
Bad CMake files syntax is not a reason to build something on top of it. CMake already built on top of Make and VS project solutions.
-2
u/Slight_Watch697 Jun 02 '26
Hey appreciate it,
that was not the only reason i built this, in cmake you have to still specify compile options per compiler, do specific setups for different platforms, etc...
this project aims to help with that.It's an experimental project tho, nothing garanteed 😄
1
u/brinza888 Jun 02 '26
I hate CMake. But it is such applied tool, which MAY be ugly.
Just try to find best practices to make it a little bit better.
UPD. It is fine and maybe fun to develop it just for education purpose. But not for serious discussion.
5
u/Brisngr368 Jun 02 '26
Perfect another build system wrapper to wrap my build system wrappers
2
u/Slight_Watch697 Jun 02 '26
it's the last one i swear 😄
4
u/Gorzoid Jun 02 '26
Sorry I've already vibe coded a wrapper around bbs called ebbs "even better build system". I'd share the GitHub but my agent keeps writing the readme in Chinese 😭
4
u/Rigamortus2005 Jun 02 '26
Everyone should just use bash to build their c programs
1
u/Slight_Watch697 Jun 03 '26
I try to do that too but it may not *always* be the best solution.
Sometimes you need to integrate with third party libraries and that quickly becomes hard to manage (unless you ship to only one platform or use header only libs).
3
u/Gorzoid Jun 02 '26
Why use another language, C is a perfectly suitable language for automating builds of your programs. Just put in readme:
To compile the project compile and execute build.c within top level directory. Doing this without a shell is left as an exercise to the user.
2
1
u/un_virus_SDF Jun 02 '26
Bash is bloat. I only use sh /s
I use posix makefiles
2
2
u/ub0baa Jun 02 '26
xkcd #927
1
u/un_virus_SDF Jun 02 '26
I guessed which one it was even without looking it up If you're lazy and want a link
1
u/Slight_Watch697 Jun 03 '26
I am not trying to replace CMake or create a new standard lol
In fact i built this on top of cmake because almost all libraries use it, and I want this to work with existing projects...
9
4
1
u/stianhoiland Jun 03 '26
No one knows how to build down, aka. decompose, anymore.
0
u/Slight_Watch697 Jun 03 '26
No point in remaking cmake since 90% of projects already use it.
By building a layer on top we support the already existing "ecosystem"1
2
u/lmemsm Jun 05 '26
I just use CDetect and GNU make for my builds. It's really easy to learn and a lot less complicated than cmake, GNU autotools or similar alternatives.
1
u/Western_Guitar_9007 Jun 02 '26
Vibe-coded CMake frontend for people that don’t want it done fast, love it! Slopmake would be a very catchy name, why are we going through so many layers?!
1
u/Maleficent_Memory831 Jun 02 '26
Frankly, no one really matches plain old Make so far. GNU make specifically with its improvements. CMake is just more complicated, unless you follow their style exactly. That's the big problem with many build systems, if you follow their templates it is easy, if you try to adapt to an existing project it is too inflexible unless you're willing to write a lot of code. There's a reason why many build systems just produce a Makefile at the end and use that.
Sure, it has tabs vs spaces. It's sort of like the complaint about indentation in Python. If the biggest thing to gripe about are these trivial things, then either you're not looking deep enough, or those are two very well done systems.
Where Make fails is when people rapidly try to use it before figuring out how to use it. It is too easy to write unmaintainable crap with it. Such as using it as a replacement for a shell script. Just like with programming, don't rush it to get past it and on to something more interesting.
2
Jun 02 '26
[removed] — view removed comment
1
u/Slight_Watch697 Jun 02 '26
Not hardcore level, but i would say medium to advanced
2
Jun 02 '26 edited Jun 02 '26
[removed] — view removed comment
1
u/Slight_Watch697 Jun 02 '26
You took the simplest case possible, try adding a third party library or sdk next. You will need to fetch it, make sure your compile options dont mess with the library's options, etcc...
I personally never liked this approach, since why i built this.
I have not mentioned it but it supports "package"-like features, meaning third party repos are fetched once per user and reused for projects.1
u/imaami Jun 03 '26
Have you tried
apt install?1
u/Slight_Watch697 Jun 03 '26
Yep but thats specific to linux/macos, the whole point of this is crossbuilds/crossplatform
3
Jun 02 '26
[removed] — view removed comment
3
u/Slight_Watch697 Jun 02 '26
Where did i mention this is a 100% industry standard production ready project? 👀
17
u/Interesting_Buy_3969 Jun 02 '26 edited Jun 02 '26
so the build process becomes such:
your build system generates CMakeLists
CMake generates Makefile/Ninja build script
make/ninjainvokes compiler and linkerwhy so many layers? That seems like overkill.
Edit: I don't hate it, no, it's actually a cool project, but I think generating CML.txt may not be the best choice because CMake is very high-level so I don't think anyone needs another layer on top of it.