Browse Source

add libccd and ode (#509)

* add libccd

* add ode

* fix ode
Hoildkv 4 năm trước cách đây
mục cha
commit
4ff5c7f005
2 tập tin đã thay đổi với 64 bổ sung0 xóa
  1. 33 0
      packages/l/libccd/xmake.lua
  2. 31 0
      packages/o/ode/xmake.lua

+ 33 - 0
packages/l/libccd/xmake.lua

@@ -0,0 +1,33 @@
+package("libccd")
+
+    set_homepage("https://github.com/danfis/libccd/")
+    set_description("libccd is library for a collision detection between two convex shapes.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/danfis/libccd/archive/refs/tags/$(version).tar.gz")
+    add_versions("v2.1", "542b6c47f522d581fbf39e51df32c7d1256ac0c626e7c2b41f1040d4b9d50d1e")
+
+    add_configs("double_precision", {description = "Enable double precision floating-point arithmetic.", default = false, type = "boolean"})
+
+    on_load("windows", "macosx", "linux", function (package)
+        if not package:config("shared") then
+            package:add("defines", "CCD_STATIC_DEFINE")
+        end
+        if not package.is_built or package:is_built() then
+            package:add("deps", "cmake")
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DCCD_HIDE_ALL_SYMBOLS=" .. (package:config("shared") and "OFF" or "ON"))
+        table.insert(configs, "-DENABLE_DOUBLE_PRECISION=" .. (package:config("double_precision") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("ccdFirstDirDefault", {includes = "ccd/ccd.h"}))
+    end)
+

+ 31 - 0
packages/o/ode/xmake.lua

@@ -0,0 +1,31 @@
+package("ode")
+
+    set_homepage("http://ode.org/")
+    set_description("ODE is an open source, high performance library for simulating rigid body dynamics.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://bitbucket.org/odedevs/ode/get/$(version).zip")
+    add_versions("0.16.2", "000a5cdd0a81811cade2b0409ec06911a95e3c4c0d72a4cce3af6131115d0350")
+
+    add_configs("libccd", {description = "Build with libccd.", default = false, type = "boolean"})
+
+    add_deps("cmake")
+    if is_plat("windows") then
+        add_syslinks("user32")
+    elseif is_plat("linux") then
+        add_syslinks("pthread")
+    end
+
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-DODE_WITH_DEMOS=OFF", "-DODE_WITH_TESTS=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        if package:config("libccd") then
+            table.insert(configs, "-DODE_WITH_LIBCCD=ON")
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("dInitODE", {includes = "ode/odeinit.h"}))
+    end)