xmake.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package("optick")
  2. set_homepage("https://optick.dev")
  3. set_description("C++ Profiler For Games (API)")
  4. set_license("MIT")
  5. add_urls("https://github.com/bombomby/optick/archive/refs/tags/$(version).0.tar.gz", {alias="archive"})
  6. add_urls("https://github.com/bombomby/optick.git", {alias="git"})
  7. add_versions("archive:1.4.0", "8ff386246542654f96a4c1bcc61b7f2f0e498731ed11cd44401baf0c89789b18")
  8. add_versions("archive:1.3.1", "3670f44219f4d99a6d630c8364c6757d26d7226b0cfd007ee589186397362cc9")
  9. add_versions("git:1.4.0", "1.4.0.0")
  10. add_versions("git:1.3.1", "1.3.1.0")
  11. add_configs("vulkan", {description = "Built-in support for Vulkan", default = false, type = "boolean"})
  12. add_configs("d3d12", {description = "Built-in support for DirectX 12", default = false, type = "boolean"})
  13. if is_plat("windows") then
  14. add_syslinks("Advapi32")
  15. end
  16. add_deps("cmake")
  17. on_install("windows|x86", "windows|x64", "linux", "macosx", "android", "cross", function (package)
  18. local configs = {}
  19. table.insert(configs, "-DOPTICK_INSTALL_TARGETS=ON")
  20. table.insert(configs, "-DOPTICK_BUILD_GUI_APP=OFF")
  21. table.insert(configs, "-DOPTICK_BUILD_CONSOLE_SAMPLE=OFF")
  22. table.insert(configs, "-DOPTICK_USE_VULKAN=" .. (package:config("vulkan") and "ON" or "OFF"))
  23. table.insert(configs, "-DOPTICK_USE_D3D12=" .. (package:config("d3d12") and "ON" or "OFF"))
  24. if not package:config("shared") then
  25. io.replace("CMakeLists.txt", "SHARED", "STATIC")
  26. end
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test=[[
  31. void test(int args, char* argv[]) {
  32. float v = 6.0f;
  33. for (int i = 0;i < 5; i++) {
  34. OPTICK_FRAME("MainThread");
  35. v *= v * v + (float)i;
  36. }
  37. }
  38. ]]}, {configs = {languages = "c++11"}, includes = "optick.h"}))
  39. end)