From 45125bec552ec9102a08bfe5097a4d5b839c26cd Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 25 Jul 2021 22:30:20 -0700 Subject: [PATCH] glfw: add Windows x86_64 support Signed-off-by: Stephen Gutekanst --- glfw/build.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/glfw/build.zig b/glfw/build.zig index d7787a87..6e149ec4 100644 --- a/glfw/build.zig +++ b/glfw/build.zig @@ -71,7 +71,7 @@ pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void var abs_path = std.fs.path.join(&arena.allocator, &.{ thisDir(), path }) catch unreachable; sources.append(abs_path) catch unreachable; } - lib.addCSourceFiles(sources.items, &.{}); + lib.addCSourceFiles(sources.items, &.{"-D_GLFW_WIN32"}); }, .macos => { includeSdkMacOS(b, lib); @@ -174,8 +174,14 @@ 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; switch (target.os.tag) { .windows => { - // TODO(slimsag): create sdk-windows step.linkSystemLibrary("c"); + step.linkSystemLibrary("gdi32"); + if (options.opengl) { + step.linkFramework("opengl32"); + } + if (options.gles) { + step.linkFramework("GLESv2"); + } }, .macos => { includeSdkMacOS(b, step);