xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("bvh")
  2. set_homepage("https://github.com/madmann91/bvh")
  3. set_description("A modern C++ BVH construction and traversal library")
  4. set_license("MIT")
  5. add_urls("https://github.com/madmann91/bvh.git")
  6. add_versions("2023.6.30", "578b1e8035743d0a97fcac802de81622c54f28e3")
  7. add_versions("2024.7.8", "77a08cac234bae46abbb5e78c73e8f3c158051d0")
  8. add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"})
  9. add_configs("c_api", {description = "Builds the C API library wrapper", default = true, type = "boolean"})
  10. if is_plat("bsd") then
  11. add_syslinks("pthread")
  12. end
  13. on_load(function (package)
  14. if not package:config("c_api") then
  15. package:set("kind", "library", {headeronly = true})
  16. end
  17. end)
  18. on_install(function (package)
  19. os.cp("src/bvh", package:installdir("include"))
  20. if package:config("c_api") then
  21. io.writefile("xmake.lua", [[
  22. add_rules("mode.debug", "mode.release")
  23. set_languages("c++20")
  24. target("bvh_c")
  25. set_kind("shared")
  26. add_defines("BVH_BUILD_API")
  27. add_files("src/bvh/v2/c_api/bvh.cpp")
  28. add_includedirs("src")
  29. ]])
  30. import("package.tools.xmake").install(package)
  31. end
  32. end)
  33. on_test(function (package)
  34. assert(package:check_cxxsnippets({test = [[
  35. #include <bvh/v2/thread_pool.h>
  36. void test() {
  37. bvh::v2::ThreadPool thread_pool;
  38. }
  39. ]]}, {configs = {languages = "c++20"}}))
  40. end)