authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-29 15:47:01-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2019-09-29 15:47:01-04:00
logffaf37a7e7ab655265f10c2fd1060dc665520683
tree7135e4e48fa809474c203928b21e1d9c510266f0
parentec545859b988d78506f792b7cbea1582c7311d73
parent339f62173594a06f9c47d9af078660fa63f42988
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #3343 from ziglang/windows-libc-um-dir

detect the windows um include directory

1 files changed, 20 insertions(+), 4 deletions(-)

src/codegen.cpp+20-4
...@@ -8921,13 +8921,29 @@ static void detect_libc(CodeGen *g) {...@@ -8921,13 +8921,29 @@ static void detect_libc(CodeGen *g) {
8921 }8921 }
8922 }8922 }
8923 bool want_sys_dir = !buf_eql_buf(&g->libc->include_dir, &g->libc->sys_include_dir);8923 bool want_sys_dir = !buf_eql_buf(&g->libc->include_dir, &g->libc->sys_include_dir);
8924 size_t dir_count = 1 + want_sys_dir;8924 size_t want_um_and_shared_dirs = (g->zig_target->os == OsWindows) ? 2 : 0;
8925 g->libc_include_dir_len = dir_count;8925 size_t dir_count = 1 + want_sys_dir + want_um_and_shared_dirs;
8926 g->libc_include_dir_len = 0;
8926 g->libc_include_dir_list = allocate<Buf*>(dir_count);8927 g->libc_include_dir_list = allocate<Buf*>(dir_count);
8927 g->libc_include_dir_list[0] = &g->libc->include_dir;8928
8929 g->libc_include_dir_list[g->libc_include_dir_len] = &g->libc->include_dir;
8930 g->libc_include_dir_len += 1;
8931
8928 if (want_sys_dir) {8932 if (want_sys_dir) {
8929 g->libc_include_dir_list[1] = &g->libc->sys_include_dir;8933 g->libc_include_dir_list[g->libc_include_dir_len] = &g->libc->sys_include_dir;
8934 g->libc_include_dir_len += 1;
8935 }
8936
8937 if (want_um_and_shared_dirs != 0) {
8938 g->libc_include_dir_list[g->libc_include_dir_len] = buf_sprintf("%s" OS_SEP ".." OS_SEP "um",
8939 buf_ptr(&g->libc->include_dir));
8940 g->libc_include_dir_len += 1;
8941
8942 g->libc_include_dir_list[g->libc_include_dir_len] = buf_sprintf("%s" OS_SEP ".." OS_SEP "shared",
8943 buf_ptr(&g->libc->include_dir));
8944 g->libc_include_dir_len += 1;
8930 }8945 }
8946 assert(g->libc_include_dir_len == dir_count);
8931 } else if ((g->out_type == OutTypeExe || (g->out_type == OutTypeLib && g->is_dynamic)) &&8947 } else if ((g->out_type == OutTypeExe || (g->out_type == OutTypeLib && g->is_dynamic)) &&
8932 !target_os_is_darwin(g->zig_target->os))8948 !target_os_is_darwin(g->zig_target->os))
8933 {8949 {