-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
/
Copy pathdartsim.rb
81 lines (71 loc) · 2.73 KB
/
dartsim.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
class Dartsim < Formula
desc "Dynamic Animation and Robotics Toolkit"
homepage "https://dartsim.github.io/"
url "https://github.com/dartsim/dart/archive/refs/tags/v6.15.0.tar.gz"
sha256 "bbf954e283f464f6d0a8a5ab43ce92fd49ced357ccdd986c7cb4c29152df8692"
license "BSD-2-Clause"
revision 1
bottle do
sha256 arm64_sequoia: "1ed8e40ca64229dad1401fb93200a56bae92e35afae5ba15094f82cbcf847da8"
sha256 arm64_sonoma: "a8d4b9548c86cbd6977b25d4efa23d6a7a06e7c65b5de78d0825f74063652bf6"
sha256 arm64_ventura: "9568155ae97f84ef84876c9aa469aee5de98bf6ab5767d8db5c2e3d2ff12e68d"
sha256 sonoma: "1c9274a2fdc91aa6831e3f8a5762cf5a3e98020c2ada27173725c94044824f32"
sha256 ventura: "bcbba9622135dc3aed69dc4cbfdbd959a8cd4e86c81b006a03e16169b7136bc9"
sha256 cellar: :any_skip_relocation, x86_64_linux: "d646739948bde97fd409c8c89d34a321bdd1ca8876ddefb66f4ff98aaac996b4"
end
depends_on "cmake" => :build
depends_on "pkgconf" => :build
depends_on "assimp"
depends_on "bullet"
depends_on "eigen"
depends_on "fcl"
depends_on "flann"
depends_on "fmt"
depends_on "ipopt"
depends_on "libccd"
depends_on "nlopt"
depends_on "octomap"
depends_on "ode"
depends_on "open-scene-graph"
depends_on "spdlog"
depends_on "tinyxml2"
depends_on "urdfdom"
uses_from_macos "python" => :build
on_linux do
depends_on "mesa"
end
def install
args = %W[
-DCMAKE_INSTALL_RPATH=#{rpath}
-DDART_BUILD_DARTPY=OFF
-DDART_ENABLE_SIMD=OFF
]
if OS.mac?
# Force to link to system GLUT (see: https://cmake.org/Bug/view.php?id=16045)
glut_lib = "#{MacOS.sdk_path}/System/Library/Frameworks/GLUT.framework"
args << "-DGLUT_glut_LIBRARY=#{glut_lib}"
end
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
# Clean up the build file garbage that has been installed.
rm_r Dir["#{share}/doc/dart/**/CMakeFiles/"]
end
test do
(testpath/"test.cpp").write <<~CPP
#include <dart/dart.hpp>
int main() {
auto world = std::make_shared<dart::simulation::World>();
assert(world != nullptr);
return 0;
}
CPP
system ENV.cxx, "test.cpp", "-I#{Formula["eigen"].include}/eigen3",
"-I#{include}", "-L#{lib}", "-ldart",
"-L#{Formula["assimp"].opt_lib}", "-lassimp",
"-L#{Formula["libccd"].opt_lib}", "-lccd",
"-L#{Formula["fcl"].opt_lib}", "-lfcl",
"-std=c++17", "-o", "test"
system "./test"
end
end