Skip to content

Commit

Permalink
test dartpy
Browse files Browse the repository at this point in the history
  • Loading branch information
xq114 committed Nov 9, 2024
1 parent 6d99ed9 commit 4c3c602
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/d/dartsim/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -32,25 +32,32 @@ 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)

on_install("windows|x64", "linux", "macosx", function (package)
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})
Expand All @@ -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)
Expand Down

0 comments on commit 4c3c602

Please sign in to comment.