aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-09-29 15:47:01 -0400
committerGitHub <noreply@github.com>2019-09-29 15:47:01 -0400
commitffaf37a7e7ab655265f10c2fd1060dc665520683 (patch)
tree7135e4e48fa809474c203928b21e1d9c510266f0 /src
parentec545859b988d78506f792b7cbea1582c7311d73 (diff)
parent339f62173594a06f9c47d9af078660fa63f42988 (diff)
downloadzig-ffaf37a7e7ab655265f10c2fd1060dc665520683.tar.gz
zig-ffaf37a7e7ab655265f10c2fd1060dc665520683.zip
Merge pull request #3343 from ziglang/windows-libc-um-dir
detect the windows um include directory
Diffstat (limited to 'src')
-rw-r--r--src/codegen.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index a1da6752b3..0e528069b1 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -8921,13 +8921,29 @@ static void detect_libc(CodeGen *g) {
}
}
bool want_sys_dir = !buf_eql_buf(&g->libc->include_dir, &g->libc->sys_include_dir);
- size_t dir_count = 1 + want_sys_dir;
- g->libc_include_dir_len = dir_count;
+ size_t want_um_and_shared_dirs = (g->zig_target->os == OsWindows) ? 2 : 0;
+ size_t dir_count = 1 + want_sys_dir + want_um_and_shared_dirs;
+ g->libc_include_dir_len = 0;
g->libc_include_dir_list = allocate<Buf*>(dir_count);
- g->libc_include_dir_list[0] = &g->libc->include_dir;
+
+ g->libc_include_dir_list[g->libc_include_dir_len] = &g->libc->include_dir;
+ g->libc_include_dir_len += 1;
+
if (want_sys_dir) {
- g->libc_include_dir_list[1] = &g->libc->sys_include_dir;
+ g->libc_include_dir_list[g->libc_include_dir_len] = &g->libc->sys_include_dir;
+ g->libc_include_dir_len += 1;
+ }
+
+ if (want_um_and_shared_dirs != 0) {
+ g->libc_include_dir_list[g->libc_include_dir_len] = buf_sprintf("%s" OS_SEP ".." OS_SEP "um",
+ buf_ptr(&g->libc->include_dir));
+ g->libc_include_dir_len += 1;
+
+ g->libc_include_dir_list[g->libc_include_dir_len] = buf_sprintf("%s" OS_SEP ".." OS_SEP "shared",
+ buf_ptr(&g->libc->include_dir));
+ g->libc_include_dir_len += 1;
}
+ assert(g->libc_include_dir_len == dir_count);
} else if ((g->out_type == OutTypeExe || (g->out_type == OutTypeLib && g->is_dynamic)) &&
!target_os_is_darwin(g->zig_target->os))
{