| ... | @@ -49,11 +49,6 @@ pub fn build(b: *Builder) !void { | ... | @@ -49,11 +49,6 @@ pub fn build(b: *Builder) !void { |
| 49 | | 49 | |
| 50 | const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"}); | 50 | const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"}); |
| 51 | | 51 | |
| 52 | var exe = b.addExecutable("zig", "src-self-hosted/main.zig"); | | |
| 53 | exe.setBuildMode(mode); | | |
| 54 | test_step.dependOn(&exe.step); | | |
| 55 | b.default_step.dependOn(&exe.step); | | |
| 56 | | | |
| 57 | const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false; | 52 | const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false; |
| 58 | const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release; | 53 | const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release; |
| 59 | const skip_release_fast = b.option(bool, "skip-release-fast", "Main test suite skips release-fast builds") orelse skip_release; | 54 | const skip_release_fast = b.option(bool, "skip-release-fast", "Main test suite skips release-fast builds") orelse skip_release; |
| ... | @@ -63,29 +58,37 @@ pub fn build(b: *Builder) !void { | ... | @@ -63,29 +58,37 @@ pub fn build(b: *Builder) !void { |
| 63 | | 58 | |
| 64 | const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; | 59 | const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; |
| 65 | const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse false; | 60 | const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse false; |
| 66 | if (enable_llvm) { | | |
| 67 | var ctx = parseConfigH(b, config_h_text); | | |
| 68 | ctx.llvm = try findLLVM(b, ctx.llvm_config_exe); | | |
| 69 | | 61 | |
| 70 | try configureStage2(b, exe, ctx); | | |
| 71 | } | | |
| 72 | if (!only_install_lib_files) { | 62 | if (!only_install_lib_files) { |
| 73 | exe.install(); | 63 | var exe = b.addExecutable("zig", "src-self-hosted/main.zig"); |
| 74 | } | 64 | exe.setBuildMode(mode); |
| 75 | const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source"); | 65 | test_step.dependOn(&exe.step); |
| 76 | const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse false; | 66 | b.default_step.dependOn(&exe.step); |
| 77 | if (link_libc) exe.linkLibC(); | | |
| 78 | | 67 | |
| 79 | exe.addBuildOption(bool, "enable_tracy", tracy != null); | 68 | if (enable_llvm) { |
| 80 | if (tracy) |tracy_path| { | 69 | var ctx = parseConfigH(b, config_h_text); |
| 81 | const client_cpp = fs.path.join( | 70 | ctx.llvm = try findLLVM(b, ctx.llvm_config_exe); |
| 82 | b.allocator, | 71 | |
| 83 | &[_][]const u8{ tracy_path, "TracyClient.cpp" }, | 72 | try configureStage2(b, exe, ctx); |
| 84 | ) catch unreachable; | 73 | } |
| 85 | exe.addIncludeDir(tracy_path); | 74 | if (!only_install_lib_files) { |
| 86 | exe.addCSourceFile(client_cpp, &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }); | 75 | exe.install(); |
| 87 | exe.linkSystemLibraryName("c++"); | 76 | } |
| 88 | exe.linkLibC(); | 77 | const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source"); |
| | 78 | const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse false; |
| | 79 | if (link_libc) exe.linkLibC(); |
| | 80 | |
| | 81 | exe.addBuildOption(bool, "enable_tracy", tracy != null); |
| | 82 | if (tracy) |tracy_path| { |
| | 83 | const client_cpp = fs.path.join( |
| | 84 | b.allocator, |
| | 85 | &[_][]const u8{ tracy_path, "TracyClient.cpp" }, |
| | 86 | ) catch unreachable; |
| | 87 | exe.addIncludeDir(tracy_path); |
| | 88 | exe.addCSourceFile(client_cpp, &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }); |
| | 89 | exe.linkSystemLibraryName("c++"); |
| | 90 | exe.linkLibC(); |
| | 91 | } |
| 89 | } | 92 | } |
| 90 | | 93 | |
| 91 | b.installDirectory(InstallDirectoryOptions{ | 94 | b.installDirectory(InstallDirectoryOptions{ |