xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package("glfw3webgpu")
  2. set_description("An extension for the GLFW library for using WebGPU native.")
  3. set_homepage("https://github.com/eliemichel/glfw3webgpu")
  4. set_license("MIT")
  5. add_urls("https://github.com/eliemichel/glfw3webgpu/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/eliemichel/glfw3webgpu.git")
  7. add_versions("v1.2.0", "28387b960aff573728bde2bf0fa876c33608cdadaca8d23f4a46cd31920ab633")
  8. add_versions("v1.1.0", "307ba86a724adc84a875e8bd2374baad0fabc77797f20f9a1779eef8d9ffe95a")
  9. add_versions("v1.0.1", "b98c63f1905f0e4cf99229de8b7e5c2693fdf3b8d684b5a43d60f21f67d33e6b")
  10. add_deps("wgpu-native", "glfw")
  11. if is_plat("macosx", "iphoneos") then
  12. add_frameworks("Metal", "Foundation")
  13. end
  14. on_install("windows|x64", "windows|x86", "linux|x86_64", "macosx|x86_64", "macosx|arm64", function (package)
  15. if package:is_plat("macosx", "iphoneos") then
  16. os.mv("glfw3webgpu.c", "glfw3webgpu.m")
  17. end
  18. io.writefile("xmake.lua", [[
  19. add_rules("mode.debug", "mode.release")
  20. add_requires("wgpu-native", "glfw")
  21. target("glfw3webgpu")
  22. set_kind("$(kind)")
  23. set_languages("c11")
  24. add_headerfiles("glfw3webgpu.h")
  25. add_mxflags("-fno-objc-arc")
  26. add_packages("wgpu-native")
  27. add_packages("glfw")
  28. if is_plat("iphoneos", "macosx") then
  29. add_frameworks("Metal", "Foundation")
  30. add_files("glfw3webgpu.m")
  31. else
  32. add_files("glfw3webgpu.c")
  33. end
  34. if is_plat("windows") and is_kind("shared") then
  35. add_rules("utils.symbols.export_all")
  36. end
  37. ]])
  38. import("package.tools.xmake").install(package)
  39. end)
  40. on_test(function (package)
  41. assert(package:has_cfuncs("glfwGetWGPUSurface", {includes = "glfw3webgpu.h"}))
  42. end)