glfw: build windows sources

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-07-10 01:36:15 -07:00
parent f9150de8d0
commit ef4e335ccd

View file

@ -36,14 +36,31 @@ pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void
const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target; const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
switch (target.os.tag) { switch (target.os.tag) {
.windows => { .windows => {
// TODO(slimsag): implement var sources = std.ArrayList([]const u8).init(&arena.allocator);
// upstream/glfw/src/win32_thread.c for ([_][]const u8{
// upstream/glfw/src/wgl_context.c // Windows-specific sources
// upstream/glfw/src/win32_init.c "upstream/glfw/src/win32_thread.c",
// upstream/glfw/src/win32_monitor.c "upstream/glfw/src/wgl_context.c",
// upstream/glfw/src/win32_time.c "upstream/glfw/src/win32_init.c",
// upstream/glfw/src/win32_joystick.c "upstream/glfw/src/win32_monitor.c",
// upstream/glfw/src/win32_window.c "upstream/glfw/src/win32_time.c",
"upstream/glfw/src/win32_joystick.c",
"upstream/glfw/src/win32_window.c",
// General sources
"upstream/glfw/src/monitor.c",
"upstream/glfw/src/init.c",
"upstream/glfw/src/vulkan.c",
"upstream/glfw/src/input.c",
"upstream/glfw/src/osmesa_context.c",
"upstream/glfw/src/egl_context.c",
"upstream/glfw/src/context.c",
"upstream/glfw/src/window.c",
}) |path| {
var abs_path = std.fs.path.join(&arena.allocator, &.{ thisDir(), path }) catch unreachable;
sources.append(abs_path) catch unreachable;
}
lib.addCSourceFiles(sources.items, &.{});
}, },
.macos => { .macos => {
var sources = std.ArrayList([]const u8).init(&arena.allocator); var sources = std.ArrayList([]const u8).init(&arena.allocator);
@ -106,7 +123,9 @@ fn linkGLFW(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void
const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target; const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
switch (target.os.tag) { switch (target.os.tag) {
.windows => {}, .windows => {
// TODO(slimsag): create sdk-windows
},
.macos => { .macos => {
const sdk_root_dir = getSdkRoot(b.allocator, "sdk-macos-11.3") catch unreachable; const sdk_root_dir = getSdkRoot(b.allocator, "sdk-macos-11.3") catch unreachable;
defer b.allocator.free(sdk_root_dir); defer b.allocator.free(sdk_root_dir);
@ -128,6 +147,7 @@ fn linkGLFW(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void
}, },
else => { else => {
// Assume Linux-like // Assume Linux-like
// TODO(slimsag): create sdk-linux
}, },
} }
} }