build: Windows x86_64 support #5

Closed
opened 2021-07-18 22:37:50 +00:00 by emidoots · 3 comments
emidoots commented 2021-07-18 22:37:50 +00:00 (Migrated from github.com)
No description provided.
wilsonk commented 2021-07-24 10:18:01 +00:00 (Migrated from github.com)

This small patch will get things to build on Win10 using MSYS2 or git-bash. All 32 tests pass with this patch.

diff --git a/glfw/build.zig b/glfw/build.zig
index a0ca24b..1169031 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);
@@ -175,6 +175,7 @@ fn linkGLFW(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void
     switch (target.os.tag) {
         .windows => {
             // TODO(slimsag): create sdk-windows
+            step.linkSystemLibrary("gdi32");
             step.linkSystemLibrary("c");
         },
         .macos => {
This small patch will get things to build on Win10 using MSYS2 or git-bash. All 32 tests pass with this patch. ``` diff --git a/glfw/build.zig b/glfw/build.zig index a0ca24b..1169031 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); @@ -175,6 +175,7 @@ fn linkGLFW(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void switch (target.os.tag) { .windows => { // TODO(slimsag): create sdk-windows + step.linkSystemLibrary("gdi32"); step.linkSystemLibrary("c"); }, .macos => { ```
emidoots commented 2021-07-26 06:18:18 +00:00 (Migrated from github.com)

Fixed by #14 - Windows cross compilation from all OS is now verified by CI as well. Our platform support is getting there... 🏃

image
Fixed by #14 - Windows cross compilation from all OS is now verified by CI as well. Our platform support is getting there... 🏃 <img width="923" alt="image" src="https://user-images.githubusercontent.com/3173176/126941893-be9c339c-0192-4d7e-9a5e-a8a146d34ee6.png">
wilsonk commented 2021-07-26 06:20:19 +00:00 (Migrated from github.com)

Nice :)

Nice :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#5
No description provided.