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:
2023-08-15 00:04:44 -07:00
parent fbb45f1567
commit b78033f818
2 changed files with 5 additions and 11 deletions

View File

@@ -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");
},