added glfw3webgpu (#2528)

* added glfw3webgpu

* glfw3webgpu should export symbols in the windows dll

* glfw3webgpu only allows itself to install on wgpu platforms
pull/2535/head
Yotam Gingold 1 year ago committed by GitHub
parent f271db65f2
commit 345e5df34f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 53
      packages/g/glfw3webgpu/xmake.lua

@ -0,0 +1,53 @@
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")
add_versions("v1.0.1", "b98c63f1905f0e4cf99229de8b7e5c2693fdf3b8d684b5a43d60f21f67d33e6b")
add_deps("wgpu-native", "glfw")
if is_plat("macosx", "iphoneos") then
add_frameworks("Metal", "Foundation")
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")
end
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
add_requires("wgpu-native", "glfw")
target("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")
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
]])
import("package.tools.xmake").install(package)
end)
on_test(function (package)
assert(package:has_cfuncs("glfwGetWGPUSurface", {includes = "glfw3webgpu.h"}))
end)
Loading…
Cancel
Save