| ... | @@ -4691,6 +4691,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -4691,6 +4691,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4691 | var verbose_llvm_cpu_features = false; | 4691 | var verbose_llvm_cpu_features = false; |
| 4692 | var fetch_only = false; | 4692 | var fetch_only = false; |
| 4693 | var system_pkg_dir_path: ?[]const u8 = null; | 4693 | var system_pkg_dir_path: ?[]const u8 = null; |
| | 4694 | var debug_target: ?[]const u8 = null; |
| 4694 | | 4695 | |
| 4695 | const argv_index_exe = child_argv.items.len; | 4696 | const argv_index_exe = child_argv.items.len; |
| 4696 | _ = try child_argv.addOne(); | 4697 | _ = try child_argv.addOne(); |
| ... | @@ -4799,6 +4800,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -4799,6 +4800,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4799 | } else { | 4800 | } else { |
| 4800 | warn("Zig was compiled without debug extensions. --debug-compile-errors has no effect.", .{}); | 4801 | warn("Zig was compiled without debug extensions. --debug-compile-errors has no effect.", .{}); |
| 4801 | } | 4802 | } |
| | 4803 | } else if (mem.eql(u8, arg, "--debug-target")) { |
| | 4804 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| | 4805 | i += 1; |
| | 4806 | if (build_options.enable_debug_extensions) { |
| | 4807 | debug_target = args[i]; |
| | 4808 | } else { |
| | 4809 | warn("Zig was compiled without debug extensions. --debug-target has no effect.", .{}); |
| | 4810 | } |
| 4802 | } else if (mem.eql(u8, arg, "--verbose-link")) { | 4811 | } else if (mem.eql(u8, arg, "--verbose-link")) { |
| 4803 | verbose_link = true; | 4812 | verbose_link = true; |
| 4804 | } else if (mem.eql(u8, arg, "--verbose-cc")) { | 4813 | } else if (mem.eql(u8, arg, "--verbose-cc")) { |
| ... | @@ -4857,11 +4866,27 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -4857,11 +4866,27 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4857 | }); | 4866 | }); |
| 4858 | defer root_prog_node.end(); | 4867 | defer root_prog_node.end(); |
| 4859 | | 4868 | |
| 4860 | const target_query: std.Target.Query = .{}; | 4869 | // Normally the build runner is compiled for the host target but here is |
| 4861 | const resolved_target: Package.Module.ResolvedTarget = .{ | 4870 | // some code to help when debugging edits to the build runner so that you |
| 4862 | .result = std.zig.resolveTargetQueryOrFatal(target_query), | 4871 | // can make sure it compiles successfully on other targets. |
| 4863 | .is_native_os = true, | 4872 | const resolved_target: Package.Module.ResolvedTarget = t: { |
| 4864 | .is_native_abi = true, | 4873 | if (build_options.enable_debug_extensions) { |
| | 4874 | if (debug_target) |triple| { |
| | 4875 | const target_query = try std.Target.Query.parse(.{ |
| | 4876 | .arch_os_abi = triple, |
| | 4877 | }); |
| | 4878 | break :t .{ |
| | 4879 | .result = std.zig.resolveTargetQueryOrFatal(target_query), |
| | 4880 | .is_native_os = false, |
| | 4881 | .is_native_abi = false, |
| | 4882 | }; |
| | 4883 | } |
| | 4884 | } |
| | 4885 | break :t .{ |
| | 4886 | .result = std.zig.resolveTargetQueryOrFatal(.{}), |
| | 4887 | .is_native_os = true, |
| | 4888 | .is_native_abi = true, |
| | 4889 | }; |
| 4865 | }; | 4890 | }; |
| 4866 | | 4891 | |
| 4867 | const exe_basename = try std.zig.binNameAlloc(arena, .{ | 4892 | const exe_basename = try std.zig.binNameAlloc(arena, .{ |