| ... | @@ -112,6 +112,11 @@ pub fn build(b: *Builder) !void { | ... | @@ -112,6 +112,11 @@ pub fn build(b: *Builder) !void { |
| 112 | b.default_step.dependOn(&exe.step); | 112 | b.default_step.dependOn(&exe.step); |
| 113 | exe.single_threaded = single_threaded; | 113 | exe.single_threaded = single_threaded; |
| 114 | | 114 | |
| | 115 | if (target.isWindows() and target.getAbi() == .gnu) { |
| | 116 | // LTO is currently broken on mingw, this can be removed when it's fixed. |
| | 117 | exe.want_lto = false; |
| | 118 | } |
| | 119 | |
| 115 | const exe_options = b.addOptions(); | 120 | const exe_options = b.addOptions(); |
| 116 | exe.addOptions("build_options", exe_options); | 121 | exe.addOptions("build_options", exe_options); |
| 117 | | 122 | |
| ... | @@ -239,12 +244,24 @@ pub fn build(b: *Builder) !void { | ... | @@ -239,12 +244,24 @@ pub fn build(b: *Builder) !void { |
| 239 | b.allocator, | 244 | b.allocator, |
| 240 | &[_][]const u8{ tracy_path, "TracyClient.cpp" }, | 245 | &[_][]const u8{ tracy_path, "TracyClient.cpp" }, |
| 241 | ) catch unreachable; | 246 | ) catch unreachable; |
| | 247 | |
| | 248 | // On mingw, we need to opt into windows 7+ to get some features required by tracy. |
| | 249 | const tracy_c_flags: []const []const u8 = if (target.isWindows() and target.getAbi() == .gnu) |
| | 250 | &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined", "-D_WIN32_WINNT=0x601" } |
| | 251 | else |
| | 252 | &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }; |
| | 253 | |
| 242 | exe.addIncludeDir(tracy_path); | 254 | exe.addIncludeDir(tracy_path); |
| 243 | exe.addCSourceFile(client_cpp, &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }); | 255 | exe.addCSourceFile(client_cpp, tracy_c_flags); |
| 244 | if (!enable_llvm) { | 256 | if (!enable_llvm) { |
| 245 | exe.linkSystemLibraryName("c++"); | 257 | exe.linkSystemLibraryName("c++"); |
| 246 | } | 258 | } |
| 247 | exe.linkLibC(); | 259 | exe.linkLibC(); |
| | 260 | |
| | 261 | if (target.isWindows()) { |
| | 262 | exe.linkSystemLibrary("dbghelp"); |
| | 263 | exe.linkSystemLibrary("ws2_32"); |
| | 264 | } |
| 248 | } | 265 | } |
| 249 | | 266 | |
| 250 | const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter"); | 267 | const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter"); |