From 9e6cced337c3a304a5f5a7acaf0b1d4d9e136953 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Mon, 30 Dec 2024 17:01:25 -0700 Subject: [PATCH] update to latest zig version Signed-off-by: Stephen Gutekanst --- build.zig | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/build.zig b/build.zig index 6c2d45d..9697e13 100644 --- a/build.zig +++ b/build.zig @@ -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) { @@ -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 @@ -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); @@ -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); @@ -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);