Header only library for writing build recipes in C.
The idea is that you should not need anything but a C compiler to build a C project. No make, no cmake, no shell, no cmd, no PowerShell etc. Only C compiler. So with the C compiler you bootstrap your build system and then you use the build system to build everything else.
Try it out right here:
$ gcc ./ZeroBuild.c -o ZeroBuild
$ ./ZeroBuild
Explore ZeroBuild.c file to learn more.
I'm not sure if this is even a good idea myself. This is why I'm implementing it. This is a research project. I'm not making any claims about suitability of this approach to any project.
It works quite well for me.
If you are using cmake with tons of modules to manage and find tons of dependencies you probably don't want to use this tool. ZeroBuild is more like writting shell scripts but in C.
- Extremely portable builds across variety of systems including (but not limited to) Linux, MacOS, Windows, FreeBSD, etc. This is achieved by reducing the amount of dependencies to just a C compiler, which exists pretty much for any platform these days.
- You end up using the same language for developing and building your project. Which may enable some interesting code reusage strategies. The build system can use the code of the project itself directly and the project can use the code of the build system also directly.
- You get to use C more.
- ...
- You need to be comfortable with C and implementing things yourself. As mentioned above this is like writing shell scripts but in C.
- It probably does not make any sense outside of C/C++ projects.
- You get to use C more.
- ...
Keep in mind that ZeroBuild.h is an stb-style header-only library. That means that just including it does not include the implementations of the functions. You have to #define ZeroBuild_IMPLEMENTATION
before the include. See the ZeroBuild.c for an example.
- Copy ZeroBuild.h to your project
- Create
ZeroBuild.c
in your project with the build recipe. See our ZeroBuild.c for an example. - Bootstrap the
ZeroBuild
executable:$ cc ZeroBuild.c -o ZeroBuild
on POSIX systems$ cl.exe ZeroBuild.c
on Windows with MSVC
- Run the build:
$ ./ZeroBuild
If you enable the [Go Rebuild Yourrself] Technology the ZeroBuild
executable will try to rebootstrap itself every time you modify its source code.
- Add support for C++ or move Completely to C++ ? (TBD)
- Setup to work mostly with GCC or Ports of GCC add Functionality to do it with MS cl.exe ?*
-
is there a need for cl.exe support. I don't know if it's possible to use cl.exe with ZeroBuild as cl.exe requires development tools to be installed and cl.exe can only run with an instance of Developer Powershell that has Elevated Access on Windows.
-
is there a need for a build system that can be used with cmake ? Cause the only reasons i can think of are:
- the reason I have included cmake is just so I can port ZeroBuild to MSVC from GCC.
- testing ZeroBuild with cmake seems to be a good idea. But Not sure how the implementation would go or even if it's worth it or not.
1.minirent