From 440b3d759d6bdb124a28e4249e02bba648410aeb Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Mon, 8 Jul 2024 00:03:28 +0800 Subject: [PATCH 1/3] update bvh --- packages/b/bvh/xmake.lua | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/packages/b/bvh/xmake.lua b/packages/b/bvh/xmake.lua index 2439fe9cd3c..e0f8bbdb219 100644 --- a/packages/b/bvh/xmake.lua +++ b/packages/b/bvh/xmake.lua @@ -1,18 +1,36 @@ package("bvh") - set_kind("library", {headeronly = true}) set_homepage("https://github.com/madmann91/bvh") set_description("A modern C++ BVH construction and traversal library") set_license("MIT") add_urls("https://github.com/madmann91/bvh.git") add_versions("2023.6.30", "578b1e8035743d0a97fcac802de81622c54f28e3") + add_versions("2024.7.8", "77a08cac234bae46abbb5e78c73e8f3c158051d0") - on_install(function (package) - if not package:is_plat("cross") then - package:add("cxxflags", "-march=native") + add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"}) + add_configs("c_api", {description = "Builds the C API library wrapper", default = false, type = "boolean"}) + + on_load(function (package) + if not package:config("c_api") then + package:set("kind", "library", {headeronly = true}) end + end) + + on_install(function (package) os.cp("src/bvh", package:installdir("include")) + if package:config("c_api") then + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + set_languages("c++20") + target("bvh_c") + set_kind("shared") + add_defines("BVH_BUILD_API") + add_files("src/bvh/v2/c_api/bvh.cpp") + add_includedirs("src") + ]]) + import("package.tools.xmake").install(package) + end end) on_test(function (package) From 52fed3cb4646f22dd95674ed983346961afd2960 Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Mon, 8 Jul 2024 00:31:03 +0800 Subject: [PATCH 2/3] test c_api --- packages/b/bvh/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/b/bvh/xmake.lua b/packages/b/bvh/xmake.lua index e0f8bbdb219..ee68636a6ed 100644 --- a/packages/b/bvh/xmake.lua +++ b/packages/b/bvh/xmake.lua @@ -9,7 +9,7 @@ package("bvh") add_versions("2024.7.8", "77a08cac234bae46abbb5e78c73e8f3c158051d0") add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"}) - add_configs("c_api", {description = "Builds the C API library wrapper", default = false, type = "boolean"}) + add_configs("c_api", {description = "Builds the C API library wrapper", default = true, type = "boolean"}) on_load(function (package) if not package:config("c_api") then From 7b24aca0df534d5c0b53a0e930145b6d53f548de Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Mon, 8 Jul 2024 01:15:17 +0800 Subject: [PATCH 3/3] add pthread on bsd --- packages/b/bvh/xmake.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/b/bvh/xmake.lua b/packages/b/bvh/xmake.lua index ee68636a6ed..74620aa0b28 100644 --- a/packages/b/bvh/xmake.lua +++ b/packages/b/bvh/xmake.lua @@ -11,6 +11,9 @@ package("bvh") add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"}) add_configs("c_api", {description = "Builds the C API library wrapper", default = true, type = "boolean"}) + if is_plat("bsd") then + add_syslinks("pthread") + end on_load(function (package) if not package:config("c_api") then package:set("kind", "library", {headeronly = true})