Browse Source

Merge pull request #4302 from Pariatech/enable_static_glfw_linux

Add static GLFW bindings for Linux
Laytan 10 months ago
parent
commit
085b725774
1 changed files with 12 additions and 2 deletions
  1. 12 2
      vendor/glfw/bindings/bindings.odin

+ 12 - 2
vendor/glfw/bindings/bindings.odin

@@ -3,7 +3,7 @@ package glfw_bindings
 import "core:c"
 import "core:c"
 import vk "vendor:vulkan"
 import vk "vendor:vulkan"
 
 
-GLFW_SHARED :: #config(GLFW_SHARED, false)
+GLFW_SHARED :: #config(GLFW_SHARED, ODIN_OS != .Windows && ODIN_OS != .Darwin)
 
 
 when ODIN_OS == .Windows {
 when ODIN_OS == .Windows {
 	when GLFW_SHARED {
 	when GLFW_SHARED {
@@ -38,7 +38,17 @@ when ODIN_OS == .Windows {
 		}
 		}
 	}
 	}
 } else {
 } else {
-	foreign import glfw "system:glfw"
+	when GLFW_SHARED {
+		foreign import glfw "system:glfw"
+	} else {
+		@(private)
+		LIBGLFW3 :: "../lib/libglfw3.a"
+		when !#exists(LIBGLFW3) {
+			#panic("Could not find the static glfw library, add it at \"" + ODIN_ROOT + "vendor/glfw/lib/\"`")
+		}
+
+		foreign import glfw { LIBGLFW3 }
+	}
 }
 }
 
 
 #assert(size_of(c.int) == size_of(b32))
 #assert(size_of(c.int) == size_of(b32))