| ... | ... | @@ -508,11 +508,9 @@ pub fn build(b: *std.Build) !void { |
| 508 | 508 | test_step.dependOn(unit_tests_step); |
| 509 | 509 | |
| 510 | 510 | const unit_tests = b.addTest(.{ |
| 511 | | .root_module = b.createModule(.{ |
| 512 | | .root_source_file = b.path("src/main.zig"), |
| 511 | .root_module = addCompilerMod(b, .{ |
| 513 | 512 | .optimize = optimize, |
| 514 | 513 | .target = target, |
| 515 | | .link_libc = link_libc, |
| 516 | 514 | .single_threaded = single_threaded, |
| 517 | 515 | }), |
| 518 | 516 | .filters = test_filters, |
| ... | ... | @@ -520,6 +518,9 @@ pub fn build(b: *std.Build) !void { |
| 520 | 518 | .use_lld = use_llvm, |
| 521 | 519 | .zig_lib_dir = b.path("lib"), |
| 522 | 520 | }); |
| 521 | if (link_libc) { |
| 522 | unit_tests.root_module.link_libc = true; |
| 523 | } |
| 523 | 524 | unit_tests.root_module.addOptions("build_options", exe_options); |
| 524 | 525 | unit_tests_step.dependOn(&b.addRunArtifact(unit_tests).step); |
| 525 | 526 | |
| ... | ... | @@ -650,7 +651,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { |
| 650 | 651 | update_zig1_step.dependOn(&copy_zig_h.step); |
| 651 | 652 | } |
| 652 | 653 | |
| 653 | | const AddCompilerStepOptions = struct { |
| 654 | const AddCompilerModOptions = struct { |
| 654 | 655 | optimize: std.builtin.OptimizeMode, |
| 655 | 656 | target: std.Build.ResolvedTarget, |
| 656 | 657 | strip: ?bool = null, |
| ... | ... | @@ -659,7 +660,7 @@ const AddCompilerStepOptions = struct { |
| 659 | 660 | single_threaded: ?bool = null, |
| 660 | 661 | }; |
| 661 | 662 | |
| 662 | | fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.Step.Compile { |
| 663 | fn addCompilerMod(b: *std.Build, options: AddCompilerModOptions) *std.Build.Module { |
| 663 | 664 | const compiler_mod = b.createModule(.{ |
| 664 | 665 | .root_source_file = b.path("src/main.zig"), |
| 665 | 666 | .target = options.target, |
| ... | ... | @@ -682,10 +683,14 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.St |
| 682 | 683 | compiler_mod.addImport("aro", aro_mod); |
| 683 | 684 | compiler_mod.addImport("aro_translate_c", aro_translate_c_mod); |
| 684 | 685 | |
| 686 | return compiler_mod; |
| 687 | } |
| 688 | |
| 689 | fn addCompilerStep(b: *std.Build, options: AddCompilerModOptions) *std.Build.Step.Compile { |
| 685 | 690 | const exe = b.addExecutable(.{ |
| 686 | 691 | .name = "zig", |
| 687 | 692 | .max_rss = 7_800_000_000, |
| 688 | | .root_module = compiler_mod, |
| 693 | .root_module = addCompilerMod(b, options), |
| 689 | 694 | }); |
| 690 | 695 | exe.stack_size = stack_size; |
| 691 | 696 | |