std.Build.Step.TranslateC: propagate target, optimize, link_libc to created module

This commit is contained in:
mlugg 2024-08-20 21:04:42 +01:00
parent 4f437e4d24
commit a0b03d7fff
No known key found for this signature in database
GPG Key ID: 3F5B7DCCBF4AF02E

View File

@ -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,
});
}