build: move cross-compilation shim into nats-c.build.zig
It makes more sense for it to be here. I'm really not sure why I put it in the main build in the first place.
This commit is contained in:
parent
fbb45f1567
commit
b78033f818
10
build.zig
10
build.zig
@ -19,20 +19,10 @@ pub fn build(b: *std.Build) void {
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const tinfo = nats.target_info.target;
|
||||
|
||||
const nats_c = nats_build.nats_c_lib(
|
||||
b,
|
||||
.{ .name = "nats-c", .target = target, .optimize = optimize },
|
||||
);
|
||||
switch (tinfo.os.tag) {
|
||||
.windows => {
|
||||
if (tinfo.abi != .msvc) {
|
||||
nats_c.addCSourceFiles(&.{"src/win-crosshack.c"}, &.{"-fno-sanitize=undefined"});
|
||||
}
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
|
||||
nats.linkLibrary(nats_c);
|
||||
b.installArtifact(nats);
|
||||
|
@ -28,9 +28,13 @@ pub fn nats_c_lib(
|
||||
// lib.addIncludePath(.{ .path = nats_src_prefix ++ "stan" });
|
||||
// lib.addCSourceFiles(&streaming_sources, &.{"-fno-sanitize=undefined"});
|
||||
|
||||
switch (lib.target_info.target.os.tag) {
|
||||
const tinfo = lib.target_info.target;
|
||||
switch (tinfo.os.tag) {
|
||||
.windows => {
|
||||
lib.addCSourceFiles(&win_sources, &.{"-fno-sanitize=undefined"});
|
||||
if (tinfo.abi != .msvc) {
|
||||
lib.addCSourceFiles(&.{"src/win-crosshack.c"}, &.{"-fno-sanitize=undefined"});
|
||||
}
|
||||
lib.defineCMacro("_WIN32", null);
|
||||
lib.linkSystemLibrary("Ws2_32");
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user