From 4ff5c7f005515888fdfe7c25142fb7347884a7b8 Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Fri, 23 Jul 2021 07:33:47 +0800 Subject: [PATCH] add libccd and ode (#509) * add libccd * add ode * fix ode --- packages/l/libccd/xmake.lua | 33 +++++++++++++++++++++++++++++++++ packages/o/ode/xmake.lua | 31 +++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 packages/l/libccd/xmake.lua create mode 100644 packages/o/ode/xmake.lua diff --git a/packages/l/libccd/xmake.lua b/packages/l/libccd/xmake.lua new file mode 100644 index 000000000..0455179c1 --- /dev/null +++ b/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) + diff --git a/packages/o/ode/xmake.lua b/packages/o/ode/xmake.lua new file mode 100644 index 000000000..d4db9dc74 --- /dev/null +++ b/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)