2011-03-10 05:11:03 +00:00
|
|
|
class Bullet < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Physics SDK"
|
2015-03-25 00:22:07 +00:00
|
|
|
homepage "http://bulletphysics.org/wordpress/"
|
2015-08-07 20:58:37 +00:00
|
|
|
url "https://github.com/bulletphysics/bullet3/archive/2.83.5.tar.gz"
|
|
|
|
sha256 "df6d58898d3d3bf117854dd64467dbd09625e048624c797649b46bf1c595b152"
|
2015-03-25 00:22:07 +00:00
|
|
|
head "https://github.com/bulletphysics/bullet3.git"
|
|
|
|
|
2015-04-12 00:32:48 +00:00
|
|
|
bottle do
|
2015-08-08 04:54:33 +00:00
|
|
|
cellar :any
|
|
|
|
sha256 "1ea49cb319991969ada6567ffdfa227e2b2a1789371df29ab3468f13e35a1273" => :yosemite
|
|
|
|
sha256 "cac6c51229ea72bb3ba4c174ed302d235a2bd34050e7834ff19af05931ff654b" => :mavericks
|
|
|
|
sha256 "1e3e54e77cba617722599ccb0dde40b9b7858b054f1d24032fd458d4e0a04030" => :mountain_lion
|
2015-04-12 00:32:48 +00:00
|
|
|
end
|
|
|
|
|
2015-03-25 00:22:07 +00:00
|
|
|
depends_on "cmake" => :build
|
2010-12-17 15:29:11 +00:00
|
|
|
|
2015-03-25 00:22:07 +00:00
|
|
|
deprecated_option "framework" => "with-framework"
|
|
|
|
deprecated_option "shared" => "with-shared"
|
|
|
|
deprecated_option "build-demo" => "with-demo"
|
|
|
|
deprecated_option "build-extra" => "with-extra"
|
|
|
|
deprecated_option "double-precision" => "with-double-precision"
|
2010-12-17 15:29:11 +00:00
|
|
|
|
2012-08-09 05:30:34 +00:00
|
|
|
option :universal
|
2015-03-25 00:22:07 +00:00
|
|
|
option "with-framework", "Build Frameworks"
|
|
|
|
option "with-shared", "Build shared libraries"
|
|
|
|
option "with-demo", "Build demo applications"
|
|
|
|
option "with-extra", "Build extra library"
|
|
|
|
option "with-double-precision", "Use double precision"
|
2010-12-17 15:29:11 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
args = []
|
|
|
|
|
2015-03-25 00:22:07 +00:00
|
|
|
if build.with? "framework"
|
2010-12-17 15:29:11 +00:00
|
|
|
args << "-DBUILD_SHARED_LIBS=ON" << "-DFRAMEWORK=ON"
|
2013-05-03 16:28:45 +00:00
|
|
|
args << "-DCMAKE_INSTALL_PREFIX=#{frameworks}"
|
|
|
|
args << "-DCMAKE_INSTALL_NAME_DIR=#{frameworks}"
|
2010-12-17 15:29:11 +00:00
|
|
|
else
|
2015-03-25 00:22:07 +00:00
|
|
|
args << "-DBUILD_SHARED_LIBS=ON" if build.with? "shared"
|
2010-12-17 15:29:11 +00:00
|
|
|
args << "-DCMAKE_INSTALL_PREFIX=#{prefix}"
|
|
|
|
end
|
|
|
|
|
2014-05-10 01:49:36 +00:00
|
|
|
if build.universal?
|
|
|
|
ENV.universal_binary
|
|
|
|
args << "-DCMAKE_OSX_ARCHITECTURES=#{Hardware::CPU.universal_archs.as_cmake_arch_flags}"
|
|
|
|
end
|
|
|
|
|
2015-03-25 00:22:07 +00:00
|
|
|
args << "-DUSE_DOUBLE_PRECISION=ON" if build.with? "double-precision"
|
2010-12-17 15:29:11 +00:00
|
|
|
|
2015-05-04 23:51:08 +00:00
|
|
|
# Related to the following warnings when building --with-shared --with-demo
|
|
|
|
# https://gist.github.com/scpeters/6afc44f0cf916b11a226
|
|
|
|
if build.with?("demo") && (build.with?("shared") || build.with?("framework"))
|
|
|
|
raise "Demos cannot be installed with shared libraries or framework."
|
|
|
|
end
|
|
|
|
|
|
|
|
args << "-DBUILD_BULLET2_DEMOS=OFF" if build.without? "demo"
|
2013-11-13 14:53:17 +00:00
|
|
|
|
2015-05-04 23:51:08 +00:00
|
|
|
if build.with?("extra")
|
2013-11-13 14:53:17 +00:00
|
|
|
args << "-DINSTALL_EXTRA_LIBS=ON"
|
|
|
|
else
|
|
|
|
args << "-DBUILD_EXTRAS=OFF"
|
|
|
|
end
|
|
|
|
|
2010-12-17 15:29:11 +00:00
|
|
|
system "cmake", *args
|
|
|
|
system "make"
|
2015-03-25 00:22:07 +00:00
|
|
|
system "make", "install"
|
|
|
|
|
2015-05-04 23:51:08 +00:00
|
|
|
prefix.install "examples" if build.with? "demo"
|
2015-03-25 00:22:07 +00:00
|
|
|
prefix.install "Extras" if build.with? "extra"
|
|
|
|
end
|
2010-12-17 15:29:11 +00:00
|
|
|
|
2015-03-25 00:22:07 +00:00
|
|
|
test do
|
|
|
|
(testpath/"test.cpp").write <<-EOS.undent
|
|
|
|
#include "bullet/LinearMath/btPolarDecomposition.h"
|
|
|
|
int main() {
|
|
|
|
btMatrix3x3 I = btMatrix3x3::getIdentity();
|
|
|
|
btMatrix3x3 u, h;
|
|
|
|
polarDecompose(I, u, h);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system ENV.cc, "test.cpp", "-L#{lib}", "-lLinearMath", "-lc++", "-o", "test"
|
|
|
|
system "./test"
|
2010-12-17 15:29:11 +00:00
|
|
|
end
|
|
|
|
end
|