build: don't include sentry on windows

This commit is contained in:
Mitchell Hashimoto
2024-08-27 20:21:29 -07:00
parent 33e9bc14ef
commit 13f1752836
3 changed files with 12 additions and 3 deletions

View File

@ -1157,9 +1157,11 @@ fn addDeps(
step.linkLibrary(spirv_cross_dep.artifact("spirv_cross"));
try static_libs.append(spirv_cross_dep.artifact("spirv_cross").getEmittedBin());
if (target.result.os.tag != .windows) {
// Sentry
step.linkLibrary(sentry_dep.artifact("sentry"));
try static_libs.append(sentry_dep.artifact("sentry").getEmittedBin());
}
// Dynamic link
if (!config.static) {

View File

@ -58,6 +58,7 @@ pub fn build(b: *std.Build) !void {
"src/sentry_windows_dbghelp.c",
"src/path/sentry_path_windows.c",
"src/symbolizer/sentry_symbolizer_windows.c",
"src/unwinder/sentry_unwinder_dbghelp.c",
},
.flags = flags.items,
});

View File

@ -1,6 +1,7 @@
const std = @import("std");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const builtin = @import("builtin");
const build_config = @import("build_config.zig");
const sentry = @import("sentry");
const internal_os = @import("os/main.zig");
@ -16,6 +17,9 @@ const log = std.log.scoped(.sentry);
/// It is up to the user to grab the logs and manually send them to us
/// (or they own Sentry instance) if they want to.
pub fn init(gpa: Allocator) !void {
// Not supported on Windows currently, doesn't build.
if (comptime builtin.os.tag == .windows) return;
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const alloc = arena.allocator();
@ -58,6 +62,8 @@ pub fn init(gpa: Allocator) !void {
/// Process-wide deinitialization of our Sentry client. This ensures all
/// our data is flushed.
pub fn deinit() void {
if (comptime builtin.os.tag == .windows) return;
_ = sentry.c.sentry_close();
}