3 ms·
Can you actually write Zig build scripts to build C++ projects? If that’s possible then that might be a good option.
by cyber_kinetist 4y ago
Can you actually write Zig build scripts to build C++ projects? If that’s possible then that might be a good option.
- jhgb 4y agoJudging from https://zig.news/kristoff/make-zig-your-c-c-build-system-28g5 https://zig.news/kristoff/make-zig-your-c-c-build-system-28g... , this should be possible. Considering Zig's features, I wonder if even the automated build logic in this Qb system couldn't be ported into a Zig build script completely.
- flohofwoe 4y agoYes, here is an example for a non-trivial mixed C/C++ project: https://github.com/floooh/sokol-tools/blob/master/build.zig https://github.com/floooh/sokol-tools/blob/master/build.zig Compared to cmake this means giving up IDE support like Xcode or Visual Studio though, it's really "just" a build system, not a meta-build system which can generate IDE project files. The Zig build system also has some minor warts that don't matter much for a pure Zig project but do matter for C/C++ projects, mainly that build settings of dependencies (like header search paths or linker input) mostly don't automatically 'travel' upwards to the root, instead each dependency and root project needs to be configured on its own. There are plenty of upsides too though, like much simplified cross-compilation, all in all it looks very promising.
- cyber_kinetist 4y agoCan it also generate compile_commands.json automatically? That is the only thing you need for IDE/editor support nowadays.
- flohofwoe 4y agoAFAIK no, sounds like a good feature to have though.