mirror of
https://github.com/ziglang/zig.git
synced 2025-01-31 14:21:14 +00:00
fix compilation under mingw
This commit is contained in:
parent
1a4f46ae7d
commit
de08d283da
@ -454,6 +454,9 @@ if("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
|
|||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
)
|
)
|
||||||
set(ZIG_EXECUTABLE "${zig_BINARY_DIR}/zig")
|
set(ZIG_EXECUTABLE "${zig_BINARY_DIR}/zig")
|
||||||
|
if (WIN32)
|
||||||
|
set(ZIG_EXECUTABLE "${ZIG_EXECUTABLE}.exe")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
add_custom_target(zig_build_libstage2 ALL
|
add_custom_target(zig_build_libstage2 ALL
|
||||||
COMMAND "${ZIG_EXECUTABLE}" ${BUILD_LIBSTAGE2_ARGS}
|
COMMAND "${ZIG_EXECUTABLE}" ${BUILD_LIBSTAGE2_ARGS}
|
||||||
|
@ -897,6 +897,22 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file:
|
|||||||
return .None;
|
return .None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn enumToString(value: var, type_name: []const u8) ![]const u8 {
|
||||||
|
switch (@typeInfo(@TypeOf(value))) {
|
||||||
|
.Enum => |e| {
|
||||||
|
if (e.is_exhaustive) {
|
||||||
|
return std.fmt.allocPrint(std.heap.c_allocator, ".{}", .{@tagName(value)});
|
||||||
|
} else {
|
||||||
|
return std.fmt.allocPrint(std.heap.c_allocator,
|
||||||
|
"@intToEnum({}, {})",
|
||||||
|
.{type_name, @enumToInt(value)}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
else => unreachable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ABI warning
|
// ABI warning
|
||||||
const Stage2Target = extern struct {
|
const Stage2Target = extern struct {
|
||||||
arch: c_int,
|
arch: c_int,
|
||||||
@ -1114,13 +1130,13 @@ const Stage2Target = extern struct {
|
|||||||
|
|
||||||
.windows => try os_builtin_str_buffer.outStream().print(
|
.windows => try os_builtin_str_buffer.outStream().print(
|
||||||
\\ .windows = .{{
|
\\ .windows = .{{
|
||||||
\\ .min = .{},
|
\\ .min = {},
|
||||||
\\ .max = .{},
|
\\ .max = {},
|
||||||
\\ }}}},
|
\\ }}}},
|
||||||
\\
|
\\
|
||||||
, .{
|
, .{
|
||||||
@tagName(target.os.version_range.windows.min),
|
try enumToString(target.os.version_range.windows.min, "Target.Os.WindowsVersion"),
|
||||||
@tagName(target.os.version_range.windows.max),
|
try enumToString(target.os.version_range.windows.max, "Target.Os.WindowsVersion")
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
try os_builtin_str_buffer.appendSlice("};\n");
|
try os_builtin_str_buffer.appendSlice("};\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user