Ver código fonte

glfw3webgpu: add defines on package loading (#7800)

* glfw3webgpu: add defines on package loading

* glfw3webgpu: put dependencies back
Miouzora 1 mês atrás
pai
commit
bbbf21f553
1 arquivos alterados com 19 adições e 5 exclusões
  1. 19 5
      packages/g/glfw3webgpu/xmake.lua

+ 19 - 5
packages/g/glfw3webgpu/xmake.lua

@@ -2,7 +2,7 @@ package("glfw3webgpu")
     set_description("An extension for the GLFW library for using WebGPU native.")
     set_homepage("https://github.com/eliemichel/glfw3webgpu")
     set_license("MIT")
-    
+
     add_urls("https://github.com/eliemichel/glfw3webgpu/archive/refs/tags/$(version).tar.gz",
              "https://github.com/eliemichel/glfw3webgpu.git")
 
@@ -17,6 +17,20 @@ package("glfw3webgpu")
         add_frameworks("Metal", "Foundation", "QuartzCore")
     end
 
+    on_load(function (package)
+        if package:is_plat("windows") then
+            package:add("defines", "GLFW_EXPOSE_NATIVE_WIN32")
+        elseif package:is_plat("macosx", "iphoneos") then
+            package:add("defines", "GLFW_EXPOSE_NATIVE_COCOA")
+        end
+
+        if package:config("x11") then
+            package:add("defines", "GLFW_EXPOSE_NATIVE_X11")
+        elseif package:config("wayland") then
+            package:add("defines", "GLFW_EXPOSE_NATIVE_WAYLAND")
+        end
+    end)
+
     on_install("windows|x64", "windows|x86", "linux|x86_64", "macosx|x86_64", "macosx|arm64", function (package)
         if package:is_plat("macosx", "iphoneos") then
             os.mv("glfw3webgpu.c", "glfw3webgpu.m")
@@ -45,19 +59,19 @@ package("glfw3webgpu")
                 set_kind("$(kind)")
                 set_languages("c11")
                 add_headerfiles("glfw3webgpu.h")
-                
+
                 add_mxflags("-fno-objc-arc")
-                
+
                 add_packages("wgpu-native")
                 add_packages("glfw")
-                
+
                 if is_plat("iphoneos", "macosx") then
                     add_frameworks("Metal", "Foundation", "QuartzCore")
                     add_files("glfw3webgpu.m")
                 else
                     add_files("glfw3webgpu.c")
                 end
-                
+
                 if is_plat("windows") and is_kind("shared") then
                     add_rules("utils.symbols.export_all")
                 end