aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/assimp.rb38
1 files changed, 37 insertions, 1 deletions
diff --git a/Library/Formula/assimp.rb b/Library/Formula/assimp.rb
index 95cba00a4..3967da253 100644
--- a/Library/Formula/assimp.rb
+++ b/Library/Formula/assimp.rb
@@ -18,10 +18,46 @@ class Assimp < Formula
option "without-boost", "Compile without thread safe logging or multithreaded computation if boost isn't installed"
depends_on "cmake" => :build
- depends_on "boost" => :recommended
+ depends_on "boost" => [:recommended, :build]
def install
system "cmake", ".", *std_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", "-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:
+ v -0.5 0 0.5 # 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 1 0 # Top point (top of pyramid).
+
+ # List of faces:
+ f 4 3 2 1 # Square base (note: normals are placed anti-clockwise).
+ f 1 2 5 # Triangle on front.
+ f 3 4 5 # Triangle on back.
+ f 4 1 5 # Triangle on left side.
+ f 2 3 5
+ EOS
+ system "assimp", "export", testpath/"test.obj", testpath/"test.ply"
+ end
end