Skip to content

Commit

Permalink
update to latest zig version
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
emidoots committed Dec 31, 2024
1 parent 85adf62 commit 9e6cced
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn build(b: *Build) !void {
const cache_dir = binaryCacheDirPath(b, target.result, optimize) catch |err| std.debug.panic("unable to construct binary cache dir path: {}", .{err});
linkage.addLibraryPath(.{ .cwd_relative = cache_dir });
linkage.linkSystemLibrary("machdxcompiler");
linkMachDxcDependenciesModule(&linkage.root_module);
linkMachDxcDependenciesModule(linkage.root_module);

// not entirely sure this will work
if (build_shared) {
Expand Down Expand Up @@ -68,7 +68,7 @@ pub fn build(b: *Build) !void {
"-fms-extensions", // __uuidof and friends (on non-windows targets)
},
});
if (target.result.os.tag != .windows) lib.defineCMacro("HAVE_DLFCN_H", "1");
if (target.result.os.tag != .windows) lib.root_module.addCMacro("HAVE_DLFCN_H", "1");

// The Windows 10 SDK winrt/wrl/client.h is incompatible with clang due to #pragma pack usages
// (unclear why), so instead we use the wrl/client.h headers from https://github.com/ziglang/zig/tree/225fe6ddbfae016395762850e0cd5c51f9e7751c/lib/libc/include/any-windows-any
Expand Down Expand Up @@ -152,7 +152,7 @@ pub fn build(b: *Build) !void {

// Link lazy-loaded SPIRV-Tools
if (build_spirv) {
lib.defineCMacro("ENABLE_SPIRV_CODEGEN", "");
lib.root_module.addCMacro("ENABLE_SPIRV_CODEGEN", "");

addSPIRVIncludes(b, lib);

Expand All @@ -177,18 +177,18 @@ pub fn build(b: *Build) !void {
.flags = cflags.items,
});

if (target.result.abi != .msvc) lib.defineCMacro("NDEBUG", ""); // disable assertions
if (target.result.abi != .msvc) lib.root_module.addCMacro("NDEBUG", ""); // disable assertions
if (target.result.os.tag == .windows) {
lib.defineCMacro("LLVM_ON_WIN32", "1");
if (target.result.abi == .msvc) lib.defineCMacro("CINDEX_LINKAGE", "");
lib.root_module.addCMacro("LLVM_ON_WIN32", "1");
if (target.result.abi == .msvc) lib.root_module.addCMacro("CINDEX_LINKAGE", "");
lib.linkSystemLibrary("version");
} else {
lib.defineCMacro("LLVM_ON_UNIX", "1");
lib.root_module.addCMacro("LLVM_ON_UNIX", "1");
}

if (build_shared) {
lib.defineCMacro("MACH_DXC_C_SHARED_LIBRARY", "");
lib.defineCMacro("MACH_DXC_C_IMPLEMENTATION", "");
lib.root_module.addCMacro("MACH_DXC_C_SHARED_LIBRARY", "");
lib.root_module.addCMacro("MACH_DXC_C_IMPLEMENTATION", "");
}

linkMachDxcDependencies(lib);
Expand All @@ -212,9 +212,9 @@ pub fn build(b: *Build) !void {
.file = b.path(prefix ++ "/tools/clang/tools/dxc/dxcmain.cpp"),
.flags = &.{"-std=c++17"},
});
dxc_exe.defineCMacro("NDEBUG", ""); // disable assertions
dxc_exe.root_module.addCMacro("NDEBUG", ""); // disable assertions

if (target.result.os.tag != .windows) dxc_exe.defineCMacro("HAVE_DLFCN_H", "1");
if (target.result.os.tag != .windows) dxc_exe.root_module.addCMacro("HAVE_DLFCN_H", "1");
dxc_exe.addIncludePath(b.path(prefix ++ "/tools/clang/tools"));
dxc_exe.addIncludePath(b.path(prefix ++ "/include"));
addConfigHeaders(b, dxc_exe);
Expand Down

0 comments on commit 9e6cced

Please sign in to comment.