Skip to content

Commit ef26409

Browse files
libccd: add more platform support (#8808)
* libccd: add more platform support * limit wasm shared
1 parent 5194a2e commit ef26409

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

packages/l/libccd/xmake.lua

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
package("libccd")
2-
32
set_homepage("https://github.com/danfis/libccd/")
43
set_description("libccd is library for a collision detection between two convex shapes.")
54
set_license("BSD-3-Clause")
@@ -9,29 +8,27 @@ package("libccd")
98
add_versions("v2.1", "542b6c47f522d581fbf39e51df32c7d1256ac0c626e7c2b41f1040d4b9d50d1e")
109

1110
add_configs("double_precision", {description = "Enable double precision floating-point arithmetic.", default = false, type = "boolean"})
11+
if is_plat("wasm") then
12+
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
13+
end
1214

13-
on_load("windows", "macosx", "linux", "mingw", "cross", function (package)
14-
if not package.is_built or package:is_built() then
15-
package:add("deps", "cmake")
16-
end
17-
end)
15+
add_deps("cmake")
1816

19-
on_install("windows", "macosx", "linux", "mingw", "cross", function (package)
17+
on_install(function (package)
2018
io.replace("src/ccd/ccd_export.h", "def CCD_STATIC_DEFINE", package:config("shared") and " 0" or " 1", {plain = true})
21-
local configs = {}
22-
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
23-
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
24-
table.insert(configs, "-DCCD_HIDE_ALL_SYMBOLS=" .. (package:config("shared") and "OFF" or "ON"))
25-
table.insert(configs, "-DENABLE_DOUBLE_PRECISION=" .. (package:config("double_precision") and "ON" or "OFF"))
2619

2720
io.replace("src/CMakeLists.txt", " find_library(LIBM_LIBRARY NAMES m)", "", {plain = true})
2821
io.replace("src/CMakeLists.txt", " if(NOT LIBM_LIBRARY)", "if(OFF)", {plain = true})
2922
io.replace("src/CMakeLists.txt", " target_link_libraries(ccd \"${LIBM_LIBRARY}\")", " target_link_libraries(ccd -lm)", {plain = true})
3023

24+
local configs = {}
25+
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
26+
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
27+
table.insert(configs, "-DCCD_HIDE_ALL_SYMBOLS=" .. (package:config("shared") and "OFF" or "ON"))
28+
table.insert(configs, "-DENABLE_DOUBLE_PRECISION=" .. (package:config("double_precision") and "ON" or "OFF"))
3129
import("package.tools.cmake").install(package, configs)
3230
end)
3331

3432
on_test(function (package)
3533
assert(package:has_cfuncs("ccdFirstDirDefault", {includes = "ccd/ccd.h"}))
3634
end)
37-

0 commit comments

Comments
 (0)