| ... | @@ -111,7 +111,7 @@ Error zig_libc_parse(ZigLibCInstallation *libc, Buf *libc_file, const ZigTarget | ... | @@ -111,7 +111,7 @@ Error zig_libc_parse(ZigLibCInstallation *libc, Buf *libc_file, const ZigTarget |
| 111 | } | 111 | } |
| 112 | | 112 | |
| 113 | if (buf_len(&libc->msvc_lib_dir) == 0) { | 113 | if (buf_len(&libc->msvc_lib_dir) == 0) { |
| 114 | if (target->os == OsWindows) { | 114 | if (target->os == OsWindows && !target_abi_is_gnu(target->abi)) { |
| 115 | if (verbose) { | 115 | if (verbose) { |
| 116 | fprintf(stderr, "msvc_lib_dir may not be empty for %s\n", target_os_name(target->os)); | 116 | fprintf(stderr, "msvc_lib_dir may not be empty for %s\n", target_os_name(target->os)); |
| 117 | } | 117 | } |
| ... | @@ -120,7 +120,7 @@ Error zig_libc_parse(ZigLibCInstallation *libc, Buf *libc_file, const ZigTarget | ... | @@ -120,7 +120,7 @@ Error zig_libc_parse(ZigLibCInstallation *libc, Buf *libc_file, const ZigTarget |
| 120 | } | 120 | } |
| 121 | | 121 | |
| 122 | if (buf_len(&libc->kernel32_lib_dir) == 0) { | 122 | if (buf_len(&libc->kernel32_lib_dir) == 0) { |
| 123 | if (target->os == OsWindows) { | 123 | if (target->os == OsWindows && !target_abi_is_gnu(target->abi)) { |
| 124 | if (verbose) { | 124 | if (verbose) { |
| 125 | fprintf(stderr, "kernel32_lib_dir may not be empty for %s\n", target_os_name(target->os)); | 125 | fprintf(stderr, "kernel32_lib_dir may not be empty for %s\n", target_os_name(target->os)); |
| 126 | } | 126 | } |
| ... | @@ -132,86 +132,24 @@ Error zig_libc_parse(ZigLibCInstallation *libc, Buf *libc_file, const ZigTarget | ... | @@ -132,86 +132,24 @@ Error zig_libc_parse(ZigLibCInstallation *libc, Buf *libc_file, const ZigTarget |
| 132 | } | 132 | } |
| 133 | | 133 | |
| 134 | #if defined(ZIG_OS_WINDOWS) | 134 | #if defined(ZIG_OS_WINDOWS) |
| 135 | static Error zig_libc_find_native_include_dir_windows(ZigLibCInstallation *self, ZigWindowsSDK *sdk, bool verbose) { | 135 | #define CC_EXE "cc.exe" |
| 136 | Error err; | | |
| 137 | if ((err = os_get_win32_ucrt_include_path(sdk, &self->include_dir))) { | | |
| 138 | if (verbose) { | | |
| 139 | fprintf(stderr, "Unable to determine libc include path: %s\n", err_str(err)); | | |
| 140 | } | | |
| 141 | return err; | | |
| 142 | } | | |
| 143 | return ErrorNone; | | |
| 144 | } | | |
| 145 | static Error zig_libc_find_crt_dir_windows(ZigLibCInstallation *self, ZigWindowsSDK *sdk, ZigTarget *target, | | |
| 146 | bool verbose) | | |
| 147 | { | | |
| 148 | Error err; | | |
| 149 | if ((err = os_get_win32_ucrt_lib_path(sdk, &self->crt_dir, target->arch))) { | | |
| 150 | if (verbose) { | | |
| 151 | fprintf(stderr, "Unable to determine ucrt path: %s\n", err_str(err)); | | |
| 152 | } | | |
| 153 | return err; | | |
| 154 | } | | |
| 155 | return ErrorNone; | | |
| 156 | } | | |
| 157 | static Error zig_libc_find_kernel32_lib_dir(ZigLibCInstallation *self, ZigWindowsSDK *sdk, ZigTarget *target, | | |
| 158 | bool verbose) | | |
| 159 | { | | |
| 160 | Error err; | | |
| 161 | if ((err = os_get_win32_kern32_path(sdk, &self->kernel32_lib_dir, target->arch))) { | | |
| 162 | if (verbose) { | | |
| 163 | fprintf(stderr, "Unable to determine kernel32 path: %s\n", err_str(err)); | | |
| 164 | } | | |
| 165 | return err; | | |
| 166 | } | | |
| 167 | return ErrorNone; | | |
| 168 | } | | |
| 169 | static Error zig_libc_find_native_msvc_lib_dir(ZigLibCInstallation *self, ZigWindowsSDK *sdk, bool verbose) { | | |
| 170 | if (sdk->msvc_lib_dir_ptr == nullptr) { | | |
| 171 | if (verbose) { | | |
| 172 | fprintf(stderr, "Unable to determine vcruntime.lib path\n"); | | |
| 173 | } | | |
| 174 | return ErrorFileNotFound; | | |
| 175 | } | | |
| 176 | buf_init_from_mem(&self->msvc_lib_dir, sdk->msvc_lib_dir_ptr, sdk->msvc_lib_dir_len); | | |
| 177 | return ErrorNone; | | |
| 178 | } | | |
| 179 | static Error zig_libc_find_native_msvc_include_dir(ZigLibCInstallation *self, ZigWindowsSDK *sdk, bool verbose) { | | |
| 180 | Error err; | | |
| 181 | if (sdk->msvc_lib_dir_ptr == nullptr) { | | |
| 182 | if (verbose) { | | |
| 183 | fprintf(stderr, "Unable to determine vcruntime.h path\n"); | | |
| 184 | } | | |
| 185 | return ErrorFileNotFound; | | |
| 186 | } | | |
| 187 | Buf search_path = BUF_INIT; | | |
| 188 | buf_init_from_mem(&search_path, sdk->msvc_lib_dir_ptr, sdk->msvc_lib_dir_len); | | |
| 189 | buf_append_str(&search_path, "\\..\\..\\include"); | | |
| 190 | | | |
| 191 | Buf *vcruntime_path = buf_sprintf("%s\\vcruntime.h", buf_ptr(&search_path)); | | |
| 192 | bool exists; | | |
| 193 | if ((err = os_file_exists(vcruntime_path, &exists))) { | | |
| 194 | exists = false; | | |
| 195 | } | | |
| 196 | if (exists) { | | |
| 197 | self->sys_include_dir = search_path; | | |
| 198 | return ErrorNone; | | |
| 199 | } | | |
| 200 | | | |
| 201 | if (verbose) { | | |
| 202 | fprintf(stderr, "Unable to determine vcruntime.h path\n"); | | |
| 203 | } | | |
| 204 | return ErrorFileNotFound; | | |
| 205 | } | | |
| 206 | #else | 136 | #else |
| | 137 | #define CC_EXE "cc" |
| | 138 | #endif |
| | 139 | |
| 207 | static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, bool verbose) { | 140 | static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, bool verbose) { |
| 208 | const char *cc_exe = getenv("CC"); | 141 | const char *cc_exe = getenv("CC"); |
| 209 | cc_exe = (cc_exe == nullptr) ? "cc" : cc_exe; | 142 | cc_exe = (cc_exe == nullptr) ? CC_EXE : cc_exe; |
| 210 | ZigList<const char *> args = {}; | 143 | ZigList<const char *> args = {}; |
| 211 | args.append("-E"); | 144 | args.append("-E"); |
| 212 | args.append("-Wp,-v"); | 145 | args.append("-Wp,-v"); |
| 213 | args.append("-xc"); | 146 | args.append("-xc"); |
| | 147 | #if defined(ZIG_OS_WINDOWS) |
| | 148 | args.append("nul"); |
| | 149 | #else |
| 214 | args.append("/dev/null"); | 150 | args.append("/dev/null"); |
| | 151 | #endif |
| | 152 | |
| 215 | Termination term; | 153 | Termination term; |
| 216 | Buf *out_stderr = buf_alloc(); | 154 | Buf *out_stderr = buf_alloc(); |
| 217 | Buf *out_stdout = buf_alloc(); | 155 | Buf *out_stdout = buf_alloc(); |
| ... | @@ -235,7 +173,12 @@ static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, b | ... | @@ -235,7 +173,12 @@ static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, b |
| 235 | if (newline == nullptr) { | 173 | if (newline == nullptr) { |
| 236 | break; | 174 | break; |
| 237 | } | 175 | } |
| | 176 | |
| | 177 | #if defined(ZIG_OS_WINDOWS) |
| | 178 | *(newline - 1) = 0; |
| | 179 | #endif |
| 238 | *newline = 0; | 180 | *newline = 0; |
| | 181 | |
| 239 | if (prev_newline[0] == ' ') { | 182 | if (prev_newline[0] == ' ') { |
| 240 | search_paths.append(prev_newline); | 183 | search_paths.append(prev_newline); |
| 241 | } | 184 | } |
| ... | @@ -255,6 +198,28 @@ static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, b | ... | @@ -255,6 +198,28 @@ static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, b |
| 255 | search_path += 1; | 198 | search_path += 1; |
| 256 | } | 199 | } |
| 257 | | 200 | |
| | 201 | #if defined(ZIG_OS_WINDOWS) |
| | 202 | if (buf_len(&self->include_dir) == 0) { |
| | 203 | Buf *stdlib_path = buf_sprintf("%s\\stdlib.h", search_path); |
| | 204 | bool exists; |
| | 205 | if ((err = os_file_exists(stdlib_path, &exists))) { |
| | 206 | exists = false; |
| | 207 | } |
| | 208 | if (exists) { |
| | 209 | buf_init_from_str(&self->include_dir, search_path); |
| | 210 | } |
| | 211 | } |
| | 212 | if (buf_len(&self->sys_include_dir) == 0) { |
| | 213 | Buf *stdlib_path = buf_sprintf("%s\\sys\\types.h", search_path); |
| | 214 | bool exists; |
| | 215 | if ((err = os_file_exists(stdlib_path, &exists))) { |
| | 216 | exists = false; |
| | 217 | } |
| | 218 | if (exists) { |
| | 219 | buf_init_from_str(&self->sys_include_dir, search_path); |
| | 220 | } |
| | 221 | } |
| | 222 | #else |
| 258 | if (buf_len(&self->include_dir) == 0) { | 223 | if (buf_len(&self->include_dir) == 0) { |
| 259 | Buf *stdlib_path = buf_sprintf("%s/stdlib.h", search_path); | 224 | Buf *stdlib_path = buf_sprintf("%s/stdlib.h", search_path); |
| 260 | bool exists; | 225 | bool exists; |
| ... | @@ -275,6 +240,8 @@ static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, b | ... | @@ -275,6 +240,8 @@ static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, b |
| 275 | buf_init_from_str(&self->sys_include_dir, search_path); | 240 | buf_init_from_str(&self->sys_include_dir, search_path); |
| 276 | } | 241 | } |
| 277 | } | 242 | } |
| | 243 | #endif |
| | 244 | |
| 278 | if (buf_len(&self->include_dir) != 0 && buf_len(&self->sys_include_dir) != 0) { | 245 | if (buf_len(&self->include_dir) != 0 && buf_len(&self->sys_include_dir) != 0) { |
| 279 | return ErrorNone; | 246 | return ErrorNone; |
| 280 | } | 247 | } |
| ... | @@ -284,15 +251,19 @@ static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, b | ... | @@ -284,15 +251,19 @@ static Error zig_libc_find_native_include_dir_posix(ZigLibCInstallation *self, b |
| 284 | fprintf(stderr, "unable to determine libc include path: stdlib.h not found in '%s' search paths\n", cc_exe); | 251 | fprintf(stderr, "unable to determine libc include path: stdlib.h not found in '%s' search paths\n", cc_exe); |
| 285 | } | 252 | } |
| 286 | if (buf_len(&self->sys_include_dir) == 0) { | 253 | if (buf_len(&self->sys_include_dir) == 0) { |
| | 254 | #if defined(ZIG_OS_WINDOWS) |
| | 255 | fprintf(stderr, "unable to determine libc include path: sys/types.h not found in '%s' search paths\n", cc_exe); |
| | 256 | #else |
| 287 | fprintf(stderr, "unable to determine libc include path: sys/errno.h not found in '%s' search paths\n", cc_exe); | 257 | fprintf(stderr, "unable to determine libc include path: sys/errno.h not found in '%s' search paths\n", cc_exe); |
| | 258 | #endif |
| 288 | } | 259 | } |
| 289 | } | 260 | } |
| 290 | return ErrorFileNotFound; | 261 | return ErrorFileNotFound; |
| 291 | } | 262 | } |
| 292 | #if defined(ZIG_OS_LINUX) | 263 | |
| 293 | Error zig_libc_cc_print_file_name(const char *o_file, Buf *out, bool want_dirname, bool verbose) { | 264 | Error zig_libc_cc_print_file_name(const char *o_file, Buf *out, bool want_dirname, bool verbose) { |
| 294 | const char *cc_exe = getenv("CC"); | 265 | const char *cc_exe = getenv("CC"); |
| 295 | cc_exe = (cc_exe == nullptr) ? "cc" : cc_exe; | 266 | cc_exe = (cc_exe == nullptr) ? CC_EXE : cc_exe; |
| 296 | ZigList<const char *> args = {}; | 267 | ZigList<const char *> args = {}; |
| 297 | args.append(buf_ptr(buf_sprintf("-print-file-name=%s", o_file))); | 268 | args.append(buf_ptr(buf_sprintf("-print-file-name=%s", o_file))); |
| 298 | Termination term; | 269 | Termination term; |
| ... | @@ -301,19 +272,25 @@ Error zig_libc_cc_print_file_name(const char *o_file, Buf *out, bool want_dirnam | ... | @@ -301,19 +272,25 @@ Error zig_libc_cc_print_file_name(const char *o_file, Buf *out, bool want_dirnam |
| 301 | Error err; | 272 | Error err; |
| 302 | if ((err = os_exec_process(cc_exe, args, &term, out_stderr, out_stdout))) { | 273 | if ((err = os_exec_process(cc_exe, args, &term, out_stderr, out_stdout))) { |
| 303 | if (verbose) { | 274 | if (verbose) { |
| 304 | fprintf(stderr, "unable to determine libc include path: executing '%s': %s\n", cc_exe, err_str(err)); | 275 | fprintf(stderr, "unable to determine libc library path: executing '%s': %s\n", cc_exe, err_str(err)); |
| 305 | } | 276 | } |
| 306 | return err; | 277 | return err; |
| 307 | } | 278 | } |
| 308 | if (term.how != TerminationIdClean || term.code != 0) { | 279 | if (term.how != TerminationIdClean || term.code != 0) { |
| 309 | if (verbose) { | 280 | if (verbose) { |
| 310 | fprintf(stderr, "unable to determine libc include path: executing '%s' failed\n", cc_exe); | 281 | fprintf(stderr, "unable to determine libc library path: executing '%s' failed\n", cc_exe); |
| 311 | } | 282 | } |
| 312 | return ErrorCCompileErrors; | 283 | return ErrorCCompileErrors; |
| 313 | } | 284 | } |
| | 285 | #if defined(ZIG_OS_WINDOWS) |
| | 286 | if (buf_ends_with_str(out_stdout, "\r\n")) { |
| | 287 | buf_resize(out_stdout, buf_len(out_stdout) - 2); |
| | 288 | } |
| | 289 | #else |
| 314 | if (buf_ends_with_str(out_stdout, "\n")) { | 290 | if (buf_ends_with_str(out_stdout, "\n")) { |
| 315 | buf_resize(out_stdout, buf_len(out_stdout) - 1); | 291 | buf_resize(out_stdout, buf_len(out_stdout) - 1); |
| 316 | } | 292 | } |
| | 293 | #endif |
| 317 | if (buf_len(out_stdout) == 0 || buf_eql_str(out_stdout, o_file)) { | 294 | if (buf_len(out_stdout) == 0 || buf_eql_str(out_stdout, o_file)) { |
| 318 | return ErrorCCompilerCannotFindFile; | 295 | return ErrorCCompilerCannotFindFile; |
| 319 | } | 296 | } |
| ... | @@ -324,16 +301,95 @@ Error zig_libc_cc_print_file_name(const char *o_file, Buf *out, bool want_dirnam | ... | @@ -324,16 +301,95 @@ Error zig_libc_cc_print_file_name(const char *o_file, Buf *out, bool want_dirnam |
| 324 | } | 301 | } |
| 325 | return ErrorNone; | 302 | return ErrorNone; |
| 326 | } | 303 | } |
| | 304 | |
| | 305 | #undef CC_EXE |
| | 306 | |
| 327 | static Error zig_libc_find_native_crt_dir_posix(ZigLibCInstallation *self, bool verbose) { | 307 | static Error zig_libc_find_native_crt_dir_posix(ZigLibCInstallation *self, bool verbose) { |
| 328 | return zig_libc_cc_print_file_name("crt1.o", &self->crt_dir, true, verbose); | 308 | return zig_libc_cc_print_file_name("crt1.o", &self->crt_dir, true, verbose); |
| 329 | } | 309 | } |
| 330 | #endif | 310 | |
| | 311 | #if defined(ZIG_OS_WINDOWS) |
| | 312 | static Error zig_libc_find_native_include_dir_windows(ZigLibCInstallation *self, ZigWindowsSDK *sdk, bool verbose) { |
| | 313 | Error err; |
| | 314 | if ((err = os_get_win32_ucrt_include_path(sdk, &self->include_dir))) { |
| | 315 | if (verbose) { |
| | 316 | fprintf(stderr, "Unable to determine libc include path: %s\n", err_str(err)); |
| | 317 | } |
| | 318 | return err; |
| | 319 | } |
| | 320 | return ErrorNone; |
| | 321 | } |
| | 322 | |
| | 323 | static Error zig_libc_find_crt_dir_windows(ZigLibCInstallation *self, ZigWindowsSDK *sdk, ZigTarget *target, |
| | 324 | bool verbose) |
| | 325 | { |
| | 326 | Error err; |
| | 327 | if ((err = os_get_win32_ucrt_lib_path(sdk, &self->crt_dir, target->arch))) { |
| | 328 | if (verbose) { |
| | 329 | fprintf(stderr, "Unable to determine ucrt path: %s\n", err_str(err)); |
| | 330 | } |
| | 331 | return err; |
| | 332 | } |
| | 333 | return ErrorNone; |
| | 334 | } |
| | 335 | |
| | 336 | static Error zig_libc_find_kernel32_lib_dir(ZigLibCInstallation *self, ZigWindowsSDK *sdk, ZigTarget *target, |
| | 337 | bool verbose) |
| | 338 | { |
| | 339 | Error err; |
| | 340 | if ((err = os_get_win32_kern32_path(sdk, &self->kernel32_lib_dir, target->arch))) { |
| | 341 | if (verbose) { |
| | 342 | fprintf(stderr, "Unable to determine kernel32 path: %s\n", err_str(err)); |
| | 343 | } |
| | 344 | return err; |
| | 345 | } |
| | 346 | return ErrorNone; |
| | 347 | } |
| | 348 | |
| | 349 | static Error zig_libc_find_native_msvc_lib_dir(ZigLibCInstallation *self, ZigWindowsSDK *sdk, bool verbose) { |
| | 350 | if (sdk->msvc_lib_dir_ptr == nullptr) { |
| | 351 | if (verbose) { |
| | 352 | fprintf(stderr, "Unable to determine vcruntime.lib path\n"); |
| | 353 | } |
| | 354 | return ErrorFileNotFound; |
| | 355 | } |
| | 356 | buf_init_from_mem(&self->msvc_lib_dir, sdk->msvc_lib_dir_ptr, sdk->msvc_lib_dir_len); |
| | 357 | return ErrorNone; |
| | 358 | } |
| | 359 | |
| | 360 | static Error zig_libc_find_native_msvc_include_dir(ZigLibCInstallation *self, ZigWindowsSDK *sdk, bool verbose) { |
| | 361 | Error err; |
| | 362 | if (sdk->msvc_lib_dir_ptr == nullptr) { |
| | 363 | if (verbose) { |
| | 364 | fprintf(stderr, "Unable to determine vcruntime.h path\n"); |
| | 365 | } |
| | 366 | return ErrorFileNotFound; |
| | 367 | } |
| | 368 | Buf search_path = BUF_INIT; |
| | 369 | buf_init_from_mem(&search_path, sdk->msvc_lib_dir_ptr, sdk->msvc_lib_dir_len); |
| | 370 | buf_append_str(&search_path, "\\..\\..\\include"); |
| | 371 | |
| | 372 | Buf *vcruntime_path = buf_sprintf("%s\\vcruntime.h", buf_ptr(&search_path)); |
| | 373 | bool exists; |
| | 374 | if ((err = os_file_exists(vcruntime_path, &exists))) { |
| | 375 | exists = false; |
| | 376 | } |
| | 377 | if (exists) { |
| | 378 | self->sys_include_dir = search_path; |
| | 379 | return ErrorNone; |
| | 380 | } |
| | 381 | |
| | 382 | if (verbose) { |
| | 383 | fprintf(stderr, "Unable to determine vcruntime.h path\n"); |
| | 384 | } |
| | 385 | return ErrorFileNotFound; |
| | 386 | } |
| 331 | #endif | 387 | #endif |
| 332 | | 388 | |
| 333 | void zig_libc_render(ZigLibCInstallation *self, FILE *file) { | 389 | void zig_libc_render(ZigLibCInstallation *self, FILE *file) { |
| 334 | fprintf(file, | 390 | fprintf(file, |
| 335 | "# The directory that contains `stdlib.h`.\n" | 391 | "# The directory that contains `stdlib.h`.\n" |
| 336 | "# On POSIX, include directories be found with: `cc -E -Wp,-v -xc /dev/null`\n" | 392 | "# On POSIX-like systems, include directories be found with: `cc -E -Wp,-v -xc /dev/null`\n" |
| 337 | "include_dir=%s\n" | 393 | "include_dir=%s\n" |
| 338 | "# The system-specific include directory. May be the same as `include_dir`.\n" | 394 | "# The system-specific include directory. May be the same as `include_dir`.\n" |
| 339 | "# On Windows it's the directory that includes `vcruntime.h`.\n" | 395 | "# On Windows it's the directory that includes `vcruntime.h`.\n" |
| ... | @@ -346,11 +402,11 @@ void zig_libc_render(ZigLibCInstallation *self, FILE *file) { | ... | @@ -346,11 +402,11 @@ void zig_libc_render(ZigLibCInstallation *self, FILE *file) { |
| 346 | "crt_dir=%s\n" | 402 | "crt_dir=%s\n" |
| 347 | "\n" | 403 | "\n" |
| 348 | "# The directory that contains `vcruntime.lib`.\n" | 404 | "# The directory that contains `vcruntime.lib`.\n" |
| 349 | "# Only needed when targeting Windows.\n" | 405 | "# Only needed when targeting MSVC on Windows.\n" |
| 350 | "msvc_lib_dir=%s\n" | 406 | "msvc_lib_dir=%s\n" |
| 351 | "\n" | 407 | "\n" |
| 352 | "# The directory that contains `kernel32.lib`.\n" | 408 | "# The directory that contains `kernel32.lib`.\n" |
| 353 | "# Only needed when targeting Windows.\n" | 409 | "# Only needed when targeting MSVC on Windows.\n" |
| 354 | "kernel32_lib_dir=%s\n" | 410 | "kernel32_lib_dir=%s\n" |
| 355 | "\n" | 411 | "\n" |
| 356 | , | 412 | , |
| ... | @@ -368,26 +424,34 @@ Error zig_libc_find_native(ZigLibCInstallation *self, bool verbose) { | ... | @@ -368,26 +424,34 @@ Error zig_libc_find_native(ZigLibCInstallation *self, bool verbose) { |
| 368 | #if defined(ZIG_OS_WINDOWS) | 424 | #if defined(ZIG_OS_WINDOWS) |
| 369 | ZigTarget native_target; | 425 | ZigTarget native_target; |
| 370 | get_native_target(&native_target); | 426 | get_native_target(&native_target); |
| 371 | ZigWindowsSDK *sdk; | 427 | if (target_abi_is_gnu(native_target.abi)) { |
| 372 | switch (zig_find_windows_sdk(&sdk)) { | 428 | if ((err = zig_libc_find_native_include_dir_posix(self, verbose))) |
| 373 | case ZigFindWindowsSdkErrorNone: | 429 | return err; |
| 374 | if ((err = zig_libc_find_native_msvc_include_dir(self, sdk, verbose))) | 430 | if ((err = zig_libc_find_native_crt_dir_posix(self, verbose))) |
| 375 | return err; | 431 | return err; |
| 376 | if ((err = zig_libc_find_native_msvc_lib_dir(self, sdk, verbose))) | 432 | return ErrorNone; |
| 377 | return err; | 433 | } else { |
| 378 | if ((err = zig_libc_find_kernel32_lib_dir(self, sdk, &native_target, verbose))) | 434 | ZigWindowsSDK *sdk; |
| 379 | return err; | 435 | switch (zig_find_windows_sdk(&sdk)) { |
| 380 | if ((err = zig_libc_find_native_include_dir_windows(self, sdk, verbose))) | 436 | case ZigFindWindowsSdkErrorNone: |
| 381 | return err; | 437 | if ((err = zig_libc_find_native_msvc_include_dir(self, sdk, verbose))) |
| 382 | if ((err = zig_libc_find_crt_dir_windows(self, sdk, &native_target, verbose))) | 438 | return err; |
| 383 | return err; | 439 | if ((err = zig_libc_find_native_msvc_lib_dir(self, sdk, verbose))) |
| 384 | return ErrorNone; | 440 | return err; |
| 385 | case ZigFindWindowsSdkErrorOutOfMemory: | 441 | if ((err = zig_libc_find_kernel32_lib_dir(self, sdk, &native_target, verbose))) |
| 386 | return ErrorNoMem; | 442 | return err; |
| 387 | case ZigFindWindowsSdkErrorNotFound: | 443 | if ((err = zig_libc_find_native_include_dir_windows(self, sdk, verbose))) |
| 388 | return ErrorFileNotFound; | 444 | return err; |
| 389 | case ZigFindWindowsSdkErrorPathTooLong: | 445 | if ((err = zig_libc_find_crt_dir_windows(self, sdk, &native_target, verbose))) |
| 390 | return ErrorPathTooLong; | 446 | return err; |
| | 447 | return ErrorNone; |
| | 448 | case ZigFindWindowsSdkErrorOutOfMemory: |
| | 449 | return ErrorNoMem; |
| | 450 | case ZigFindWindowsSdkErrorNotFound: |
| | 451 | return ErrorFileNotFound; |
| | 452 | case ZigFindWindowsSdkErrorPathTooLong: |
| | 453 | return ErrorPathTooLong; |
| | 454 | } |
| 391 | } | 455 | } |
| 392 | zig_unreachable(); | 456 | zig_unreachable(); |
| 393 | #else | 457 | #else |