gpu-dawn: update build.zig for generated-2022-02-17

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-02-17 22:32:59 -07:00 committed by Stephen Gutekanst
parent 86d7c7ce11
commit 0b5b832549

View file

@ -29,9 +29,9 @@ pub fn build(b: *Builder) void {
link(b, dawn_example, options); link(b, dawn_example, options);
glfw.link(b, dawn_example, .{ .system_sdk = .{ .set_sysroot = false } }); glfw.link(b, dawn_example, .{ .system_sdk = .{ .set_sysroot = false } });
dawn_example.addPackagePath("glfw", "libs/mach-glfw/src/main.zig"); dawn_example.addPackagePath("glfw", "libs/mach-glfw/src/main.zig");
dawn_example.addIncludeDir("libs/dawn/out/Debug/gen/src/include"); dawn_example.addIncludeDir("libs/dawn/out/Debug/gen/include");
dawn_example.addIncludeDir("libs/dawn/out/Debug/gen/src"); dawn_example.addIncludeDir("libs/dawn/out/Debug/gen/src");
dawn_example.addIncludeDir("libs/dawn/src/include"); dawn_example.addIncludeDir("libs/dawn/include");
dawn_example.addIncludeDir("src/dawn"); dawn_example.addIncludeDir("src/dawn");
dawn_example.install(); dawn_example.install();
@ -107,6 +107,8 @@ pub const Options = struct {
if (self.minimal_debug_symbols) { if (self.minimal_debug_symbols) {
if (zero_debug_symbols) try flags.append("-g0") else try flags.append("-g1"); if (zero_debug_symbols) try flags.append("-g0") else try flags.append("-g1");
} }
// TODO: this flag is illegal for C sources!
try flags.append("-std=c++17");
} }
}; };
@ -370,9 +372,9 @@ fn buildLibMachDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options:
appendDawnEnableBackendTypeFlags(&flags, options) catch unreachable; appendDawnEnableBackendTypeFlags(&flags, options) catch unreachable;
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/mach-glfw/upstream/glfw/include"), include("libs/mach-glfw/upstream/glfw/include"),
include("libs/dawn/out/Debug/gen/src/include"), include("libs/dawn/out/Debug/gen/include"),
include("libs/dawn/out/Debug/gen/src"), include("libs/dawn/out/Debug/gen/src"),
include("libs/dawn/src/include"), include("libs/dawn/include"),
include("libs/dawn/src"), include("libs/dawn/src"),
}) catch unreachable; }) catch unreachable;
@ -400,7 +402,7 @@ fn buildLibDawnCommon(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
scanSources( scanSources(
b, b,
&sources, &sources,
"libs/dawn/src/common/", "libs/dawn/src/dawn/common/",
&.{ ".cpp", ".c", ".cc" }, &.{ ".cpp", ".c", ".cc" },
&.{}, &.{},
&.{ &.{
@ -416,14 +418,14 @@ fn buildLibDawnCommon(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
// TODO(build-system): pass system SDK options through // TODO(build-system): pass system SDK options through
system_sdk.include(b, lib, .{}); system_sdk.include(b, lib, .{});
lib.linkFramework("Foundation"); lib.linkFramework("Foundation");
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn/src/common/SystemUtils_mac.mm" }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn/src/dawn/common/SystemUtils_mac.mm" }) catch unreachable;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
} }
addCSourceFiles(b, lib, sources.items, flags.items); addCSourceFiles(b, lib, sources.items, flags.items);
return lib; return lib;
} }
// Build dawn platform sources; derived from src/dawn_platform/BUILD.gn // Build dawn platform sources; derived from src/dawn/platform/BUILD.gn
fn buildLibDawnPlatform(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep { fn buildLibDawnPlatform(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep {
const lib = if (!options.separate_libs) step else blk: { const lib = if (!options.separate_libs) step else blk: {
var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable; var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable;
@ -439,16 +441,16 @@ fn buildLibDawnPlatform(b: *Builder, step: *std.build.LibExeObjStep, options: Op
options.appendFlags(&flags, false) catch unreachable; options.appendFlags(&flags, false) catch unreachable;
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/dawn/src"), include("libs/dawn/src"),
include("libs/dawn/src/include"), include("libs/dawn/include"),
include("libs/dawn/out/Debug/gen/src/include"), include("libs/dawn/out/Debug/gen/include"),
}) catch unreachable; }) catch unreachable;
var sources = std.ArrayList([]const u8).init(b.allocator); var sources = std.ArrayList([]const u8).init(b.allocator);
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_platform/DawnPlatform.cpp", "src/dawn/platform/DawnPlatform.cpp",
"src/dawn_platform/WorkerThread.cpp", "src/dawn/platform/WorkerThread.cpp",
"src/dawn_platform/tracing/EventTracer.cpp", "src/dawn/platform/tracing/EventTracer.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -474,7 +476,7 @@ fn appendDawnEnableBackendTypeFlags(flags: *std.ArrayList([]const u8), options:
if (options.opengl_es.?) try flags.appendSlice(&.{ opengl, opengl_es }); if (options.opengl_es.?) try flags.appendSlice(&.{ opengl, opengl_es });
} }
// Builds dawn native sources; derived from src/dawn_native/BUILD.gn // Builds dawn native sources; derived from src/dawn/native/BUILD.gn
fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep { fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep {
const lib = if (!options.separate_libs) step else blk: { const lib = if (!options.separate_libs) step else blk: {
var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable; var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable;
@ -497,7 +499,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/dawn"), include("libs/dawn"),
include("libs/dawn/src"), include("libs/dawn/src"),
include("libs/dawn/src/include"), include("libs/dawn/include"),
include("libs/dawn/third_party/vulkan-deps/spirv-tools/src/include"), include("libs/dawn/third_party/vulkan-deps/spirv-tools/src/include"),
include("libs/dawn/third_party/abseil-cpp"), include("libs/dawn/third_party/abseil-cpp"),
include("libs/dawn/third_party/khronos"), include("libs/dawn/third_party/khronos"),
@ -512,15 +514,15 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
include("libs/dawn/third_party/tint"), include("libs/dawn/third_party/tint"),
include("libs/dawn/third_party/tint/include"), include("libs/dawn/third_party/tint/include"),
include("libs/dawn/out/Debug/gen/src/include"), include("libs/dawn/out/Debug/gen/include"),
include("libs/dawn/out/Debug/gen/src"), include("libs/dawn/out/Debug/gen/src"),
}) catch unreachable; }) catch unreachable;
var sources = std.ArrayList([]const u8).init(b.allocator); var sources = std.ArrayList([]const u8).init(b.allocator);
inline for (&[_][]const u8{ inline for (&[_][]const u8{
"out/Debug/gen/src/dawn/", "out/Debug/gen/src/dawn/",
"src/dawn_native/", "src/dawn/native/",
"src/dawn_native/utils/", "src/dawn/native/utils/",
}) |dir| scanSources( }) |dir| scanSources(
b, b,
&sources, &sources,
@ -534,15 +536,15 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
scanSources( scanSources(
b, b,
&sources, &sources,
"libs/dawn/out/Debug/gen/src/dawn_native/", "libs/dawn/out/Debug/gen/src/dawn/native/",
&.{ ".cpp", ".c", ".cc" }, &.{ ".cpp", ".c", ".cc" },
&.{}, &.{},
&.{ "test", "benchmark", "mock" }, &.{ "test", "benchmark", "mock" },
) catch unreachable; ) catch unreachable;
// TODO(build-system): could allow enable_vulkan_validation_layers here. See src/dawn_native/BUILD.gn // TODO(build-system): could allow enable_vulkan_validation_layers here. See src/dawn/native/BUILD.gn
// TODO(build-system): allow use_angle here. See src/dawn_native/BUILD.gn // TODO(build-system): allow use_angle here. See src/dawn/native/BUILD.gn
// TODO(build-system): could allow use_swiftshader here. See src/dawn_native/BUILD.gn // TODO(build-system): could allow use_swiftshader here. See src/dawn/native/BUILD.gn
if (options.d3d12.?) { if (options.d3d12.?) {
// TODO(build-system): windows // TODO(build-system): windows
@ -550,7 +552,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
scanSources( scanSources(
b, b,
&sources, &sources,
"libs/dawn/src/dawn_native/d3d12/", "libs/dawn/src/dawn/native/d3d12/",
&.{ ".cpp", ".c", ".cc" }, &.{ ".cpp", ".c", ".cc" },
&.{}, &.{},
&.{ "test", "benchmark", "mock" }, &.{ "test", "benchmark", "mock" },
@ -567,7 +569,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
scanSources( scanSources(
b, b,
&sources, &sources,
"libs/dawn/src/dawn_native/metal/", "libs/dawn/src/dawn/native/metal/",
&.{ ".cpp", ".c", ".cc", ".m", ".mm" }, &.{ ".cpp", ".c", ".cc", ".m", ".mm" },
&.{}, &.{},
&.{ "test", "benchmark", "mock" }, &.{ "test", "benchmark", "mock" },
@ -575,7 +577,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
scanSources( scanSources(
b, b,
&sources, &sources,
"libs/dawn/src/dawn_native/", "libs/dawn/src/dawn/native/",
&.{ ".m", ".mm" }, &.{ ".m", ".mm" },
&.{}, &.{},
&.{ "test", "benchmark", "mock" }, &.{ "test", "benchmark", "mock" },
@ -585,7 +587,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
if (options.linux_window_manager != null and options.linux_window_manager.? == .X11) { if (options.linux_window_manager != null and options.linux_window_manager.? == .X11) {
lib.linkSystemLibrary("X11"); lib.linkSystemLibrary("X11");
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/XlibXcbFunctions.cpp", "src/dawn/native/XlibXcbFunctions.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -593,7 +595,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
} }
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/null/DeviceNull.cpp", "src/dawn/native/null/DeviceNull.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -601,7 +603,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
if (options.desktop_gl.? or options.vulkan.?) { if (options.desktop_gl.? or options.vulkan.?) {
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/SpirvValidation.cpp", "src/dawn/native/SpirvValidation.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -612,7 +614,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
scanSources( scanSources(
b, b,
&sources, &sources,
"libs/dawn/out/Debug/gen/src/dawn_native/opengl/", "libs/dawn/out/Debug/gen/src/dawn/native/opengl/",
&.{ ".cpp", ".c", ".cc" }, &.{ ".cpp", ".c", ".cc" },
&.{}, &.{},
&.{ "test", "benchmark", "mock" }, &.{ "test", "benchmark", "mock" },
@ -621,7 +623,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
scanSources( scanSources(
b, b,
&sources, &sources,
"libs/dawn/src/dawn_native/opengl/", "libs/dawn/src/dawn/native/opengl/",
&.{ ".cpp", ".c", ".cc" }, &.{ ".cpp", ".c", ".cc" },
&.{}, &.{},
&.{ "test", "benchmark", "mock" }, &.{ "test", "benchmark", "mock" },
@ -633,7 +635,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
scanSources( scanSources(
b, b,
&sources, &sources,
"libs/dawn/src/dawn_native/vulkan/", "libs/dawn/src/dawn/native/vulkan/",
&.{ ".cpp", ".c", ".cc" }, &.{ ".cpp", ".c", ".cc" },
&.{}, &.{},
&.{ "test", "benchmark", "mock" }, &.{ "test", "benchmark", "mock" },
@ -641,8 +643,8 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
if (isLinuxDesktopLike(target)) { if (isLinuxDesktopLike(target)) {
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp", "src/dawn/native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceFD.cpp", "src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.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;
lib.addCSourceFile(abs_path, flags.items); lib.addCSourceFile(abs_path, flags.items);
@ -650,16 +652,16 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
} }
} else if (target.os.tag == .fuchsia) { } else if (target.os.tag == .fuchsia) {
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/vulkan/external_memory/MemoryServiceZirconHandle.cpp", "src/dawn/native/vulkan/external_memory/MemoryServiceZirconHandle.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp", "src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
} }
} else { } else {
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/vulkan/external_memory/MemoryServiceNull.cpp", "src/dawn/native/vulkan/external_memory/MemoryServiceNull.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceNull.cpp", "src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -707,7 +709,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
} }
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/null/NullBackend.cpp", "src/dawn/native/null/NullBackend.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -715,7 +717,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
if (options.d3d12.?) { if (options.d3d12.?) {
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/d3d12/D3D12Backend.cpp", "src/dawn/native/d3d12/D3D12Backend.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -723,7 +725,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
} }
if (options.desktop_gl.?) { if (options.desktop_gl.?) {
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/opengl/OpenGLBackend.cpp", "src/dawn/native/opengl/OpenGLBackend.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -731,7 +733,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
} }
if (options.vulkan.?) { if (options.vulkan.?) {
for ([_][]const u8{ for ([_][]const u8{
"src/dawn_native/vulkan/VulkanBackend.cpp", "src/dawn/native/vulkan/VulkanBackend.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -805,7 +807,7 @@ fn buildLibTint(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
"libs/dawn/" ++ dir, "libs/dawn/" ++ dir,
&.{ ".cpp", ".c", ".cc" }, &.{ ".cpp", ".c", ".cc" },
&.{}, &.{},
&.{ "test", "benchmark", "printer_windows", "printer_linux", "printer_other" }, &.{ "test", "bench", "printer_windows", "printer_linux", "printer_other" },
) catch unreachable; ) catch unreachable;
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;
@ -842,7 +844,7 @@ fn buildLibTint(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
"libs/dawn/third_party/tint/src/writer/spirv/", "libs/dawn/third_party/tint/src/writer/spirv/",
&.{ ".cpp", ".c", ".cc" }, &.{ ".cpp", ".c", ".cc" },
&.{}, &.{},
&.{ "test", "benchmark" }, &.{ "test", "bench" },
) catch unreachable; ) catch unreachable;
// TODO(build-system): make optional // TODO(build-system): make optional
@ -1081,7 +1083,7 @@ fn buildLibAbseilCpp(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
return lib; return lib;
} }
// Buids dawn wire sources; derived from src/dawn_wire/BUILD.gn // Buids dawn wire sources; derived from src/dawn/wire/BUILD.gn
fn buildLibDawnWire(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep { fn buildLibDawnWire(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep {
const lib = if (!options.separate_libs) step else blk: { const lib = if (!options.separate_libs) step else blk: {
var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable; var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable;
@ -1098,19 +1100,19 @@ fn buildLibDawnWire(b: *Builder, step: *std.build.LibExeObjStep, options: Option
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/dawn"), include("libs/dawn"),
include("libs/dawn/src"), include("libs/dawn/src"),
include("libs/dawn/src/include"), include("libs/dawn/include"),
include("libs/dawn/out/Debug/gen/src/include"), include("libs/dawn/out/Debug/gen/include"),
include("libs/dawn/out/Debug/gen/src"), include("libs/dawn/out/Debug/gen/src"),
}) catch unreachable; }) catch unreachable;
var sources = std.ArrayList([]const u8).init(b.allocator); var sources = std.ArrayList([]const u8).init(b.allocator);
inline for (&[_][]const u8{ inline for (&[_][]const u8{
"out/Debug/gen/src/dawn_wire/", "out/Debug/gen/src/dawn/wire/",
"out/Debug/gen/src/dawn_wire/client/", "out/Debug/gen/src/dawn/wire/client/",
"out/Debug/gen/src/dawn_wire/server/", "out/Debug/gen/src/dawn/wire/server/",
"src/dawn_wire/", "src/dawn/wire/",
"src/dawn_wire/client/", "src/dawn/wire/client/",
"src/dawn_wire/server/", "src/dawn/wire/server/",
}) |dir| scanSources( }) |dir| scanSources(
b, b,
&sources, &sources,
@ -1123,7 +1125,7 @@ fn buildLibDawnWire(b: *Builder, step: *std.build.LibExeObjStep, options: Option
return lib; return lib;
} }
// Builds dawn utils sources; derived from src/utils/BUILD.gn // Builds dawn utils sources; derived from src/dawn/utils/BUILD.gn
fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep { fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep {
const lib = if (!options.separate_libs) step else blk: { const lib = if (!options.separate_libs) step else blk: {
var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable; var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable;
@ -1142,14 +1144,14 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/mach-glfw/upstream/glfw/include"), include("libs/mach-glfw/upstream/glfw/include"),
include("libs/dawn/src"), include("libs/dawn/src"),
include("libs/dawn/src/include"), include("libs/dawn/include"),
include("libs/dawn/out/Debug/gen/src/include"), include("libs/dawn/out/Debug/gen/include"),
}) catch unreachable; }) catch unreachable;
var sources = std.ArrayList([]const u8).init(b.allocator); var sources = std.ArrayList([]const u8).init(b.allocator);
for ([_][]const u8{ for ([_][]const u8{
"src/utils/BackendBinding.cpp", "src/dawn/utils/BackendBinding.cpp",
"src/utils/NullBinding.cpp", "src/dawn/utils/NullBinding.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -1157,7 +1159,7 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
if (options.d3d12.?) { if (options.d3d12.?) {
for ([_][]const u8{ for ([_][]const u8{
"src/utils/D3D12Binding.cpp", "src/dawn/utils/D3D12Binding.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -1165,7 +1167,7 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
} }
if (options.metal.?) { if (options.metal.?) {
for ([_][]const u8{ for ([_][]const u8{
"src/utils/MetalBinding.mm", "src/dawn/utils/MetalBinding.mm",
}) |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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -1174,7 +1176,7 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
if (options.desktop_gl.?) { if (options.desktop_gl.?) {
for ([_][]const u8{ for ([_][]const u8{
"src/utils/OpenGLBinding.cpp", "src/dawn/utils/OpenGLBinding.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;
@ -1183,7 +1185,7 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
if (options.vulkan.?) { if (options.vulkan.?) {
for ([_][]const u8{ for ([_][]const u8{
"src/utils/VulkanBinding.cpp", "src/dawn/utils/VulkanBinding.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;
sources.append(abs_path) catch unreachable; sources.append(abs_path) catch unreachable;