74 lines
2.1 KiB
Ruby
74 lines
2.1 KiB
Ruby
class Assimp < Formula
|
|
desc "Portable library for importing many well-known 3D model formats"
|
|
homepage "http://www.assimp.org"
|
|
url "https://github.com/assimp/assimp/archive/v3.3.1.tar.gz"
|
|
sha256 "d385c3f90876241343f09e45f4e5033a6a05861b971c63d1f6d512371ffdc7bf"
|
|
head "https://github.com/assimp/assimp.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "8893501dc3e5c712089d73a0b1ede41f39da7055490e00e80e1535f74dc15577" => :sierra
|
|
sha256 "369a938fd09b266261be1ea9dbcbccf4f14117b3fd5d8943d4d54423c486d759" => :el_capitan
|
|
sha256 "5f1100de213334b15b640ab15ef063cace602607ca637a8b9b8e426238ca63a9" => :yosemite
|
|
sha256 "73fa896885b3fae3812ef5b0db1c8d3ac68d72cb33a13b3715454f52b09d5588" => :mavericks
|
|
end
|
|
|
|
option "without-boost", "Compile without thread safe logging or multithreaded computation if boost isn't installed"
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "boost" => [:recommended, :build]
|
|
|
|
def install
|
|
args = std_cmake_args
|
|
args << "-DASSIMP_BUILD_TESTS=OFF"
|
|
system "cmake", *args
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
# Library test.
|
|
(testpath/"test.cpp").write <<-EOS.undent
|
|
#include <assimp/Importer.hpp>
|
|
int main() {
|
|
Assimp::Importer importer;
|
|
return 0;
|
|
}
|
|
EOS
|
|
system ENV.cc, "test.cpp", "-L#{lib}", "-lassimp", "-o", "test"
|
|
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:
|
|
# 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
|
|
|
|
# List of faces:
|
|
# 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
|
|
f 2 3 5
|
|
EOS
|
|
system bin/"assimp", "export", "test.obj", "test.ply"
|
|
end
|
|
end
|