homebrew-core/Formula/dartsim.rb

65 lines
1.9 KiB
Ruby

class Dartsim < Formula
desc "Dynamic Animation and Robotics Toolkit"
homepage "https://dartsim.github.io/"
url "https://github.com/dartsim/dart/archive/v6.10.1.tar.gz"
sha256 "bf19cdef8e28dbc4059dcbb11997576d6e1d825791bd756e8272d2ddc5b147ce"
license "BSD-2-Clause"
revision 1
bottle do
sha256 big_sur: "761351510ddd1e719882b2daaea5be4f7c04280725bf8fd0f829ea9ada7096f0"
sha256 catalina: "89fe235f7886635f0b2cfa26d52ece027a15b1ff6935da5c40ecbfad2f54b289"
sha256 mojave: "b1630da0b45a973a399e756ba1b505897d3e50d846e8bca657eae29136847590"
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 "ipopt"
depends_on "libccd"
depends_on "nlopt"
depends_on "ode"
depends_on "open-scene-graph"
depends_on "tinyxml2"
depends_on "urdfdom"
def install
ENV.cxx11
args = std_cmake_args
on_macos do
# 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", ".", *args
system "make", "install"
# Clean up the build file garbage that has been installed.
rm_r Dir["#{share}/doc/dart/**/CMakeFiles/"]
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++14", "-o", "test"
system "./test"
end
end