fix regressions on Windows

master
Andrew Kelley 2019-02-26 16:24:32 -05:00
parent ade10387a5
commit 33174f11ef
4 changed files with 16 additions and 11 deletions

View File

@ -283,7 +283,7 @@ pub const LibCInstallation = struct {
switch (builtin.arch) {
builtin.Arch.i386 => try stream.write("x86"),
builtin.Arch.x86_64 => try stream.write("x64"),
builtin.Arch.aarch64v8 => try stream.write("arm"),
builtin.Arch.aarch64 => try stream.write("arm"),
else => return error.UnsupportedArchitecture,
}
const ucrt_lib_path = try std.os.path.join(
@ -361,7 +361,7 @@ pub const LibCInstallation = struct {
switch (builtin.arch) {
builtin.Arch.i386 => try stream.write("x86\\"),
builtin.Arch.x86_64 => try stream.write("x64\\"),
builtin.Arch.aarch64v8 => try stream.write("arm\\"),
builtin.Arch.aarch64 => try stream.write("arm\\"),
else => return error.UnsupportedArchitecture,
}
const kernel32_path = try std.os.path.join(

View File

@ -8174,20 +8174,19 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) {
args.append(buf_ptr(out_dep_path));
}
args.append("-nobuiltininc");
args.append("-nostdinc");
args.append("-nostdinc++");
if (g->libc_link_lib == nullptr) {
args.append("-nolibc");
}
args.append("-fno-spell-checking");
args.append("-isystem");
args.append(buf_ptr(g->zig_c_headers_dir));
if (g->libc != nullptr) {
if (buf_len(&g->libc->msvc_lib_dir) != 0) {
Buf *include_dir = buf_sprintf("%s" OS_SEP ".." OS_SEP ".." OS_SEP "include", buf_ptr(&g->libc->msvc_lib_dir));
args.append("-isystem");
args.append(buf_ptr(include_dir));
}
args.append("-isystem");
args.append(buf_ptr(&g->libc->include_dir));
}

View File

@ -172,7 +172,7 @@ static Error zig_libc_find_crt_dir_windows(ZigLibCInstallation *self, ZigWindows
bool verbose)
{
Error err;
if ((err = os_get_win32_ucrt_lib_path(sdk, &self->crt_dir, target->arch.arch))) {
if ((err = os_get_win32_ucrt_lib_path(sdk, &self->crt_dir, target->arch))) {
if (verbose) {
fprintf(stderr, "Unable to determine ucrt path: %s\n", err_str(err));
}
@ -184,7 +184,7 @@ static Error zig_libc_find_kernel32_lib_dir(ZigLibCInstallation *self, ZigWindow
bool verbose)
{
Error err;
if ((err = os_get_win32_kern32_path(sdk, &self->kernel32_lib_dir, target->arch.arch))) {
if ((err = os_get_win32_kern32_path(sdk, &self->kernel32_lib_dir, target->arch))) {
if (verbose) {
fprintf(stderr, "Unable to determine kernel32 path: %s\n", err_str(err));
}

View File

@ -4815,6 +4815,12 @@ Error parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const
clang_argv.append(buf_ptr(codegen->zig_c_headers_dir));
if (codegen->libc != nullptr) {
if (buf_len(&codegen->libc->msvc_lib_dir) != 0) {
Buf *include_dir = buf_sprintf("%s" OS_SEP ".." OS_SEP ".." OS_SEP "include", buf_ptr(&codegen->libc->msvc_lib_dir));
clang_argv.append("-isystem");
clang_argv.append(buf_ptr(include_dir));
}
clang_argv.append("-isystem");
clang_argv.append(buf_ptr(&codegen->libc->include_dir));
}