Hi, I am new here and to zig so feel free to point me to appropriate doc.
I am trying to use zig in an existing C project and looking at changing my current build system. I am using raylib at present and want to create a project root level build.zig which should then trigger raylib build.
//! Build script for the overall project
const std = @import("std");
const raylib = @import("extra/raylib/build.zig");
// This has been tested to work with zig 0.11.0 and zig 0.12.0-dev.2075+f5978181e
pub fn build(b: *std.Build) !void {
try raylib.build(b);
}
This doesnt work and fails at the install stage where the raylib/src/build.zig uses relative path which doesnt work due to this setup. Any pointers to work around this wil be helpful.
The code in raylib/src/build.zig is as follows (for reference):
lib.installHeader("src/raylib.h", "raylib.h");
lib.installHeader("src/raymath.h", "raymath.h");
lib.installHeader("src/rlgl.h", "rlgl.h");
The reason for failure is because when the zig build runs then it runs from base folder of my project, but raylib is inside a subfolder, but the raylib/src/build.zig assumes while installing (see above) that it is inside the raylib folder (which is not true).
>zig build
install
└─ install src\raymath.h to raymath.h failure