| author | |
| committer | |
| log | abff1b688420eb30d98145d8bc48e7d08f259885 |
| tree | 72e03145e10a68565b6554790a963fccc48a6220 |
| parent | f7837f445e6ed51f1f68e5b1975550b06f51a52e |
8 files changed, 87 insertions(+), 66 deletions(-)
src/all_types.hpp+2-1| ... | @@ -1462,10 +1462,11 @@ struct CodeGen { | ... | @@ -1462,10 +1462,11 @@ struct CodeGen { |
| 1462 | bool have_winmain_crt_startup; | 1462 | bool have_winmain_crt_startup; |
| 1463 | bool have_dllmain_crt_startup; | 1463 | bool have_dllmain_crt_startup; |
| 1464 | bool have_pub_panic; | 1464 | bool have_pub_panic; |
| 1465 | ZigList<Buf*> libc_lib_dirs_list; | ||
| 1466 | Buf *libc_lib_dir; | 1465 | Buf *libc_lib_dir; |
| 1467 | Buf *libc_static_lib_dir; | 1466 | Buf *libc_static_lib_dir; |
| 1468 | Buf *libc_include_dir; | 1467 | Buf *libc_include_dir; |
| 1468 | Buf *msvc_lib_dir; | ||
| 1469 | Buf *kernel32_lib_dir; | ||
| 1469 | Buf *zig_lib_dir; | 1470 | Buf *zig_lib_dir; |
| 1470 | Buf *zig_std_dir; | 1471 | Buf *zig_std_dir; |
| 1471 | Buf *zig_c_headers_dir; | 1472 | Buf *zig_c_headers_dir; |
src/analyze.cpp+36-37| ... | @@ -3370,23 +3370,27 @@ bool handle_is_ptr(TypeTableEntry *type_entry) { | ... | @@ -3370,23 +3370,27 @@ bool handle_is_ptr(TypeTableEntry *type_entry) { |
| 3370 | zig_unreachable(); | 3370 | zig_unreachable(); |
| 3371 | } | 3371 | } |
| 3372 | 3372 | ||
| 3373 | static ZigWindowsSDK *get_windows_sdk(CodeGen *g) { | ||
| 3374 | if (g->win_sdk == nullptr) { | ||
| 3375 | if (os_find_windows_sdk(&g->win_sdk)) { | ||
| 3376 | zig_panic("Unable to determine Windows SDK path."); | ||
| 3377 | } | ||
| 3378 | } | ||
| 3379 | assert(g->win_sdk != nullptr); | ||
| 3380 | return g->win_sdk; | ||
| 3381 | } | ||
| 3382 | |||
| 3373 | void find_libc_include_path(CodeGen *g) { | 3383 | void find_libc_include_path(CodeGen *g) { |
| 3374 | #ifdef ZIG_OS_WINDOWS | ||
| 3375 | if (!g->libc_include_dir || buf_len(g->libc_include_dir) == 0) { | 3384 | if (!g->libc_include_dir || buf_len(g->libc_include_dir) == 0) { |
| 3376 | if (g->win_sdk == nullptr) { | 3385 | ZigWindowsSDK *sdk = get_windows_sdk(g); |
| 3377 | if (os_find_windows_sdk(&g->win_sdk)) { | ||
| 3378 | zig_panic("Unable to determine Windows SDK path."); | ||
| 3379 | } | ||
| 3380 | } | ||
| 3381 | 3386 | ||
| 3382 | if (g->zig_target.os == ZigLLVM_Win32) { | 3387 | if (g->zig_target.os == ZigLLVM_Win32) { |
| 3383 | if (os_get_win32_ucrt_include_path(g->win_sdk, g->libc_include_dir)) { | 3388 | if (os_get_win32_ucrt_include_path(sdk, g->libc_include_dir)) { |
| 3384 | zig_panic("Unable to determine libc include path."); | 3389 | zig_panic("Unable to determine libc include path."); |
| 3385 | } | 3390 | } |
| 3386 | } | 3391 | } |
| 3387 | } | 3392 | } |
| 3388 | return; | 3393 | |
| 3389 | #endif | ||
| 3390 | // TODO find libc at runtime for other operating systems | 3394 | // TODO find libc at runtime for other operating systems |
| 3391 | if(!g->libc_include_dir || buf_len(g->libc_include_dir) == 0) { | 3395 | if(!g->libc_include_dir || buf_len(g->libc_include_dir) == 0) { |
| 3392 | zig_panic("Unable to determine libc include path."); | 3396 | zig_panic("Unable to determine libc include path."); |
| ... | @@ -3394,39 +3398,34 @@ void find_libc_include_path(CodeGen *g) { | ... | @@ -3394,39 +3398,34 @@ void find_libc_include_path(CodeGen *g) { |
| 3394 | } | 3398 | } |
| 3395 | 3399 | ||
| 3396 | void find_libc_lib_path(CodeGen *g) { | 3400 | void find_libc_lib_path(CodeGen *g) { |
| 3397 | #ifdef ZIG_OS_WINDOWS | 3401 | // later we can handle this better by reporting an error via the normal mechanism |
| 3398 | if (g->zig_target.os == ZigLLVM_Win32) { | 3402 | if (!g->libc_lib_dir || buf_len(g->libc_lib_dir) == 0 || |
| 3399 | if (g->win_sdk == nullptr) { | 3403 | (g->zig_target.os == ZigLLVM_Win32 && (g->msvc_lib_dir == nullptr || g->kernel32_lib_dir == nullptr))) |
| 3400 | if (os_find_windows_sdk(&g->win_sdk)) { | 3404 | { |
| 3401 | zig_panic("Unable to determine Windows SDK path."); | 3405 | if (g->zig_target.os == ZigLLVM_Win32) { |
| 3406 | ZigWindowsSDK *sdk = get_windows_sdk(g); | ||
| 3407 | |||
| 3408 | Buf* vc_lib_dir = buf_alloc(); | ||
| 3409 | if (os_get_win32_vcruntime_path(vc_lib_dir, g->zig_target.arch.arch)) { | ||
| 3410 | zig_panic("Unable to determine vcruntime path."); | ||
| 3402 | } | 3411 | } |
| 3403 | } | ||
| 3404 | 3412 | ||
| 3405 | Buf* vc_lib_dir = buf_alloc(); | 3413 | Buf* ucrt_lib_path = buf_alloc(); |
| 3406 | if (os_get_win32_vcruntime_path(vc_lib_dir, g->zig_target.arch.arch)) { | 3414 | if (os_get_win32_ucrt_lib_path(sdk, ucrt_lib_path, g->zig_target.arch.arch)) { |
| 3407 | zig_panic("Unable to determine vcruntime path."); | 3415 | zig_panic("Unable to determine ucrt path."); |
| 3408 | } | 3416 | } |
| 3409 | 3417 | ||
| 3410 | Buf* ucrt_lib_path = buf_alloc(); | 3418 | Buf* kern_lib_path = buf_alloc(); |
| 3411 | if (os_get_win32_ucrt_lib_path(g->win_sdk, ucrt_lib_path, g->zig_target.arch.arch)) { | 3419 | if (os_get_win32_kern32_path(sdk, kern_lib_path, g->zig_target.arch.arch)) { |
| 3412 | zig_panic("Unable to determine ucrt path."); | 3420 | zig_panic("Unable to determine kernel32 path."); |
| 3413 | } | 3421 | } |
| 3414 | 3422 | ||
| 3415 | Buf* kern_lib_path = buf_alloc(); | 3423 | g->msvc_lib_dir = vc_lib_dir; |
| 3416 | if (os_get_win32_kern32_path(g->win_sdk, kern_lib_path, g->zig_target.arch.arch)) { | 3424 | g->libc_lib_dir = ucrt_lib_path; |
| 3417 | zig_panic("Unable to determine kernel32 path."); | 3425 | g->kernel32_lib_dir = kern_lib_path; |
| 3426 | } else { | ||
| 3427 | zig_panic("Unable to determine libc lib path."); | ||
| 3418 | } | 3428 | } |
| 3419 | |||
| 3420 | g->libc_lib_dirs_list.append(vc_lib_dir); | ||
| 3421 | g->libc_lib_dirs_list.append(ucrt_lib_path); | ||
| 3422 | g->libc_lib_dirs_list.append(kern_lib_path); | ||
| 3423 | } | ||
| 3424 | return; | ||
| 3425 | #endif | ||
| 3426 | |||
| 3427 | // later we can handle this better by reporting an error via the normal mechanism | ||
| 3428 | if (!g->libc_lib_dir || buf_len(g->libc_lib_dir) == 0) { | ||
| 3429 | zig_panic("Unable to determine libc lib path."); | ||
| 3430 | } | 3429 | } |
| 3431 | if (!g->libc_static_lib_dir || buf_len(g->libc_static_lib_dir) == 0) { | 3430 | if (!g->libc_static_lib_dir || buf_len(g->libc_static_lib_dir) == 0) { |
| 3432 | zig_panic("Unable to determine libc static lib path."); | 3431 | zig_panic("Unable to determine libc static lib path."); |
src/codegen.cpp+12-8| ... | @@ -114,6 +114,8 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out | ... | @@ -114,6 +114,8 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out |
| 114 | g->libc_lib_dir = buf_create_from_str(""); | 114 | g->libc_lib_dir = buf_create_from_str(""); |
| 115 | g->libc_static_lib_dir = buf_create_from_str(""); | 115 | g->libc_static_lib_dir = buf_create_from_str(""); |
| 116 | g->libc_include_dir = buf_create_from_str(""); | 116 | g->libc_include_dir = buf_create_from_str(""); |
| 117 | g->msvc_lib_dir = nullptr; | ||
| 118 | g->kernel32_lib_dir = nullptr; | ||
| 117 | g->each_lib_rpath = false; | 119 | g->each_lib_rpath = false; |
| 118 | } else { | 120 | } else { |
| 119 | // native compilation, we can rely on the configuration stuff | 121 | // native compilation, we can rely on the configuration stuff |
| ... | @@ -123,6 +125,8 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out | ... | @@ -123,6 +125,8 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out |
| 123 | g->libc_lib_dir = buf_create_from_str(ZIG_LIBC_LIB_DIR); | 125 | g->libc_lib_dir = buf_create_from_str(ZIG_LIBC_LIB_DIR); |
| 124 | g->libc_static_lib_dir = buf_create_from_str(ZIG_LIBC_STATIC_LIB_DIR); | 126 | g->libc_static_lib_dir = buf_create_from_str(ZIG_LIBC_STATIC_LIB_DIR); |
| 125 | g->libc_include_dir = buf_create_from_str(ZIG_LIBC_INCLUDE_DIR); | 127 | g->libc_include_dir = buf_create_from_str(ZIG_LIBC_INCLUDE_DIR); |
| 128 | g->msvc_lib_dir = nullptr; // find it at runtime | ||
| 129 | g->kernel32_lib_dir = nullptr; // find it at runtime | ||
| 126 | 130 | ||
| 127 | #ifdef ZIG_EACH_LIB_RPATH | 131 | #ifdef ZIG_EACH_LIB_RPATH |
| 128 | g->each_lib_rpath = true; | 132 | g->each_lib_rpath = true; |
| ... | @@ -221,20 +225,20 @@ void codegen_set_libc_include_dir(CodeGen *g, Buf *libc_include_dir) { | ... | @@ -221,20 +225,20 @@ void codegen_set_libc_include_dir(CodeGen *g, Buf *libc_include_dir) { |
| 221 | g->libc_include_dir = libc_include_dir; | 225 | g->libc_include_dir = libc_include_dir; |
| 222 | } | 226 | } |
| 223 | 227 | ||
| 224 | void codegen_set_dynamic_linker(CodeGen *g, Buf *dynamic_linker) { | 228 | void codegen_set_msvc_lib_dir(CodeGen *g, Buf *msvc_lib_dir) { |
| 225 | g->dynamic_linker = dynamic_linker; | 229 | g->msvc_lib_dir = msvc_lib_dir; |
| 226 | } | 230 | } |
| 227 | 231 | ||
| 228 | void codegen_add_lib_dir(CodeGen *g, const char *dir) { | 232 | void codegen_set_kernel32_lib_dir(CodeGen *g, Buf *kernel32_lib_dir) { |
| 229 | g->lib_dirs.append(dir); | 233 | g->kernel32_lib_dir = kernel32_lib_dir; |
| 230 | } | 234 | } |
| 231 | 235 | ||
| 232 | void codegen_set_ucrt_lib_dir(CodeGen *g, Buf *ucrt_lib_dir) { | 236 | void codegen_set_dynamic_linker(CodeGen *g, Buf *dynamic_linker) { |
| 233 | g->libc_lib_dirs_list.append(ucrt_lib_dir); | 237 | g->dynamic_linker = dynamic_linker; |
| 234 | } | 238 | } |
| 235 | 239 | ||
| 236 | void codegen_set_kernel32_lib_dir(CodeGen *g, Buf *kernel32_lib_dir) { | 240 | void codegen_add_lib_dir(CodeGen *g, const char *dir) { |
| 237 | g->libc_lib_dirs_list.append(kernel32_lib_dir); | 241 | g->lib_dirs.append(dir); |
| 238 | } | 242 | } |
| 239 | 243 | ||
| 240 | void codegen_add_rpath(CodeGen *g, const char *name) { | 244 | void codegen_add_rpath(CodeGen *g, const char *name) { |
src/codegen.hpp+1-1| ... | @@ -30,7 +30,7 @@ void codegen_set_out_name(CodeGen *codegen, Buf *out_name); | ... | @@ -30,7 +30,7 @@ void codegen_set_out_name(CodeGen *codegen, Buf *out_name); |
| 30 | void codegen_set_libc_lib_dir(CodeGen *codegen, Buf *libc_lib_dir); | 30 | void codegen_set_libc_lib_dir(CodeGen *codegen, Buf *libc_lib_dir); |
| 31 | void codegen_set_libc_static_lib_dir(CodeGen *g, Buf *libc_static_lib_dir); | 31 | void codegen_set_libc_static_lib_dir(CodeGen *g, Buf *libc_static_lib_dir); |
| 32 | void codegen_set_libc_include_dir(CodeGen *codegen, Buf *libc_include_dir); | 32 | void codegen_set_libc_include_dir(CodeGen *codegen, Buf *libc_include_dir); |
| 33 | void codegen_set_ucrt_lib_dir(CodeGen *g, Buf *ucrt_lib_dir); | 33 | void codegen_set_msvc_lib_dir(CodeGen *g, Buf *msvc_lib_dir); |
| 34 | void codegen_set_kernel32_lib_dir(CodeGen *codegen, Buf *kernel32_lib_dir); | 34 | void codegen_set_kernel32_lib_dir(CodeGen *codegen, Buf *kernel32_lib_dir); |
| 35 | void codegen_set_dynamic_linker(CodeGen *g, Buf *dynamic_linker); | 35 | void codegen_set_dynamic_linker(CodeGen *g, Buf *dynamic_linker); |
| 36 | void codegen_set_windows_subsystem(CodeGen *g, bool mwindows, bool mconsole); | 36 | void codegen_set_windows_subsystem(CodeGen *g, bool mwindows, bool mconsole); |
src/link.cpp+5-5| ... | @@ -402,11 +402,11 @@ static void construct_linker_job_coff(LinkJob *lj) { | ... | @@ -402,11 +402,11 @@ static void construct_linker_job_coff(LinkJob *lj) { |
| 402 | lj->args.append(buf_ptr(buf_sprintf("-OUT:%s", buf_ptr(&lj->out_file)))); | 402 | lj->args.append(buf_ptr(buf_sprintf("-OUT:%s", buf_ptr(&lj->out_file)))); |
| 403 | 403 | ||
| 404 | if (g->libc_link_lib != nullptr) { | 404 | if (g->libc_link_lib != nullptr) { |
| 405 | if (g->libc_link_lib != nullptr) { | 405 | lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->msvc_lib_dir)))); |
| 406 | for (uint32_t i = 0; i < g->libc_lib_dirs_list.length; ++i) { | 406 | lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->kernel32_lib_dir)))); |
| 407 | lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->libc_lib_dirs_list.items[i])))); | 407 | |
| 408 | } | 408 | lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->libc_lib_dir)))); |
| 409 | } | 409 | lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->libc_static_lib_dir)))); |
| 410 | } | 410 | } |
| 411 | 411 | ||
| 412 | if (lj->link_in_crt) { | 412 | if (lj->link_in_crt) { |
src/main.cpp+1-1| ... | @@ -758,7 +758,7 @@ int main(int argc, char **argv) { | ... | @@ -758,7 +758,7 @@ int main(int argc, char **argv) { |
| 758 | if (libc_include_dir) | 758 | if (libc_include_dir) |
| 759 | codegen_set_libc_include_dir(g, buf_create_from_str(libc_include_dir)); | 759 | codegen_set_libc_include_dir(g, buf_create_from_str(libc_include_dir)); |
| 760 | if (msvc_lib_dir) | 760 | if (msvc_lib_dir) |
| 761 | codegen_set_ucrt_lib_dir(g, buf_create_from_str(msvc_lib_dir)); | 761 | codegen_set_msvc_lib_dir(g, buf_create_from_str(msvc_lib_dir)); |
| 762 | if (kernel32_lib_dir) | 762 | if (kernel32_lib_dir) |
| 763 | codegen_set_kernel32_lib_dir(g, buf_create_from_str(kernel32_lib_dir)); | 763 | codegen_set_kernel32_lib_dir(g, buf_create_from_str(kernel32_lib_dir)); |
| 764 | if (dynamic_linker) | 764 | if (dynamic_linker) |
src/os.cpp+20-2| ... | @@ -1001,8 +1001,8 @@ void os_stderr_set_color(TermColor color) { | ... | @@ -1001,8 +1001,8 @@ void os_stderr_set_color(TermColor color) { |
| 1001 | #endif | 1001 | #endif |
| 1002 | } | 1002 | } |
| 1003 | 1003 | ||
| 1004 | #if defined ZIG_OS_WINDOWS | ||
| 1005 | int os_find_windows_sdk(ZigWindowsSDK **out_sdk) { | 1004 | int os_find_windows_sdk(ZigWindowsSDK **out_sdk) { |
| 1005 | #if defined(ZIG_OS_WINDOWS) | ||
| 1006 | ZigWindowsSDK *result_sdk = allocate<ZigWindowsSDK>(1); | 1006 | ZigWindowsSDK *result_sdk = allocate<ZigWindowsSDK>(1); |
| 1007 | buf_resize(&result_sdk->path10, 0); | 1007 | buf_resize(&result_sdk->path10, 0); |
| 1008 | buf_resize(&result_sdk->path81, 0); | 1008 | buf_resize(&result_sdk->path81, 0); |
| ... | @@ -1099,9 +1099,13 @@ int os_find_windows_sdk(ZigWindowsSDK **out_sdk) { | ... | @@ -1099,9 +1099,13 @@ int os_find_windows_sdk(ZigWindowsSDK **out_sdk) { |
| 1099 | 1099 | ||
| 1100 | *out_sdk = result_sdk; | 1100 | *out_sdk = result_sdk; |
| 1101 | return 0; | 1101 | return 0; |
| 1102 | #else | ||
| 1103 | return ErrorFileNotFound; | ||
| 1104 | #endif | ||
| 1102 | } | 1105 | } |
| 1103 | 1106 | ||
| 1104 | int os_get_win32_vcruntime_path(Buf* output_buf, ZigLLVM_ArchType platform_type) { | 1107 | int os_get_win32_vcruntime_path(Buf* output_buf, ZigLLVM_ArchType platform_type) { |
| 1108 | #if defined(ZIG_OS_WINDOWS) | ||
| 1105 | buf_resize(output_buf, 0); | 1109 | buf_resize(output_buf, 0); |
| 1106 | //COM Smart Pointerse requires explicit scope | 1110 | //COM Smart Pointerse requires explicit scope |
| 1107 | { | 1111 | { |
| ... | @@ -1226,9 +1230,13 @@ com_done:; | ... | @@ -1226,9 +1230,13 @@ com_done:; |
| 1226 | buf_resize(output_buf, 0); | 1230 | buf_resize(output_buf, 0); |
| 1227 | return ErrorFileNotFound; | 1231 | return ErrorFileNotFound; |
| 1228 | } | 1232 | } |
| 1233 | #else | ||
| 1234 | return ErrorFileNotFound; | ||
| 1235 | #endif | ||
| 1229 | } | 1236 | } |
| 1230 | 1237 | ||
| 1231 | int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) { | 1238 | int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) { |
| 1239 | #if defined(ZIG_OS_WINDOWS) | ||
| 1232 | buf_resize(output_buf, 0); | 1240 | buf_resize(output_buf, 0); |
| 1233 | buf_appendf(output_buf, "%s\\Lib\\%s\\ucrt\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10)); | 1241 | buf_appendf(output_buf, "%s\\Lib\\%s\\ucrt\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10)); |
| 1234 | switch (platform_type) { | 1242 | switch (platform_type) { |
| ... | @@ -1254,9 +1262,13 @@ int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_Arch | ... | @@ -1254,9 +1262,13 @@ int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_Arch |
| 1254 | buf_resize(output_buf, 0); | 1262 | buf_resize(output_buf, 0); |
| 1255 | return ErrorFileNotFound; | 1263 | return ErrorFileNotFound; |
| 1256 | } | 1264 | } |
| 1265 | #else | ||
| 1266 | return ErrorFileNotFound; | ||
| 1267 | #endif | ||
| 1257 | } | 1268 | } |
| 1258 | 1269 | ||
| 1259 | int os_get_win32_ucrt_include_path(ZigWindowsSDK *sdk, Buf* output_buf) { | 1270 | int os_get_win32_ucrt_include_path(ZigWindowsSDK *sdk, Buf* output_buf) { |
| 1271 | #if defined(ZIG_OS_WINDOWS) | ||
| 1260 | buf_resize(output_buf, 0); | 1272 | buf_resize(output_buf, 0); |
| 1261 | buf_appendf(output_buf, "%s\\Include\\%s\\ucrt", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10)); | 1273 | buf_appendf(output_buf, "%s\\Include\\%s\\ucrt", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10)); |
| 1262 | if (GetFileAttributesA(buf_ptr(output_buf)) != INVALID_FILE_ATTRIBUTES) { | 1274 | if (GetFileAttributesA(buf_ptr(output_buf)) != INVALID_FILE_ATTRIBUTES) { |
| ... | @@ -1266,9 +1278,13 @@ int os_get_win32_ucrt_include_path(ZigWindowsSDK *sdk, Buf* output_buf) { | ... | @@ -1266,9 +1278,13 @@ int os_get_win32_ucrt_include_path(ZigWindowsSDK *sdk, Buf* output_buf) { |
| 1266 | buf_resize(output_buf, 0); | 1278 | buf_resize(output_buf, 0); |
| 1267 | return ErrorFileNotFound; | 1279 | return ErrorFileNotFound; |
| 1268 | } | 1280 | } |
| 1281 | #else | ||
| 1282 | return ErrorFileNotFound; | ||
| 1283 | #endif | ||
| 1269 | } | 1284 | } |
| 1270 | 1285 | ||
| 1271 | int os_get_win32_kern32_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) { | 1286 | int os_get_win32_kern32_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) { |
| 1287 | #if defined(ZIG_OS_WINDOWS) | ||
| 1272 | { | 1288 | { |
| 1273 | buf_resize(output_buf, 0); | 1289 | buf_resize(output_buf, 0); |
| 1274 | buf_appendf(output_buf, "%s\\Lib\\%s\\um\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10)); | 1290 | buf_appendf(output_buf, "%s\\Lib\\%s\\um\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10)); |
| ... | @@ -1316,5 +1332,7 @@ int os_get_win32_kern32_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchTy | ... | @@ -1316,5 +1332,7 @@ int os_get_win32_kern32_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchTy |
| 1316 | } | 1332 | } |
| 1317 | } | 1333 | } |
| 1318 | return ErrorFileNotFound; | 1334 | return ErrorFileNotFound; |
| 1319 | } | 1335 | #else |
| 1336 | return ErrorFileNotFound; | ||
| 1320 | #endif | 1337 | #endif |
| 1338 | } |
src/os.hpp+10-11| ... | @@ -76,28 +76,27 @@ bool os_is_sep(uint8_t c); | ... | @@ -76,28 +76,27 @@ bool os_is_sep(uint8_t c); |
| 76 | 76 | ||
| 77 | int os_self_exe_path(Buf *out_path); | 77 | int os_self_exe_path(Buf *out_path); |
| 78 | 78 | ||
| 79 | #if defined(__APPLE__) | ||
| 80 | #define ZIG_OS_DARWIN | ||
| 81 | #elif defined(_WIN32) | ||
| 82 | #define ZIG_OS_WINDOWS | ||
| 83 | #elif defined(__linux__) | ||
| 84 | #define ZIG_OS_LINUX | ||
| 85 | #else | ||
| 86 | #define ZIG_OS_UNKNOWN | ||
| 87 | #endif | ||
| 88 | |||
| 89 | struct ZigWindowsSDK { | 79 | struct ZigWindowsSDK { |
| 90 | Buf path10; | 80 | Buf path10; |
| 91 | Buf version10; | 81 | Buf version10; |
| 92 | Buf path81; | 82 | Buf path81; |
| 93 | Buf version81; | 83 | Buf version81; |
| 94 | }; | 84 | }; |
| 95 | #if defined(ZIG_OS_WINDOWS) | 85 | |
| 96 | int os_find_windows_sdk(ZigWindowsSDK **out_sdk); | 86 | int os_find_windows_sdk(ZigWindowsSDK **out_sdk); |
| 97 | int os_get_win32_vcruntime_path(Buf *output_buf, ZigLLVM_ArchType platform_type); | 87 | int os_get_win32_vcruntime_path(Buf *output_buf, ZigLLVM_ArchType platform_type); |
| 98 | int os_get_win32_ucrt_include_path(ZigWindowsSDK *sdk, Buf *output_buf); | 88 | int os_get_win32_ucrt_include_path(ZigWindowsSDK *sdk, Buf *output_buf); |
| 99 | int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf *output_buf, ZigLLVM_ArchType platform_type); | 89 | int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf *output_buf, ZigLLVM_ArchType platform_type); |
| 100 | int os_get_win32_kern32_path(ZigWindowsSDK *sdk, Buf *output_buf, ZigLLVM_ArchType platform_type); | 90 | int os_get_win32_kern32_path(ZigWindowsSDK *sdk, Buf *output_buf, ZigLLVM_ArchType platform_type); |
| 91 | |||
| 92 | #if defined(__APPLE__) | ||
| 93 | #define ZIG_OS_DARWIN | ||
| 94 | #elif defined(_WIN32) | ||
| 95 | #define ZIG_OS_WINDOWS | ||
| 96 | #elif defined(__linux__) | ||
| 97 | #define ZIG_OS_LINUX | ||
| 98 | #else | ||
| 99 | #define ZIG_OS_UNKNOWN | ||
| 101 | #endif | 100 | #endif |
| 102 | 101 | ||
| 103 | #if defined(__x86_64__) | 102 | #if defined(__x86_64__) |