homebrew-core/Formula/dartsim.rb
2018-11-07 15:02:37 -08:00

68 lines
2.3 KiB
Ruby

class Dartsim < Formula
desc "Dynamic Animation and Robotics Toolkit"
homepage "https://dartsim.github.io/"
url "https://github.com/dartsim/dart/archive/v6.6.2.tar.gz"
sha256 "3ac648fdac0633a2ea4dac37f78e37e5ced6edc2d82c3e2e9b7d8b7793df0845"
revision 2
bottle do
sha256 "83f2ebcce524c618f43c405bd2510320101cd70024181b3abe8f4840fcc119a0" => :mojave
sha256 "f85e3a4f32ef05e0209baa9d8c17de918718430891afe48cc41033270f99dd83" => :high_sierra
sha256 "042184ad7aeb294016ca89cb7e606c44c6e2bc10111e36a52242cd146b394e33" => :sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "assimp"
depends_on "boost"
depends_on "bullet"
depends_on "eigen"
depends_on "fcl"
depends_on "flann"
depends_on "libccd"
depends_on "nlopt"
depends_on "ode"
depends_on "open-scene-graph"
depends_on "tinyxml2"
depends_on "urdfdom"
needs :cxx11
def install
ENV.cxx11
# Force to link to system GLUT (see: https://cmake.org/Bug/view.php?id=16045)
system "cmake", ".", "-DGLUT_glut_LIBRARY=/System/Library/Frameworks/GLUT.framework",
*std_cmake_args
system "make", "install"
# Avoid revision bumps whenever fcl's or libccd's Cellar paths change
inreplace share/"dart/cmake/dart_dartTargets.cmake" do |s|
s.gsub! Formula["fcl"].prefix.realpath, Formula["fcl"].opt_prefix
s.gsub! Formula["libccd"].prefix.realpath, Formula["libccd"].opt_prefix
end
# Avoid revision bumps whenever urdfdom's or urdfdom_headers's Cellar paths change
inreplace share/"dart/cmake/dart_utils-urdfTargets.cmake" do |s|
s.gsub! Formula["urdfdom"].prefix.realpath, Formula["urdfdom"].opt_prefix
s.gsub! Formula["urdfdom_headers"].prefix.realpath, Formula["urdfdom_headers"].opt_prefix
end
end
test do
(testpath/"test.cpp").write <<~EOS
#include <dart/dart.hpp>
int main() {
auto world = std::make_shared<dart::simulation::World>();
assert(world != nullptr);
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-I#{Formula["eigen"].include}/eigen3",
"-I#{include}", "-L#{lib}", "-ldart",
"-L#{Formula["assimp"].opt_lib}", "-lassimp",
"-L#{Formula["boost"].opt_lib}", "-lboost_system",
"-std=c++11", "-o", "test"
system "./test"
end
end