diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-06-11 20:10:15 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-06-11 20:10:15 +0200 |
| commit | 78d6f1c56aa3bca72c3f336b89626982631da2e7 (patch) | |
| tree | ec59467f38b6837cd4e9f938d8d12e95b3f50c89 /src/libs | |
| parent | 5e2b025f69ec0e811975c67b0eda5f11594225b9 (diff) | |
| download | zig-78d6f1c56aa3bca72c3f336b89626982631da2e7.tar.gz zig-78d6f1c56aa3bca72c3f336b89626982631da2e7.zip | |
mingw: Fix def file preprocessing.
This needs to actually set the target on the aro.Compilation so that we get the
expected target-specific preprocessor macros defined.
Diffstat (limited to 'src/libs')
| -rw-r--r-- | src/libs/mingw.zig | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/libs/mingw.zig b/src/libs/mingw.zig index ef6dfa6275..9454a9af25 100644 --- a/src/libs/mingw.zig +++ b/src/libs/mingw.zig @@ -295,18 +295,12 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { "o", &digest, final_def_basename, }); - const target_defines = switch (target.cpu.arch) { - .thumb => "#define DEF_ARM32\n", - .aarch64 => "#define DEF_ARM64\n", - .x86 => "#define DEF_I386\n", - .x86_64 => "#define DEF_X64\n", - else => unreachable, - }; - const aro = @import("aro"); var aro_comp = aro.Compilation.init(gpa, std.fs.cwd()); defer aro_comp.deinit(); + aro_comp.target = target; + const include_dir = try comp.dirs.zig_lib.join(arena, &.{ "libc", "mingw", "def-include" }); if (comp.verbose_cc) print: { @@ -321,7 +315,6 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { try aro_comp.include_dirs.append(gpa, include_dir); const builtin_macros = try aro_comp.generateBuiltinMacros(.include_system_defines); - const user_macros = try aro_comp.addSourceFromBuffer("<command line>", target_defines); const def_file_source = try aro_comp.addSourceFromPath(def_file_path); var pp = aro.Preprocessor.init(&aro_comp); @@ -329,7 +322,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { pp.linemarkers = .none; pp.preserve_whitespace = true; - try pp.preprocessSources(&.{ def_file_source, builtin_macros, user_macros }); + try pp.preprocessSources(&.{ def_file_source, builtin_macros }); for (aro_comp.diagnostics.list.items) |diagnostic| { if (diagnostic.kind == .@"fatal error" or diagnostic.kind == .@"error") { |
