@cImport works without build.zig and even with build.zig requires no special configuration (ignoring linking).
As it is currently described, @import of C will require build.zig and specific configuration therein.
As it is currently described, @import of C will require build.zig and specific configuration therein.
I consider that an appropriate development. Binaries need to be built, this should be integrated with the rest of the system in any modern language.
It's not incompatible with using something like CMake or Ninja either, it just puts certain responsibilities inside of build.zig. Where they belong.
[1] https://github.com/ziglang/zig/issues/20630#issuecomment-225...
const translate_c = b.addTranslateC(.{
.root_source_file = b.path("src/c.h"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("c", translate_c.createModule());
https://github.com/ziglang/zig/issues/20648