4 ms·
I’ve written a fair amount of Makefiles and bounced off of cmake. Recently I’ve started using zig to build some C++ projects and will not be switching back. H
by davemp 2y ago
I’ve written a fair amount of Makefiles and bounced off of cmake. Recently I’ve started using zig to build some C++ projects and will not be switching back.
Having your build tool just be a library in a good general purpose language is the right move. Why use unergonomic hacks like the OP when you can use a sane language? My build.zig files have LSP completions and similar syntax (or the same) as what I’m building.
I put make solidly in the pile of tools that are only still around because of network effects. We’d have switched to something better if it weren’t defacto installed by every distro and had to make justifications to sys admins to install alternatives.
- aeonik 2y agoSame reason I like Clojure tools.build. Any other way feels a little ridiculous to do it any other way.
- deleted 2y ago[deleted]
- einpoklum 2y agoWell, many of us certainly aren't happy living with the annoying syntax and arcane customs of CMake. But - it does get the job done, and incorporates large amounts of arcane knowledge, multiplied over numerous platforms - so that you don't have to. Can I get the same from a Zig-based build system, or build system generator? Can you perhaps link to some comparative review of using zig for building, with the use of CMake?
- davemp 2y agoI don’t have a review, but here’s a significant project using it in a complicated cross platform build with different systems dependencies: https://github.com/raysan5/raylib/blob/master/build.zig https://github.com/raysan5/raylib/blob/master/build.zig They also have a cmakelists.txt and pile of other cmake stuff to compare against: https://github.com/raysan5/raylib/tree/master/cmake https://github.com/raysan5/raylib/tree/master/cmake One of the nicer things is that if you’re working with less technical folks, they only need to download the zig binary because it bundles the entire toolchain. Real nice when on corporate windows systems.
- einpoklum 2y ago> they only need to download the zig binary because it bundles the entire toolchain. But that can't be possible... neither in principle nor in practice, because each projects needs a different toolchain. Different languages, different tools, different target platforms etc.
- davemp 2y agoWell it’s working in practice so I don’t really know what to tell you. > because each projects needs a different toolchain Not true. > Different languages I don’t think a caveat for C/C++/zig source files was needed… > Different tools If your project is unwilling/able to verify builds on anything except an ancient version of GCC that’s your project’s problem. In practice that’s a minority. > different target platforms Zig has 1st class cross compilation to all major platforms. If you’re using an embedded target you’ll need to vendor its linker script and boot code which is already the common practice. — I encourage you to try it before dismissing it.