homebrew-core/Formula/dartsim.rb

67 lines
2.0 KiB
Ruby

class Dartsim < Formula
desc "Dynamic Animation and Robotics Toolkit"
homepage "https://dartsim.github.io/"
url "https://github.com/dartsim/dart/archive/v6.12.1.tar.gz"
sha256 "e0d47bbc191903b93474da00bbd1042cefdc85f5ead3e9a9282b5f4187d53304"
license "BSD-2-Clause"
revision 1
bottle do
sha256 arm64_big_sur: "1bc446fac248f2d6c50390a95a3f7ca7d548d30d9b06b88bc823d19b5b711951"
sha256 big_sur: "781f8d46a3ef49ab988866f1c78e3951f000179d069d98ec0f5acfc9b0db6f86"
sha256 catalina: "be093be8d933db91d12cf0c5acecc32fd7e2e76f840587b491cd16ee5989a992"
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
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
mkdir "build" do
system "cmake", "..", *args, "-DCMAKE_INSTALL_RPATH=#{rpath}"
system "make", "install"
end
# 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