aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-12-19 16:01:15 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-01-01 17:51:21 -0700
commit3b36c4d0b30285ceb3576e621a4dc2b98a30d424 (patch)
tree544c73f6f88584e373a6851cdf47bf0da67c0ea9 /src/main.zig
parent056f04c1ff71fe6e4cf18d7b46bc821b12d874f1 (diff)
downloadzig-3b36c4d0b30285ceb3576e621a4dc2b98a30d424.tar.gz
zig-3b36c4d0b30285ceb3576e621a4dc2b98a30d424.zip
zig build: pass resolved_target to Module.create
it's now required to pass this for the root module
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main.zig b/src/main.zig
index 577a3d3c35..04cf9db12a 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -5234,11 +5234,15 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
gimmeMoreOfThoseSweetSweetFileDescriptors();
const target_query: std.Target.Query = .{};
- const target = resolveTargetQueryOrFatal(target_query);
+ const resolved_target: Package.Module.ResolvedTarget = .{
+ .result = resolveTargetQueryOrFatal(target_query),
+ .is_native_os = true,
+ .is_native_abi = true,
+ };
const exe_basename = try std.zig.binNameAlloc(arena, .{
.root_name = "build",
- .target = target,
+ .target = resolved_target.result,
.output_mode = .Exe,
});
const emit_bin: Compilation.EmitLoc = .{
@@ -5262,11 +5266,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
const config = try Compilation.Config.resolve(.{
.output_mode = .Exe,
- .resolved_target = .{
- .result = target,
- .is_native_os = true,
- .is_native_abi = true,
- },
+ .resolved_target = resolved_target,
.have_zcu = true,
.emit_bin = true,
.is_test = false,
@@ -5277,7 +5277,9 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
.paths = main_mod_paths,
.fully_qualified_name = "root",
.cc_argv = &.{},
- .inherited = .{},
+ .inherited = .{
+ .resolved_target = resolved_target,
+ },
.global = config,
.parent = null,
.builtin_mod = null,