From 105db13536b4dc2affe130cb8d2eee6c97c89bcd Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 1 Feb 2024 15:44:44 -0700 Subject: std.Build: implement --host-target, --host-cpu, --host-dynamic-linker This also makes a long-overdue change of extracting common state from Build into a shared Graph object. Getting the semantics right for these flags turned out to be quite tricky. In the end it works like this: * The override only happens when the target is fully native, with no additional query parameters, such as versions or CPU features added. * The override affects the resolved Target but leaves the original Query unmodified. * The "is native?" detection logic operates on the original, unmodified query. This makes it possible to provide invalid host target information, causing confusing errors to occur. Don't do that. There are some minor breaking changes to std.Build API such as the fact that `b.zig_exe` is now moved to `b.graph.zig_exe`, as well as a handful of other similar flags. --- test/src/Cases.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/src/Cases.zig') diff --git a/test/src/Cases.zig b/test/src/Cases.zig index 041d537625..614cf690a9 100644 --- a/test/src/Cases.zig +++ b/test/src/Cases.zig @@ -562,7 +562,7 @@ pub fn lowerToBuildSteps( run.setName(incr_case.base_path); run.addArgs(&.{ case_base_path_with_dir, - b.zig_exe, + b.graph.zig_exe, }); run.expectStdOutEqual(""); parent_step.dependOn(&run.step); @@ -653,7 +653,7 @@ pub fn lowerToBuildSteps( break :no_exec; } const run_c = b.addSystemCommand(&.{ - b.zig_exe, + b.graph.zig_exe, "run", "-cflags", "-Ilib", -- cgit v1.2.3