xmake.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package("remotery")
  2. set_homepage("https://github.com/Celtoys/Remotery")
  3. set_description("Single C file, Realtime CPU/GPU Profiler with Remote Web Viewer")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/Celtoys/Remotery.git")
  6. add_versions("2023.08.02", "4e65390c4289bbb3494accf1aa36e58733aca2bf")
  7. add_configs("cuda", {description = "Assuming CUDA headers/libs are setup, allow CUDA profiling", default = false, type = "boolean"})
  8. add_configs("dx11", {description = "Assuming Direct3D 11 headers/libs are setup, allow D3D11 GPU profiling", default = false, type = "boolean"})
  9. add_configs("dx12", {description = "Allow D3D12 GPU profiling", default = false, type = "boolean"})
  10. add_configs("opengl", {description = "Allow OpenGL GPU profiling (dynamically links OpenGL libraries on available platforms)", default = false, type = "boolean"})
  11. add_configs("metal", {description = "Allow Metal profiling of command buffers", default = false, type = "boolean"})
  12. if is_plat("windows", "mingw") then
  13. add_syslinks("ws2_32", "winmm")
  14. elseif is_plat("linux", "bsd") then
  15. add_syslinks("pthread", "m")
  16. end
  17. on_install("windows|x64", "linux", "macosx", "bsd", "mingw|x86_64", "msys", "android", "iphoneos", "cross", function (package)
  18. local configs = {}
  19. if package:config("cuda") then
  20. configs.cuda = true
  21. package:add("defines", "RMT_USE_CUDA=1")
  22. end
  23. if package:config("dx11") then
  24. configs.dx11 = true
  25. package:add("defines", "RMT_USE_D3D11=1")
  26. end
  27. if package:config("dx12") then
  28. configs.dx12 = true
  29. package:add("defines", "RMT_USE_D3D12=1")
  30. end
  31. if package:config("opengl") then
  32. configs.opengl = true
  33. package:add("defines", "RMT_USE_OPENGL=1")
  34. end
  35. if package:config("metal") then
  36. configs.metal = true
  37. package:add("defines", "RMT_USE_METAL=1")
  38. end
  39. io.replace("lib/Remotery.c", [[#pragma comment(lib, "ws2_32.lib")]], "", {plain = true})
  40. io.replace("lib/Remotery.c", [[#pragma comment(lib, "winmm.lib")]], "", {plain = true})
  41. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  42. import("package.tools.xmake").install(package, configs)
  43. os.cp("vis", package:installdir())
  44. end)
  45. on_test(function (package)
  46. assert(package:has_cfuncs("_rmt_Settings", {includes = "Remotery.h"}))
  47. end)