From 4c3c6023179ac7512634d9eb799eb4ecd5c04126 Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Sat, 9 Nov 2024 22:16:12 +0800 Subject: [PATCH] test dartpy --- packages/d/dartsim/xmake.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/d/dartsim/xmake.lua b/packages/d/dartsim/xmake.lua index 652b09114cd..2024098e0cb 100644 --- a/packages/d/dartsim/xmake.lua +++ b/packages/d/dartsim/xmake.lua @@ -11,7 +11,7 @@ package("dartsim") add_versions("v6.13.0", "4da3ff8cee056252a558b05625a5ff29b21e71f2995e6d7f789abbf6261895f7") add_versions("v6.14.2", "6bbaf452f8182b97bf22adeab6cc7f3dc1cd2733358543131fa130e07c0860fc") - add_configs("dartpy", {description = "Build dartpy interface.", default = false, type = "boolean"}) + add_configs("dartpy", {description = "Build dartpy interface.", default = true, type = "boolean"}) local configdeps = {bullet3 = "Bullet", freeglut = "GLUT", nlopt = "NLOPT", @@ -32,18 +32,24 @@ package("dartsim") end add_deps("cmake") - add_deps("assimp", "libccd", "eigen", "fcl", "octomap", "fmt") + add_deps("assimp", "libccd", "eigen", "fcl", "octomap", "fmt", "pkgconf") on_load("windows|x64", "linux", "macosx", function (package) for config, dep in pairs(configdeps) do if package:config(config) then - package:add("deps", config) + package:add("deps", config, {configs = {shared = (config == "freeglut")}}) end end if package:config("dartpy") then + package:add("deps", "tinyxml2") + package:add("deps", "urdfdom") + package:add("deps", "openscenegraph") + package:add("deps", "imgui", {configs = {opengl2 = true}}) + package:add("deps", "freeglut", {configs = {shared = true}}) package:add("deps", "python 3.x") + package:add("deps", "pybind11") end if package:config("openscenegraph") then - package:add("deps", "imgui") + package:add("deps", "imgui", {configs = {opengl2 = true}}) end end) @@ -51,6 +57,7 @@ package("dartsim") io.replace("CMakeLists.txt", "/GL", "", {plain = true}) io.replace("CMakeLists.txt", "if(TARGET dart)", "if(FALSE)", {plain = true}) io.replace("dart/CMakeLists.txt", "/LTCG", "", {plain = true}) + io.replace("python/CMakeLists.txt", "FetchContent_MakeAvailable(pybind11)", "find_package(pybind11 CONFIG)", {plain = true}) io.replace("python/CMakeLists.txt", "add_subdirectory(tests)", "", {plain = true}) io.replace("python/CMakeLists.txt", "add_subdirectory(examples)", "", {plain = true}) io.replace("python/CMakeLists.txt", "add_subdirectory(tutorials)", "", {plain = true}) @@ -69,14 +76,14 @@ package("dartsim") 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")) for config, dep in pairs(configdeps) do - table.insert(configs, "-DDART_SKIP_" .. dep .. "=" .. (package:config(config) and "OFF" or "ON")) + table.insert(configs, "-DDART_SKIP_" .. dep .. "=" .. (package:dep(config) and "OFF" or "ON")) end if package:is_plat("windows") then table.insert(configs, "-DDART_RUNTIME_LIBRARY=" .. (package:config("vs_runtime"):startswith("MT") and "/MT" or "/MD")) end table.insert(configs, "-DDART_BUILD_DARTPY=" .. (package:config("dartpy") and "ON" or "OFF")) - table.insert(configs, "-DDART_BUILD_GUI_OSG=" .. (package:config("openscenegraph") and "ON" or "OFF")) - import("package.tools.cmake").install(package, configs) + table.insert(configs, "-DDART_BUILD_GUI_OSG=" .. (package:dep("openscenegraph") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs, {buildir = os.tmpfile() .. ".dir", packagedeps = {"imgui"}}) local suffix = package:is_debug() and "d" or "" for _, lib in ipairs({"dart-collision-bullet", "dart-collision-ode", "dart-gui-osg", "dart-gui", "dart-optimizer-ipopt", "dart-optimizer-nlopt", "dart-optimizer-pagmo", "dart-utils-urdf", "dart-utils", "dart", "dart-external-odelcpsolver", "dart-external-lodepng"}) do package:add("links", lib .. suffix)