webgpu: build dawn-wire into a library
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
698d4f6bc4
commit
9793bb7de0
1 changed files with 15 additions and 9 deletions
|
|
@ -33,13 +33,15 @@ pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void
|
||||||
const lib_dawn_platform = buildLibDawnPlatform(b, step);
|
const lib_dawn_platform = buildLibDawnPlatform(b, step);
|
||||||
step.linkLibrary(lib_dawn_platform);
|
step.linkLibrary(lib_dawn_platform);
|
||||||
|
|
||||||
// dawn-native dependencies
|
// dawn-native
|
||||||
const lib_abseil_cpp = buildLibAbseilCpp(b, step);
|
const lib_abseil_cpp = buildLibAbseilCpp(b, step);
|
||||||
step.linkLibrary(lib_abseil_cpp);
|
step.linkLibrary(lib_abseil_cpp);
|
||||||
|
|
||||||
const lib_dawn_native = buildLibDawnNative(b, step, options);
|
const lib_dawn_native = buildLibDawnNative(b, step, options);
|
||||||
step.linkLibrary(lib_dawn_native);
|
step.linkLibrary(lib_dawn_native);
|
||||||
|
|
||||||
|
const lib_dawn_wire = buildLibDawnWire(b, step);
|
||||||
|
step.linkLibrary(lib_dawn_wire);
|
||||||
|
|
||||||
const lib = buildLibDawn(b, step, options);
|
const lib = buildLibDawn(b, step, options);
|
||||||
step.linkLibrary(lib);
|
step.linkLibrary(lib);
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +54,6 @@ fn buildLibDawn(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
|
||||||
lib.linkLibCpp();
|
lib.linkLibCpp();
|
||||||
|
|
||||||
const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
|
const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
|
||||||
addDawnWireSources(b, lib, options, target);
|
|
||||||
addDawnUtilsSources(b, lib, options, target);
|
addDawnUtilsSources(b, lib, options, target);
|
||||||
addThirdPartyTintSources(b, lib, options, target);
|
addThirdPartyTintSources(b, lib, options, target);
|
||||||
return lib;
|
return lib;
|
||||||
|
|
@ -1207,10 +1208,14 @@ fn buildLibAbseilCpp(b: *Builder, step: *std.build.LibExeObjStep) *std.build.Lib
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds dawn wire sources; derived from src/dawn_wire/BUILD.gn
|
// Buids dawn wire sources; derived from src/dawn_wire/BUILD.gn
|
||||||
fn addDawnWireSources(b: *Builder, step: *std.build.LibExeObjStep, options: Options, target: std.Target) void {
|
fn buildLibDawnWire(b: *Builder, step: *std.build.LibExeObjStep) *std.build.LibExeObjStep {
|
||||||
_ = options;
|
var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable;
|
||||||
_ = target;
|
const lib = b.addStaticLibrary("dawn-wire", main_abs);
|
||||||
|
lib.setBuildMode(step.build_mode);
|
||||||
|
lib.setTarget(step.target);
|
||||||
|
lib.linkLibCpp();
|
||||||
|
|
||||||
const flags = &.{
|
const flags = &.{
|
||||||
include("libs/dawn/src"),
|
include("libs/dawn/src"),
|
||||||
include("libs/dawn/src/include"),
|
include("libs/dawn/src/include"),
|
||||||
|
|
@ -1228,7 +1233,7 @@ fn addDawnWireSources(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
|
||||||
"out/Debug/gen/src/dawn_wire/server/ServerHandlers_autogen.cpp",
|
"out/Debug/gen/src/dawn_wire/server/ServerHandlers_autogen.cpp",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
|
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
|
||||||
step.addCSourceFile(abs_path, flags);
|
lib.addCSourceFile(abs_path, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dawn_wire_gen
|
// dawn_wire_gen
|
||||||
|
|
@ -1254,8 +1259,9 @@ fn addDawnWireSources(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
|
||||||
"src/dawn_wire/server/ServerShaderModule.cpp",
|
"src/dawn_wire/server/ServerShaderModule.cpp",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
|
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
|
||||||
step.addCSourceFile(abs_path, flags);
|
lib.addCSourceFile(abs_path, flags);
|
||||||
}
|
}
|
||||||
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds dawn utils sources; derived from src/utils/BUILD.gn
|
// Adds dawn utils sources; derived from src/utils/BUILD.gn
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue