From c8e967f43dcf8e7cbf1efd45530d674ffd3fe6d8 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 29 Sep 2019 14:04:23 -0400 Subject: detect the windows um include directory --- src/codegen.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index a1da6752b3..030a18115a 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8921,13 +8921,25 @@ 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; + bool want_um_dir = (g->zig_target->os == OsWindows); + size_t dir_count = 1 + want_sys_dir + want_um_dir; + g->libc_include_dir_len = 0; g->libc_include_dir_list = allocate(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_dir) { + 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; } + 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)) { -- cgit v1.2.3 From 339f62173594a06f9c47d9af078660fa63f42988 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 29 Sep 2019 14:12:06 -0400 Subject: detect the shared windows include dir as well --- src/codegen.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 030a18115a..0e528069b1 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8921,8 +8921,8 @@ static void detect_libc(CodeGen *g) { } } bool want_sys_dir = !buf_eql_buf(&g->libc->include_dir, &g->libc->sys_include_dir); - bool want_um_dir = (g->zig_target->os == OsWindows); - size_t dir_count = 1 + want_sys_dir + want_um_dir; + 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(dir_count); @@ -8934,10 +8934,14 @@ static void detect_libc(CodeGen *g) { g->libc_include_dir_len += 1; } - if (want_um_dir) { + 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)) && -- cgit v1.2.3