Commit a0b03d7fff

mlugg <mlugg@mlugg.co.uk>
2024-08-20 22:04:42
std.Build.Step.TranslateC: propagate target, optimize, link_libc to created module
1 parent 4f437e4
Changed files (1)
lib
std
Build
lib/std/Build/Step/TranslateC.zig
@@ -29,7 +29,7 @@ pub const Options = struct {
 pub fn create(owner: *std.Build, options: Options) *TranslateC {
     const translate_c = owner.allocator.create(TranslateC) catch @panic("OOM");
     const source = options.root_source_file.dupe(owner);
-    translate_c.* = TranslateC{
+    translate_c.* = .{
         .step = Step.init(.{
             .id = base_id,
             .name = "translate-c",
@@ -42,7 +42,7 @@ pub fn create(owner: *std.Build, options: Options) *TranslateC {
         .out_basename = undefined,
         .target = options.target,
         .optimize = options.optimize,
-        .output_file = std.Build.GeneratedFile{ .step = &translate_c.step },
+        .output_file = .{ .step = &translate_c.step },
         .link_libc = options.link_libc,
         .use_clang = options.use_clang,
     };
@@ -89,6 +89,9 @@ pub fn addModule(translate_c: *TranslateC, name: []const u8) *std.Build.Module {
 pub fn createModule(translate_c: *TranslateC) *std.Build.Module {
     return translate_c.step.owner.createModule(.{
         .root_source_file = translate_c.getOutput(),
+        .target = translate_c.target,
+        .optimize = translate_c.optimize,
+        .link_libc = translate_c.link_libc,
     });
 }