diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-06-18 19:03:41 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-06-18 21:55:37 -0400 |
| commit | c9a0ec25e0baae7f128a8f7efe4d308af7fad753 (patch) | |
| tree | 71892b6263beda3d803b02c724733aba98cb39ef /build.zig | |
| parent | 355319fb674073234ea2f356a310577fb982f72b (diff) | |
| download | zig-c9a0ec25e0baae7f128a8f7efe4d308af7fad753.tar.gz zig-c9a0ec25e0baae7f128a8f7efe4d308af7fad753.zip | |
self-hosted: add Tracy integration
This tool helps give an intuitive picture of performance. This will help
us understand where to improve the code.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -72,9 +72,22 @@ pub fn build(b: *Builder) !void { if (!only_install_lib_files) { exe.install(); } + const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source"); const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse false; if (link_libc) exe.linkLibC(); + exe.addBuildOption(bool, "enable_tracy", tracy != null); + if (tracy) |tracy_path| { + const client_cpp = fs.path.join( + b.allocator, + &[_][]const u8{ tracy_path, "TracyClient.cpp" }, + ) catch unreachable; + exe.addIncludeDir(tracy_path); + exe.addCSourceFile(client_cpp, &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }); + exe.linkSystemLibraryName("c++"); + exe.linkLibC(); + } + b.installDirectory(InstallDirectoryOptions{ .source_dir = "lib", .install_dir = .Lib, |
