forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsighttoolkit.rb
76 lines (67 loc) · 2.77 KB
/
insighttoolkit.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
require 'formula'
class Insighttoolkit < Formula
homepage 'http://www.itk.org'
url 'https://downloads.sourceforge.net/project/itk/itk/4.5/InsightToolkit-4.5.2.tar.gz'
sha1 '91b14d4a67e837b3e0dc12d2d7ad5b3fdaae5a8e'
head 'git://itk.org/ITK.git'
option :cxx11
cxx11dep = (build.cxx11?) ? ['c++11'] : []
depends_on 'cmake' => :build
depends_on 'vtk' => [:build] + cxx11dep
depends_on 'opencv' => [:optional] + cxx11dep
depends_on :python => :optional
depends_on 'fftw' => :recommended
depends_on 'hdf5' => [:recommended, "--c++11"]
depends_on 'jpeg' => :recommended
depends_on :libpng => :recommended
depends_on 'libtiff' => :recommended
option 'examples', 'Compile and install various examples'
option 'with-itkv3-compatibility', 'Include ITKv3 compatibility'
option 'remove-legacy', 'Disable legacy APIs'
option 'with-review', 'Enable modules under review'
if build.with? 'python'
onoe <<-EOS.undent
Building ITK with Python Wrapping is currently not working out of the box on Mac.
A fix will eventually come as the ITK community is currently working on this.
Working Python binaries can be found here : https://github.com/iMichka/homebrew-MacVTKITKPythonBottles
EOS
exit 1
end
def install
args = std_cmake_args + %W[
-DBUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=ON
-DITK_USE_GPU=ON
-DITK_USE_64BITS_IDS=ON
-DITK_USE_STRICT_CONCEPT_CHECKING=ON
-DITK_USE_SYSTEM_ZLIB=ON
-DModule_ITKLevelSetsv4Visualization=ON
]
args << ".."
args << '-DBUILD_EXAMPLES=' + ((build.include? 'examples') ? 'ON' : 'OFF')
args << '-DModule_ITKVideoBridgeOpenCV=' + ((build.with? 'opencv') ? 'ON' : 'OFF')
args << '-DITKV3_COMPATIBILITY:BOOL=' + ((build.with? 'itkv3-compatibility') ? 'ON' : 'OFF')
args << '-DITK_USE_SYSTEM_FFTW=ON' << '-DITK_USE_FFTWF=ON' << '-DITK_USE_FFTWD=ON' if build.with? 'fftw'
args << '-DITK_USE_SYSTEM_HDF5=ON' if build.with? 'hdf5'
args << '-DITK_USE_SYSTEM_JPEG=ON' if build.with? 'jpeg'
args << '-DITK_USE_SYSTEM_PNG=ON' if build.with? :libpng
args << '-DITK_USE_SYSTEM_TIFF=ON' if build.with? 'libtiff'
args << '-DITK_LEGACY_REMOVE=ON' if build.include? 'remove-legacy'
args << '-DModule_ITKReview=ON' if build.with? 'review'
args << '-DVCL_INCLUDE_CXX_0X=ON' if build.cxx11?
ENV.cxx11 if build.cxx11?
mkdir 'itk-build' do
if build.with? "python"
args += %W[
-DITK_WRAP_PYTHON=ON
-DModule_ITKVtkGlue=ON
-DCMAKE_C_FLAGS='-ansi'
]
# CMake picks up the system's python dylib, even if we have a brewed one.
args << "-DPYTHON_LIBRARY='#{%x(python-config --prefix).chomp}/lib/libpython2.7.dylib'"
end
system "cmake", *args
system "make", "install"
end
end
end