Skip to content

Commit 96ebd8b

Browse files
committedApr 17, 2018
fix windows not respecting --msvc-lib-dir, --kernel32-lib-dir
I believe this was a regression caused by 51a6ff1 closes #927
1 parent c7cb5c3 commit 96ebd8b

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed
 

‎src/analyze.cpp

+18-12
Original file line numberDiff line numberDiff line change
@@ -4421,24 +4421,30 @@ void find_libc_lib_path(CodeGen *g) {
44214421
if (g->zig_target.os == OsWindows) {
44224422
ZigWindowsSDK *sdk = get_windows_sdk(g);
44234423

4424-
Buf* vc_lib_dir = buf_alloc();
4425-
if (os_get_win32_vcruntime_path(vc_lib_dir, g->zig_target.arch.arch)) {
4426-
zig_panic("Unable to determine vcruntime path.");
4424+
if (g->msvc_lib_dir == nullptr) {
4425+
Buf* vc_lib_dir = buf_alloc();
4426+
if (os_get_win32_vcruntime_path(vc_lib_dir, g->zig_target.arch.arch)) {
4427+
zig_panic("Unable to determine vcruntime path.");
4428+
}
4429+
g->msvc_lib_dir = vc_lib_dir;
44274430
}
44284431

4429-
Buf* ucrt_lib_path = buf_alloc();
4430-
if (os_get_win32_ucrt_lib_path(sdk, ucrt_lib_path, g->zig_target.arch.arch)) {
4431-
zig_panic("Unable to determine ucrt path.");
4432+
if (g->libc_lib_dir == nullptr) {
4433+
Buf* ucrt_lib_path = buf_alloc();
4434+
if (os_get_win32_ucrt_lib_path(sdk, ucrt_lib_path, g->zig_target.arch.arch)) {
4435+
zig_panic("Unable to determine ucrt path.");
4436+
}
4437+
g->libc_lib_dir = ucrt_lib_path;
44324438
}
44334439

4434-
Buf* kern_lib_path = buf_alloc();
4435-
if (os_get_win32_kern32_path(sdk, kern_lib_path, g->zig_target.arch.arch)) {
4436-
zig_panic("Unable to determine kernel32 path.");
4440+
if (g->kernel32_lib_dir == nullptr) {
4441+
Buf* kern_lib_path = buf_alloc();
4442+
if (os_get_win32_kern32_path(sdk, kern_lib_path, g->zig_target.arch.arch)) {
4443+
zig_panic("Unable to determine kernel32 path.");
4444+
}
4445+
g->kernel32_lib_dir = kern_lib_path;
44374446
}
44384447

4439-
g->msvc_lib_dir = vc_lib_dir;
4440-
g->libc_lib_dir = ucrt_lib_path;
4441-
g->kernel32_lib_dir = kern_lib_path;
44424448
} else if (g->zig_target.os == OsLinux) {
44434449
g->libc_lib_dir = get_linux_libc_lib_path("crt1.o");
44444450
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.