xmake.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.1.0", "307ba86a724adc84a875e8bd2374baad0fabc77797f20f9a1779eef8d9ffe95a")
  8. add_versions("v1.0.1", "b98c63f1905f0e4cf99229de8b7e5c2693fdf3b8d684b5a43d60f21f67d33e6b")
  9. add_deps("wgpu-native", "glfw")
  10. if is_plat("macosx", "iphoneos") then
  11. add_frameworks("Metal", "Foundation")
  12. end
  13. on_install("windows|x64", "windows|x86", "linux|x86_64", "macosx|x86_64", "macosx|arm64", function (package)
  14. if package:is_plat("macosx", "iphoneos") then
  15. os.mv("glfw3webgpu.c", "glfw3webgpu.m")
  16. end
  17. io.writefile("xmake.lua", [[
  18. add_rules("mode.debug", "mode.release")
  19. add_requires("wgpu-native", "glfw")
  20. target("glfw3webgpu")
  21. set_kind("$(kind)")
  22. set_languages("c11")
  23. add_headerfiles("glfw3webgpu.h")
  24. add_mxflags("-fno-objc-arc")
  25. add_packages("wgpu-native")
  26. add_packages("glfw")
  27. if is_plat("iphoneos", "macosx") then
  28. add_frameworks("Metal", "Foundation")
  29. add_files("glfw3webgpu.m")
  30. else
  31. add_files("glfw3webgpu.c")
  32. end
  33. if is_plat("windows") and is_kind("shared") then
  34. add_rules("utils.symbols.export_all")
  35. end
  36. ]])
  37. import("package.tools.xmake").install(package)
  38. end)
  39. on_test(function (package)
  40. assert(package:has_cfuncs("glfwGetWGPUSurface", {includes = "glfw3webgpu.h"}))
  41. end)