| ... | ... | @@ -660,34 +660,37 @@ pub fn lowerToBuildSteps( |
| 660 | 660 | file_sources.put(file.path, writefiles.add(file.path, file.src)) catch @panic("OOM"); |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | | const artifact = if (case.is_test) b.addTest(.{ |
| 663 | const mod = b.createModule(.{ |
| 664 | 664 | .root_source_file = root_source_file, |
| 665 | | .name = case.name, |
| 666 | 665 | .target = case.target, |
| 667 | 666 | .optimize = case.optimize_mode, |
| 667 | }); |
| 668 | if (case.link_libc) mod.link_libc = true; |
| 669 | if (case.pic) |pic| mod.pic = pic; |
| 670 | for (case.deps.items) |dep| { |
| 671 | mod.addAnonymousImport(dep.name, .{ |
| 672 | .root_source_file = file_sources.get(dep.path).?, |
| 673 | }); |
| 674 | } |
| 675 | |
| 676 | const artifact = if (case.is_test) b.addTest(.{ |
| 677 | .name = case.name, |
| 678 | .root_module = mod, |
| 668 | 679 | }) else switch (case.output_mode) { |
| 669 | 680 | .Obj => b.addObject(.{ |
| 670 | | .root_source_file = root_source_file, |
| 671 | 681 | .name = case.name, |
| 672 | | .target = case.target, |
| 673 | | .optimize = case.optimize_mode, |
| 682 | .root_module = mod, |
| 674 | 683 | }), |
| 675 | 684 | .Lib => b.addStaticLibrary(.{ |
| 676 | | .root_source_file = root_source_file, |
| 677 | 685 | .name = case.name, |
| 678 | | .target = case.target, |
| 679 | | .optimize = case.optimize_mode, |
| 686 | .root_module = mod, |
| 680 | 687 | }), |
| 681 | 688 | .Exe => b.addExecutable(.{ |
| 682 | | .root_source_file = root_source_file, |
| 683 | 689 | .name = case.name, |
| 684 | | .target = case.target, |
| 685 | | .optimize = case.optimize_mode, |
| 690 | .root_module = mod, |
| 686 | 691 | }), |
| 687 | 692 | }; |
| 688 | 693 | |
| 689 | | if (case.link_libc) artifact.linkLibC(); |
| 690 | | if (case.pic) |pic| artifact.root_module.pic = pic; |
| 691 | 694 | if (case.pie) |pie| artifact.pie = pie; |
| 692 | 695 | |
| 693 | 696 | switch (case.backend) { |
| ... | ... | @@ -701,12 +704,6 @@ pub fn lowerToBuildSteps( |
| 701 | 704 | }, |
| 702 | 705 | } |
| 703 | 706 | |
| 704 | | for (case.deps.items) |dep| { |
| 705 | | artifact.root_module.addAnonymousImport(dep.name, .{ |
| 706 | | .root_source_file = file_sources.get(dep.path).?, |
| 707 | | }); |
| 708 | | } |
| 709 | | |
| 710 | 707 | switch (update.case) { |
| 711 | 708 | .Compile => { |
| 712 | 709 | // Force the binary to be emitted if requested. |