authorgravatar for dasimmet@gmail.comTobias Simetsreiter <dasimmet@gmail.com> 2024-01-21 22:54:01+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2024-01-26 15:25:52+02:00
log20abf1394aef44eb1882e801f1d729fcff452db3
treee552507aab33a5197c68083627a9cd28cde203f8
parentb36dd55af5fa0e8e0a464440a7e6f2821f67c590

align naming and fix module creation from TranslateC


4 files changed, 8 insertions(+), 8 deletions(-)

lib/std/Build/Step/TranslateC.zig+4-4
......@@ -19,7 +19,7 @@ link_libc: bool,
1919use_clang: bool,
2020
2121pub const Options = struct {
22 source_file: std.Build.LazyPath,
22 root_source_file: std.Build.LazyPath,
2323 target: std.Build.ResolvedTarget,
2424 optimize: std.builtin.OptimizeMode,
2525 link_libc: bool = true,
......@@ -28,7 +28,7 @@ pub const Options = struct {
2828
2929pub fn create(owner: *std.Build, options: Options) *TranslateC {
3030 const self = owner.allocator.create(TranslateC) catch @panic("OOM");
31 const source = options.source_file.dupe(owner);
31 const source = options.root_source_file.dupe(owner);
3232 self.* = TranslateC{
3333 .step = Step.init(.{
3434 .id = .translate_c,
......@@ -79,7 +79,7 @@ pub fn addExecutable(self: *TranslateC, options: AddExecutableOptions) *Step.Com
7979/// `createModule` can be used instead to create a private module.
8080pub fn addModule(self: *TranslateC, name: []const u8) *std.Build.Module {
8181 return self.step.owner.addModule(name, .{
82 .source_file = self.getOutput(),
82 .root_source_file = self.getOutput(),
8383 });
8484}
8585
......@@ -92,7 +92,7 @@ pub fn createModule(self: *TranslateC) *std.Build.Module {
9292
9393 module.* = .{
9494 .builder = b,
95 .source_file = self.getOutput(),
95 .root_source_file = self.getOutput(),
9696 .dependencies = std.StringArrayHashMap(*std.Build.Module).init(b.allocator),
9797 };
9898 return module;
test/src/Cases.zig+2-2
......@@ -702,7 +702,7 @@ pub fn lowerToBuildSteps(
702702 const file_source = write_src.add("tmp.c", case.input);
703703
704704 const translate_c = b.addTranslateC(.{
705 .source_file = file_source,
705 .root_source_file = file_source,
706706 .optimize = .Debug,
707707 .target = case.target,
708708 .link_libc = case.link_libc,
......@@ -729,7 +729,7 @@ pub fn lowerToBuildSteps(
729729 const file_source = write_src.add("tmp.c", case.input);
730730
731731 const translate_c = b.addTranslateC(.{
732 .source_file = file_source,
732 .root_source_file = file_source,
733733 .optimize = .Debug,
734734 .target = case.target,
735735 .link_libc = case.link_libc,
test/src/run_translated_c.zig+1-1
......@@ -85,7 +85,7 @@ pub const RunTranslatedCContext = struct {
8585 _ = write_src.add(src_file.filename, src_file.source);
8686 }
8787 const translate_c = b.addTranslateC(.{
88 .source_file = write_src.files.items[0].getPath(),
88 .root_source_file = write_src.files.items[0].getPath(),
8989 .target = b.host,
9090 .optimize = .Debug,
9191 });
test/src/translate_c.zig+1-1
......@@ -107,7 +107,7 @@ pub const TranslateCContext = struct {
107107 }
108108
109109 const translate_c = b.addTranslateC(.{
110 .source_file = write_src.files.items[0].getPath(),
110 .root_source_file = write_src.files.items[0].getPath(),
111111 .target = b.resolveTargetQuery(case.target),
112112 .optimize = .Debug,
113113 });