build: fix zlib compilation on Windows with MSVC
Gate Z_HAVE_UNISTD_H behind a non-Windows check since unistd.h does not exist on Windows. Add _CRT_SECURE_NO_DEPRECATE and _CRT_NONSTDC_NO_DEPRECATE for MSVC to suppress deprecation errors for standard C functions that zlib uses. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>pull/11798/head
parent
d4a38c8661
commit
4df71bcad7
|
|
@ -32,8 +32,16 @@ pub fn build(b: *std.Build) !void {
|
|||
"-DHAVE_SYS_TYPES_H",
|
||||
"-DHAVE_STDINT_H",
|
||||
"-DHAVE_STDDEF_H",
|
||||
"-DZ_HAVE_UNISTD_H",
|
||||
});
|
||||
if (target.result.os.tag != .windows) {
|
||||
try flags.append(b.allocator, "-DZ_HAVE_UNISTD_H");
|
||||
}
|
||||
if (target.result.abi == .msvc) {
|
||||
try flags.appendSlice(b.allocator, &.{
|
||||
"-D_CRT_SECURE_NO_DEPRECATE",
|
||||
"-D_CRT_NONSTDC_NO_DEPRECATE",
|
||||
});
|
||||
}
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = srcs,
|
||||
|
|
|
|||
Loading…
Reference in New Issue