2011-09-26 20:55:51 +00:00
|
|
|
class Assimp < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Portable library for importing many well-known 3D model formats"
|
2016-02-19 22:56:39 +00:00
|
|
|
homepage "http://www.assimp.org"
|
2016-07-15 16:17:20 +00:00
|
|
|
url "https://github.com/assimp/assimp/archive/v3.3.1.tar.gz"
|
|
|
|
sha256 "d385c3f90876241343f09e45f4e5033a6a05861b971c63d1f6d512371ffdc7bf"
|
2014-11-22 14:39:00 +00:00
|
|
|
head "https://github.com/assimp/assimp.git"
|
2014-03-18 03:44:49 +00:00
|
|
|
|
2014-11-22 09:17:04 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2016-09-17 02:29:01 +00:00
|
|
|
sha256 "8893501dc3e5c712089d73a0b1ede41f39da7055490e00e80e1535f74dc15577" => :sierra
|
2016-07-15 16:28:24 +00:00
|
|
|
sha256 "369a938fd09b266261be1ea9dbcbccf4f14117b3fd5d8943d4d54423c486d759" => :el_capitan
|
|
|
|
sha256 "5f1100de213334b15b640ab15ef063cace602607ca637a8b9b8e426238ca63a9" => :yosemite
|
|
|
|
sha256 "73fa896885b3fae3812ef5b0db1c8d3ac68d72cb33a13b3715454f52b09d5588" => :mavericks
|
2014-11-22 09:17:04 +00:00
|
|
|
end
|
|
|
|
|
2014-11-21 12:17:09 +00:00
|
|
|
option "without-boost", "Compile without thread safe logging or multithreaded computation if boost isn't installed"
|
2014-11-22 14:39:00 +00:00
|
|
|
|
|
|
|
depends_on "cmake" => :build
|
2014-11-25 16:26:18 +00:00
|
|
|
depends_on "boost" => [:recommended, :build]
|
2014-03-18 03:44:49 +00:00
|
|
|
|
2011-09-26 20:55:51 +00:00
|
|
|
def install
|
2016-02-19 22:56:39 +00:00
|
|
|
args = std_cmake_args
|
|
|
|
args << "-DASSIMP_BUILD_TESTS=OFF"
|
|
|
|
system "cmake", *args
|
2014-11-22 14:39:00 +00:00
|
|
|
system "make", "install"
|
2011-09-26 20:55:51 +00:00
|
|
|
end
|
2014-11-25 16:26:18 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
# Library test.
|
2015-08-03 12:55:31 +00:00
|
|
|
(testpath/"test.cpp").write <<-EOS.undent
|
2014-11-25 16:26:18 +00:00
|
|
|
#include <assimp/Importer.hpp>
|
|
|
|
int main() {
|
|
|
|
Assimp::Importer importer;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
2015-01-13 07:21:18 +00:00
|
|
|
system ENV.cc, "test.cpp", "-L#{lib}", "-lassimp", "-o", "test"
|
2014-11-25 16:26:18 +00:00
|
|
|
system "./test"
|
|
|
|
|
|
|
|
# Application test.
|
|
|
|
(testpath/"test.obj").write <<-EOS.undent
|
|
|
|
# WaveFront .obj file - a single square based pyramid
|
|
|
|
|
|
|
|
# Start a new group:
|
|
|
|
g MySquareBasedPyramid
|
|
|
|
|
|
|
|
# List of vertices:
|
2016-07-15 16:17:20 +00:00
|
|
|
# Front left
|
|
|
|
v -0.5 0 0.5
|
|
|
|
# Front right
|
|
|
|
v 0.5 0 0.5
|
|
|
|
# Back right
|
|
|
|
v 0.5 0 -0.5
|
|
|
|
# Back left
|
|
|
|
v -0.5 0 -0.5
|
|
|
|
# Top point (top of pyramid).
|
|
|
|
v 0 1 0
|
2014-11-25 16:26:18 +00:00
|
|
|
|
|
|
|
# List of faces:
|
2016-07-15 16:17:20 +00:00
|
|
|
# Square base (note: normals are placed anti-clockwise).
|
|
|
|
f 4 3 2 1
|
|
|
|
# Triangle on front
|
|
|
|
f 1 2 5
|
|
|
|
# Triangle on back
|
|
|
|
f 3 4 5
|
|
|
|
# Triangle on left side
|
|
|
|
f 4 1 5
|
|
|
|
# Triangle on right side
|
2014-11-25 16:26:18 +00:00
|
|
|
f 2 3 5
|
|
|
|
EOS
|
2016-07-15 16:17:20 +00:00
|
|
|
system bin/"assimp", "export", "test.obj", "test.ply"
|
2014-11-25 16:26:18 +00:00
|
|
|
end
|
2011-09-26 20:55:51 +00:00
|
|
|
end
|