xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package("sdl3webgpu")
  2. set_description("An extension for the SDL3 library for using WebGPU native.")
  3. set_homepage("https://github.com/eliemichel/sdl3webgpu")
  4. set_license("MIT")
  5. -- Version 1.0.0 is too old for the current wgpu-native, we have to fetch a newer version from a more recent commit
  6. add_urls("https://github.com/eliemichel/sdl3webgpu.git")
  7. add_versions("2025.05.01", "4fa9d70935e41c075f664b231ee10a64262a8ac7")
  8. add_deps("wgpu-native", "libsdl3")
  9. if is_plat("macosx", "iphoneos") then
  10. add_frameworks("CoreVideo", "IOKit", "QuartzCore", is_plat("macosx") and "Cocoa" or "UIKit")
  11. end
  12. on_install("windows|x64", "windows|x86", "linux|x86_64", "macosx|x86_64", "macosx|arm64", function (package)
  13. if package:is_plat("macosx", "iphoneos") then
  14. os.mv("sdl3webgpu.c", "sdl3webgpu.m")
  15. end
  16. io.writefile("xmake.lua", [[
  17. add_rules("mode.debug", "mode.release")
  18. add_requires("wgpu-native", "libsdl3")
  19. target("sdl3webgpu")
  20. set_kind("$(kind)")
  21. set_languages("c11")
  22. add_headerfiles("sdl3webgpu.h")
  23. add_mxflags("-fno-objc-arc")
  24. add_packages("wgpu-native")
  25. add_packages("libsdl3")
  26. if is_plat("macosx", "iphoneos") then
  27. add_frameworks("CoreVideo", "IOKit", "QuartzCore", is_plat("macosx") and "Cocoa" or "UIKit")
  28. add_files("sdl3webgpu.m")
  29. else
  30. add_files("sdl3webgpu.c")
  31. end
  32. if is_plat("windows") and is_kind("shared") then
  33. add_rules("utils.symbols.export_all")
  34. end
  35. ]])
  36. import("package.tools.xmake").install(package, configs)
  37. end)
  38. on_test(function (package)
  39. assert(package:has_cfuncs("SDL_GetWGPUSurface", {includes = "sdl3webgpu.h"}))
  40. end)