aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorBrian Gyss2011-08-27 23:29:04 -0700
committerCharlie Sharpsteen2011-08-29 16:56:28 -0700
commitbd49552a516e3423e2f1d18b0a614c1609f73539 (patch)
tree785816cd1c51417291adda4e43bf9247c1c98599 /Library/Formula
parent0e9adae93cb726c7d4783d39ae076af787ce20a1 (diff)
downloadhomebrew-bd49552a516e3423e2f1d18b0a614c1609f73539.tar.bz2
New Formula: FLANN
Created a formula for flann because it's a required dependency for PCL (Point Cloud Library), which I'm hoping to add to homebrew. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/flann.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/Library/Formula/flann.rb b/Library/Formula/flann.rb
new file mode 100644
index 000000000..aca7b26ff
--- /dev/null
+++ b/Library/Formula/flann.rb
@@ -0,0 +1,45 @@
+require 'formula'
+
+class Flann < Formula
+ url 'http://people.cs.ubc.ca/~mariusm/uploads/FLANN/flann-1.6.11-src.zip'
+ homepage 'http://www.cs.ubc.ca/~mariusm/index.php/FLANN/FLANN'
+ md5 '5fd889b9f3777aa6e0d05b2546d25eb5'
+
+ def options
+ [
+ ['--enable-python', 'Enable python bindings.'],
+ ['--enable-matlab', 'Enable matlab/octave bindings.'],
+ ['--with-examples', 'Build and install example binaries']
+ ]
+ end
+
+ depends_on 'cmake' => :build
+ depends_on 'gtest' => :build
+ depends_on 'hdf5'
+
+ depends_on 'octave' if ARGV.include? '--enable-matlab'
+ depends_on 'numpy' => :python if ARGV.include? '--enable-python'
+
+ def install
+ args = std_cmake_parameters.split
+ if ARGV.include? '--enable-matlab'
+ args << '-DBUILD_MATLAB_BINDINGS:BOOL=ON'
+ else
+ args << '-DBUILD_MATLAB_BINDINGS:BOOL=OFF'
+ end
+
+ if ARGV.include? '--enable-python'
+ args << '-DBUILD_PYTHON_BINDINGS:BOOL=ON'
+ else
+ args << '-DBUILD_PYTHON_BINDINGS:BOOL=OFF'
+ end
+
+ inreplace 'CMakeLists.txt', 'add_subdirectory( examples )', '' unless ARGV.include? '--with-examples'
+
+ Dir.mkdir 'build'
+ Dir.chdir 'build' do
+ system 'cmake', '..', *args
+ system 'make install'
+ end
+ end
+end