gpu-dawn: cleanup dependency linkages
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
d1404e782f
commit
aeb1f3d94c
1 changed files with 150 additions and 181 deletions
|
|
@ -82,34 +82,26 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
step.addIncludePath(sdkPath("/src/dawn"));
|
step.addIncludePath(sdkPath("/src/dawn"));
|
||||||
|
|
||||||
if (options.separate_libs) {
|
if (options.separate_libs) {
|
||||||
const lib_mach_dawn_native = try buildLibMachDawnNative(b, step, options);
|
|
||||||
step.linkLibrary(lib_mach_dawn_native);
|
|
||||||
|
|
||||||
const lib_dawn_common = try buildLibDawnCommon(b, step, options);
|
const lib_dawn_common = try buildLibDawnCommon(b, step, options);
|
||||||
step.linkLibrary(lib_dawn_common);
|
|
||||||
|
|
||||||
const lib_dawn_platform = try buildLibDawnPlatform(b, step, options);
|
const lib_dawn_platform = try buildLibDawnPlatform(b, step, options);
|
||||||
step.linkLibrary(lib_dawn_platform);
|
|
||||||
|
|
||||||
// dawn-native
|
|
||||||
const lib_abseil_cpp = try buildLibAbseilCpp(b, step, options);
|
const lib_abseil_cpp = try buildLibAbseilCpp(b, step, options);
|
||||||
step.linkLibrary(lib_abseil_cpp);
|
|
||||||
const lib_dawn_native = try buildLibDawnNative(b, step, options);
|
const lib_dawn_native = try buildLibDawnNative(b, step, options);
|
||||||
|
const lib_dawn_wire = try buildLibDawnWire(b, step, options);
|
||||||
|
const lib_spirv_tools = try buildLibSPIRVTools(b, step, options);
|
||||||
|
const lib_tint = try buildLibTint(b, step, options);
|
||||||
|
|
||||||
|
step.linkLibrary(lib_dawn_common);
|
||||||
|
step.linkLibrary(lib_dawn_platform);
|
||||||
|
step.linkLibrary(lib_abseil_cpp);
|
||||||
step.linkLibrary(lib_dawn_native);
|
step.linkLibrary(lib_dawn_native);
|
||||||
|
step.linkLibrary(lib_dawn_wire);
|
||||||
|
step.linkLibrary(lib_spirv_tools);
|
||||||
|
step.linkLibrary(lib_tint);
|
||||||
|
|
||||||
if (options.d3d12.?) {
|
if (options.d3d12.?) {
|
||||||
const lib_dxcompiler = try buildLibDxcompiler(b, step, options);
|
const lib_dxcompiler = try buildLibDxcompiler(b, step, options);
|
||||||
step.linkLibrary(lib_dxcompiler);
|
step.linkLibrary(lib_dxcompiler);
|
||||||
}
|
}
|
||||||
|
|
||||||
const lib_dawn_wire = try buildLibDawnWire(b, step, options);
|
|
||||||
step.linkLibrary(lib_dawn_wire);
|
|
||||||
|
|
||||||
const lib_spirv_tools = try buildLibSPIRVTools(b, step, options);
|
|
||||||
step.linkLibrary(lib_spirv_tools);
|
|
||||||
|
|
||||||
const lib_tint = try buildLibTint(b, step, options);
|
|
||||||
step.linkLibrary(lib_tint);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,12 +110,8 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
.target = step.target,
|
.target = step.target,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
});
|
});
|
||||||
lib_dawn.linkLibCpp();
|
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(lib_dawn);
|
|
||||||
step.linkLibrary(lib_dawn);
|
step.linkLibrary(lib_dawn);
|
||||||
|
|
||||||
_ = try buildLibMachDawnNative(b, lib_dawn, options);
|
|
||||||
_ = try buildLibDawnCommon(b, lib_dawn, options);
|
_ = try buildLibDawnCommon(b, lib_dawn, options);
|
||||||
_ = try buildLibDawnPlatform(b, lib_dawn, options);
|
_ = try buildLibDawnPlatform(b, lib_dawn, options);
|
||||||
_ = try buildLibAbseilCpp(b, lib_dawn, options);
|
_ = try buildLibAbseilCpp(b, lib_dawn, options);
|
||||||
|
|
@ -278,23 +266,14 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
step.addIncludePath(include_dir);
|
step.addIncludePath(include_dir);
|
||||||
step.addIncludePath(sdkPath("/src/dawn"));
|
step.addIncludePath(sdkPath("/src/dawn"));
|
||||||
|
|
||||||
if (isLinuxDesktopLike(step.target_info.target.os.tag)) {
|
linkLibDawnCommonDependencies(b, step, options);
|
||||||
step.linkSystemLibraryName("X11");
|
linkLibDawnPlatformDependencies(b, step, options);
|
||||||
}
|
linkLibDawnNativeDependencies(b, step, options);
|
||||||
if (options.metal.?) {
|
linkLibTintDependencies(b, step, options);
|
||||||
step.linkFramework("Metal");
|
linkLibSPIRVToolsDependencies(b, step, options);
|
||||||
step.linkFramework("CoreFoundation");
|
linkLibAbseilCppDependencies(b, step, options);
|
||||||
step.linkFramework("CoreGraphics");
|
linkLibDawnWireDependencies(b, step, options);
|
||||||
step.linkFramework("Foundation");
|
linkLibDxcompilerDependencies(b, step, options);
|
||||||
step.linkFramework("IOKit");
|
|
||||||
step.linkFramework("IOSurface");
|
|
||||||
step.linkFramework("QuartzCore");
|
|
||||||
step.linkSystemLibraryName("objc");
|
|
||||||
}
|
|
||||||
if (options.d3d12.?) {
|
|
||||||
step.linkSystemLibraryName("ole32");
|
|
||||||
step.linkSystemLibraryName("dxguid");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ensureBinaryDownloaded(
|
pub fn ensureBinaryDownloaded(
|
||||||
|
|
@ -561,52 +540,25 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn buildLibMachDawnNative(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn linkLibDawnCommonDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
_ = options;
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
step.linkLibCpp();
|
||||||
.name = "dawn-native-mach",
|
deps.system_sdk.include(b, step, .{});
|
||||||
.target = step.target,
|
if (step.target_info.target.os.tag == .macos) {
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
step.linkSystemLibraryName("objc");
|
||||||
});
|
step.linkFramework("Foundation");
|
||||||
separate_lib.linkLibCpp();
|
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
|
|
||||||
var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
|
|
||||||
try appendFlags(step, &cpp_flags, options.debug, true);
|
|
||||||
try appendDawnEnableBackendTypeFlags(&cpp_flags, options);
|
|
||||||
try cpp_flags.appendSlice(&.{
|
|
||||||
"-I" ++ deps.glfw_include_dir,
|
|
||||||
include("libs/dawn/out/Debug/gen/include"),
|
|
||||||
include("libs/dawn/out/Debug/gen/src"),
|
|
||||||
include("libs/dawn/include"),
|
|
||||||
include("libs/dawn/src"),
|
|
||||||
});
|
|
||||||
if (step.target_info.target.os.tag == .windows) {
|
|
||||||
try cpp_flags.appendSlice(&.{
|
|
||||||
"-D_DEBUG",
|
|
||||||
"-D_MT",
|
|
||||||
"-D_DLL",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return lib;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds common sources; derived from src/common/BUILD.gn
|
// Builds common sources; derived from src/common/BUILD.gn
|
||||||
fn buildLibDawnCommon(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn buildLibDawnCommon(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
const lib = if (!options.separate_libs) step else b.addStaticLibrary(.{
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
.name = "dawn-common",
|
||||||
.name = "dawn-common",
|
.target = step.target,
|
||||||
.target = step.target,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
});
|
||||||
});
|
if (options.install_libs) b.installArtifact(lib);
|
||||||
separate_lib.linkLibCpp();
|
linkLibDawnCommonDependencies(b, lib, options);
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
|
|
||||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
|
|
@ -631,8 +583,6 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
|
var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
|
||||||
if (step.target_info.target.os.tag == .macos) {
|
if (step.target_info.target.os.tag == .macos) {
|
||||||
// TODO(build-system): pass system SDK options through
|
// TODO(build-system): pass system SDK options through
|
||||||
deps.system_sdk.include(b, lib, .{});
|
|
||||||
lib.linkFramework("Foundation");
|
|
||||||
const abs_path = sdkPath("/libs/dawn/src/dawn/common/SystemUtils_mac.mm");
|
const abs_path = sdkPath("/libs/dawn/src/dawn/common/SystemUtils_mac.mm");
|
||||||
try cpp_sources.append(abs_path);
|
try cpp_sources.append(abs_path);
|
||||||
}
|
}
|
||||||
|
|
@ -648,19 +598,21 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn linkLibDawnPlatformDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||||
|
_ = options;
|
||||||
|
step.linkLibCpp();
|
||||||
|
deps.system_sdk.include(b, step, .{});
|
||||||
|
}
|
||||||
|
|
||||||
// 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: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn buildLibDawnPlatform(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
const lib = if (!options.separate_libs) step else b.addStaticLibrary(.{
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
.name = "dawn-platform",
|
||||||
.name = "dawn-platform",
|
.target = step.target,
|
||||||
.target = step.target,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
});
|
||||||
});
|
if (options.install_libs) b.installArtifact(lib);
|
||||||
separate_lib.linkLibCpp();
|
linkLibDawnPlatformDependencies(b, lib, options);
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
|
|
||||||
var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
|
var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
try appendFlags(step, &cpp_flags, options.debug, true);
|
try appendFlags(step, &cpp_flags, options.debug, true);
|
||||||
|
|
@ -721,20 +673,37 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
"-DNOMINMAX",
|
"-DNOMINMAX",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fn linkLibDawnNativeDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||||
|
step.linkLibCpp();
|
||||||
|
deps.system_sdk.include(b, step, .{});
|
||||||
|
if (options.d3d12.?) {
|
||||||
|
step.linkSystemLibraryName("dxgi");
|
||||||
|
step.linkSystemLibraryName("dxguid");
|
||||||
|
}
|
||||||
|
if (options.metal.?) {
|
||||||
|
step.linkSystemLibraryName("objc");
|
||||||
|
step.linkFramework("Metal");
|
||||||
|
step.linkFramework("CoreGraphics");
|
||||||
|
step.linkFramework("Foundation");
|
||||||
|
step.linkFramework("IOKit");
|
||||||
|
step.linkFramework("IOSurface");
|
||||||
|
step.linkFramework("QuartzCore");
|
||||||
|
}
|
||||||
|
const tag = step.target_info.target.os.tag;
|
||||||
|
if (isLinuxDesktopLike(tag)) {
|
||||||
|
step.linkSystemLibraryName("X11");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn buildLibDawnNative(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
const lib = if (!options.separate_libs) step else b.addStaticLibrary(.{
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
.name = "dawn-native",
|
||||||
.name = "dawn-native",
|
.target = step.target,
|
||||||
.target = step.target,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
});
|
||||||
});
|
if (options.install_libs) b.installArtifact(lib);
|
||||||
separate_lib.linkLibCpp();
|
linkLibDawnNativeDependencies(b, lib, options);
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
deps.system_sdk.include(b, lib, .{});
|
|
||||||
|
|
||||||
// MacOS: this must be defined for system-sdk-13.3 and older.
|
// MacOS: this must be defined for system-sdk-13.3 and older.
|
||||||
// Critically, this MUST NOT be included as a -D__kernel_ptr_semantics flag. If it is,
|
// Critically, this MUST NOT be included as a -D__kernel_ptr_semantics flag. If it is,
|
||||||
|
|
@ -808,9 +777,6 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
|
|
||||||
var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
|
var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
|
||||||
if (options.d3d12.?) {
|
if (options.d3d12.?) {
|
||||||
lib.linkSystemLibraryName("dxgi");
|
|
||||||
lib.linkSystemLibraryName("dxguid");
|
|
||||||
|
|
||||||
inline for ([_][]const u8{
|
inline for ([_][]const u8{
|
||||||
"src/dawn/mingw_helpers.cpp",
|
"src/dawn/mingw_helpers.cpp",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
|
|
@ -828,13 +794,6 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (options.metal.?) {
|
if (options.metal.?) {
|
||||||
lib.linkFramework("Metal");
|
|
||||||
lib.linkFramework("CoreGraphics");
|
|
||||||
lib.linkFramework("Foundation");
|
|
||||||
lib.linkFramework("IOKit");
|
|
||||||
lib.linkFramework("IOSurface");
|
|
||||||
lib.linkFramework("QuartzCore");
|
|
||||||
|
|
||||||
try appendLangScannedSources(b, lib, .{
|
try appendLangScannedSources(b, lib, .{
|
||||||
.objc = true,
|
.objc = true,
|
||||||
.rel_dirs = &.{
|
.rel_dirs = &.{
|
||||||
|
|
@ -848,7 +807,6 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
|
|
||||||
const tag = step.target_info.target.os.tag;
|
const tag = step.target_info.target.os.tag;
|
||||||
if (isLinuxDesktopLike(tag)) {
|
if (isLinuxDesktopLike(tag)) {
|
||||||
lib.linkSystemLibraryName("X11");
|
|
||||||
inline for ([_][]const u8{
|
inline for ([_][]const u8{
|
||||||
"src/dawn/native/XlibXcbFunctions.cpp",
|
"src/dawn/native/XlibXcbFunctions.cpp",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
|
|
@ -1013,19 +971,21 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn linkLibTintDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||||
|
_ = options;
|
||||||
|
step.linkLibCpp();
|
||||||
|
deps.system_sdk.include(b, step, .{});
|
||||||
|
}
|
||||||
|
|
||||||
// Builds tint sources; derived from src/tint/BUILD.gn
|
// Builds tint sources; derived from src/tint/BUILD.gn
|
||||||
fn buildLibTint(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn buildLibTint(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
const lib = if (!options.separate_libs) step else b.addStaticLibrary(.{
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
.name = "tint",
|
||||||
.name = "tint",
|
.target = step.target,
|
||||||
.target = step.target,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
});
|
||||||
});
|
if (options.install_libs) b.installArtifact(lib);
|
||||||
separate_lib.linkLibCpp();
|
linkLibTintDependencies(b, lib, options);
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
|
|
||||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
|
|
@ -1178,19 +1138,21 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn linkLibSPIRVToolsDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||||
|
_ = options;
|
||||||
|
step.linkLibCpp();
|
||||||
|
deps.system_sdk.include(b, step, .{});
|
||||||
|
}
|
||||||
|
|
||||||
// Builds third_party/vulkan-deps/spirv-tools sources; derived from third_party/vulkan-deps/spirv-tools/src/BUILD.gn
|
// Builds third_party/vulkan-deps/spirv-tools sources; derived from third_party/vulkan-deps/spirv-tools/src/BUILD.gn
|
||||||
fn buildLibSPIRVTools(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn buildLibSPIRVTools(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
const lib = if (!options.separate_libs) step else b.addStaticLibrary(.{
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
.name = "spirv-tools",
|
||||||
.name = "spirv-tools",
|
.target = step.target,
|
||||||
.target = step.target,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
});
|
||||||
});
|
if (options.install_libs) b.installArtifact(lib);
|
||||||
separate_lib.linkLibCpp();
|
linkLibSPIRVToolsDependencies(b, lib, options);
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
|
|
||||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
|
|
@ -1242,6 +1204,18 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn linkLibAbseilCppDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||||
|
_ = options;
|
||||||
|
step.linkLibCpp();
|
||||||
|
deps.system_sdk.include(b, step, .{});
|
||||||
|
const target = step.target_info.target;
|
||||||
|
if (target.os.tag == .macos) {
|
||||||
|
step.linkSystemLibraryName("objc");
|
||||||
|
step.linkFramework("CoreFoundation");
|
||||||
|
}
|
||||||
|
if (target.os.tag == .windows) step.linkSystemLibraryName("bcrypt");
|
||||||
|
}
|
||||||
|
|
||||||
// Builds third_party/abseil sources; derived from:
|
// Builds third_party/abseil sources; derived from:
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
|
|
@ -1249,22 +1223,15 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
fn buildLibAbseilCpp(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn buildLibAbseilCpp(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
const lib = if (!options.separate_libs) step else b.addStaticLibrary(.{
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
.name = "abseil",
|
||||||
.name = "abseil-cpp-common",
|
.target = step.target,
|
||||||
.target = step.target,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
});
|
||||||
});
|
if (options.install_libs) b.installArtifact(lib);
|
||||||
separate_lib.linkLibCpp();
|
linkLibAbseilCppDependencies(b, lib, options);
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
deps.system_sdk.include(b, lib, .{});
|
|
||||||
|
|
||||||
const target = step.target_info.target;
|
const target = step.target_info.target;
|
||||||
if (target.os.tag == .macos) lib.linkFramework("CoreFoundation");
|
|
||||||
if (target.os.tag == .windows) lib.linkSystemLibraryName("bcrypt");
|
|
||||||
|
|
||||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
|
|
@ -1315,19 +1282,21 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn linkLibDawnWireDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||||
|
_ = options;
|
||||||
|
step.linkLibCpp();
|
||||||
|
deps.system_sdk.include(b, step, .{});
|
||||||
|
}
|
||||||
|
|
||||||
// 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: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn buildLibDawnWire(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
const lib = if (!options.separate_libs) step else b.addStaticLibrary(.{
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
.name = "dawn-wire",
|
||||||
.name = "dawn-wire",
|
.target = step.target,
|
||||||
.target = step.target,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
});
|
||||||
});
|
if (options.install_libs) b.installArtifact(lib);
|
||||||
separate_lib.linkLibCpp();
|
linkLibDawnWireDependencies(b, lib, options);
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
|
|
||||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
|
|
@ -1353,26 +1322,26 @@ pub fn Sdk(comptime deps: anytype) type {
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn linkLibDxcompilerDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||||
|
step.linkLibCpp();
|
||||||
|
deps.system_sdk.include(b, step, .{});
|
||||||
|
if (options.d3d12.?) {
|
||||||
|
step.linkSystemLibraryName("oleaut32");
|
||||||
|
step.linkSystemLibraryName("ole32");
|
||||||
|
step.linkSystemLibraryName("dbghelp");
|
||||||
|
step.linkSystemLibraryName("dxguid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Buids dxcompiler sources; derived from libs/DirectXShaderCompiler/CMakeLists.txt
|
// Buids dxcompiler sources; derived from libs/DirectXShaderCompiler/CMakeLists.txt
|
||||||
fn buildLibDxcompiler(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
fn buildLibDxcompiler(b: *Build, step: *std.build.CompileStep, options: Options) !*std.build.CompileStep {
|
||||||
const lib = if (!options.separate_libs) step else blk: {
|
const lib = if (!options.separate_libs) step else b.addStaticLibrary(.{
|
||||||
const separate_lib = b.addStaticLibrary(.{
|
.name = "dxcompiler",
|
||||||
.name = "dxcompiler",
|
.target = step.target,
|
||||||
.target = step.target,
|
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
||||||
.optimize = if (options.debug) .Debug else .ReleaseFast,
|
});
|
||||||
});
|
if (options.install_libs) b.installArtifact(lib);
|
||||||
separate_lib.linkLibCpp();
|
linkLibDxcompilerDependencies(b, lib, options);
|
||||||
if (options.install_libs)
|
|
||||||
b.installArtifact(separate_lib);
|
|
||||||
break :blk separate_lib;
|
|
||||||
};
|
|
||||||
deps.system_sdk.include(b, lib, .{});
|
|
||||||
|
|
||||||
lib.linkSystemLibraryName("oleaut32");
|
|
||||||
lib.linkSystemLibraryName("ole32");
|
|
||||||
lib.linkSystemLibraryName("dbghelp");
|
|
||||||
lib.linkSystemLibraryName("dxguid");
|
|
||||||
lib.linkLibCpp();
|
|
||||||
|
|
||||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue