aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 3bb4fe6511..292943a6e6 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -3359,6 +3359,61 @@ void find_libc_include_path(CodeGen *g) {
}
void find_libc_lib_path(CodeGen *g) {
+#ifdef ZIG_OS_WINDOWS
+ if (!g->msvc_lib_dir && g->zig_target.os == ZigLLVM_Win32) {
+ Buf *msvc_lib_dir;
+ if (g->zig_target.arch.arch == ZigLLVM_arm) {
+ msvc_lib_dir = buf_create_from_str("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\arm");
+ } else if (g->zig_target.arch.arch == ZigLLVM_x86_64) {
+ msvc_lib_dir = buf_create_from_str("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\amd64");
+ } else if (g->zig_target.arch.arch == ZigLLVM_x86) {
+ msvc_lib_dir = buf_create_from_str("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib");
+ } else {
+ zig_panic("unable to determine msvc lib path");
+ }
+ Buf *test_path = buf_alloc();
+ os_path_join(msvc_lib_dir, buf_create_from_str("vcruntime.lib"), test_path);
+ bool result;
+ int err;
+ if ((err = os_file_exists(test_path, &result))) {
+ result = false;
+ }
+ if (result) {
+ g->msvc_lib_dir = msvc_lib_dir;
+ } else {
+ zig_panic("Unable to determine msvc lib path.");
+ }
+ }
+
+ if (!g->kernel32_lib_dir && g->zig_target.os == ZigLLVM_Win32) {
+ Buf *kernel32_lib_dir;
+ if (g->zig_target.arch.arch == ZigLLVM_arm) {
+ kernel32_lib_dir = buf_create_from_str(
+ "C:\\Program Files (x86)\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\arm");
+ } else if (g->zig_target.arch.arch == ZigLLVM_x86_64) {
+ kernel32_lib_dir = buf_create_from_str(
+ "C:\\Program Files (x86)\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\x64");
+ } else if (g->zig_target.arch.arch == ZigLLVM_x86) {
+ kernel32_lib_dir = buf_create_from_str(
+ "C:\\Program Files (x86)\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\x86");
+ } else {
+ zig_panic("unable to determine kernel32 lib path");
+ }
+ Buf *test_path = buf_alloc();
+ os_path_join(kernel32_lib_dir, buf_create_from_str("kernel32.lib"), test_path);
+ bool result;
+ int err;
+ if ((err = os_file_exists(test_path, &result))) {
+ result = false;
+ }
+ if (result) {
+ g->kernel32_lib_dir = kernel32_lib_dir;
+ } else {
+ zig_panic("Unable to determine kernel32 lib path.");
+ }
+ }
+#endif
+
// later we can handle this better by reporting an error via the normal mechanism
if (!g->libc_lib_dir || buf_len(g->libc_lib_dir) == 0) {
zig_panic("Unable to determine libc lib path.");