xmake.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_versions("2025.06.16", "ac41ab88a32d0c247009d8ed456fd2795c1ee023")
  9. add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"})
  10. add_configs("c_api", {description = "Builds the C API library wrapper", default = true, type = "boolean"})
  11. if is_plat("linux", "bsd") then
  12. add_syslinks("pthread")
  13. end
  14. on_load(function (package)
  15. if not package:config("c_api") then
  16. package:set("kind", "library", {headeronly = true})
  17. end
  18. end)
  19. on_install(function (package)
  20. os.cp("src/bvh", package:installdir("include"))
  21. if package:config("c_api") then
  22. io.writefile("xmake.lua", [[
  23. add_rules("mode.debug", "mode.release")
  24. set_languages("c++20")
  25. target("bvh_c")
  26. set_kind("shared")
  27. add_defines("BVH_BUILD_API")
  28. add_files("src/bvh/v2/c_api/bvh.cpp")
  29. add_includedirs("src")
  30. ]])
  31. import("package.tools.xmake").install(package)
  32. end
  33. end)
  34. on_test(function (package)
  35. assert(package:check_cxxsnippets({test = [[
  36. #include <bvh/v2/thread_pool.h>
  37. void test() {
  38. bvh::v2::ThreadPool thread_pool;
  39. }
  40. ]]}, {configs = {languages = "c++20"}}))
  41. end)