gpu-dawn: ensure submodules are initialized as part of zig build
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
225109ec7b
commit
943a5af48b
1 changed files with 10 additions and 0 deletions
|
|
@ -97,6 +97,8 @@ pub const Options = struct {
|
|||
};
|
||||
|
||||
pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void {
|
||||
ensureSubmodules(b.allocator) catch |err| @panic(@errorName(err));
|
||||
|
||||
const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
|
||||
const opt = options.detectDefaults(target);
|
||||
|
||||
|
|
@ -128,6 +130,14 @@ pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void
|
|||
step.linkLibrary(lib_tint);
|
||||
}
|
||||
|
||||
fn ensureSubmodules(allocator: std.mem.Allocator) !void {
|
||||
const child = try std.ChildProcess.init(&.{ "git", "submodule", "update", "--init", "--recursive" }, allocator);
|
||||
child.cwd = thisDir();
|
||||
child.stderr = std.io.getStdErr();
|
||||
child.stdout = std.io.getStdOut();
|
||||
_ = try child.spawnAndWait();
|
||||
}
|
||||
|
||||
fn isLinuxDesktopLike(target: std.Target) bool {
|
||||
const tag = target.os.tag;
|
||||
return !tag.isDarwin() and tag != .windows and tag != .fuchsia and tag != .emscripten and !target.isAndroid();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue