homebrew-core/Formula/itk.rb
2019-11-03 22:24:59 +09:00

80 lines
2.5 KiB
Ruby

class Itk < Formula
desc "Insight Toolkit is a toolkit for performing registration and segmentation"
homepage "https://www.itk.org/"
url "https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.0.1/InsightToolkit-5.0.1.tar.gz"
sha256 "613b125cbf58481e8d1e36bdeacf7e21aba4b129b4e524b112f70c4d4e6d15a6"
head "https://itk.org/ITK.git"
bottle do
sha256 "66681e635208d8da127e72493196826562e5df862a33c9ed4c154c023eaad05a" => :catalina
sha256 "a69ca8e607d27c5b78c80b04e521ba38cb0ed9f50ddfb3fe856c179a68575be6" => :mojave
sha256 "c894c33c5f45504cb2c13ef58600479875b3cb04a7b123e71860ab206b33432d" => :high_sierra
end
depends_on "cmake" => :build
depends_on "fftw"
depends_on "gdcm"
depends_on "hdf5"
depends_on "jpeg"
depends_on "libpng"
depends_on "libtiff"
depends_on "vtk"
def install
args = std_cmake_args + %W[
-DBUILD_SHARED_LIBS=ON
-DBUILD_TESTING=OFF
-DCMAKE_INSTALL_RPATH:STRING=#{lib}
-DCMAKE_INSTALL_NAME_DIR:STRING=#{lib}
-DITK_USE_64BITS_IDS=ON
-DITK_USE_STRICT_CONCEPT_CHECKING=ON
-DITK_USE_SYSTEM_ZLIB=ON
-DITK_USE_SYSTEM_EXPAT=ON
-DModule_SCIFIO=ON
-DITKV3_COMPATIBILITY:BOOL=OFF
-DITK_USE_SYSTEM_FFTW=ON
-DITK_USE_FFTWF=ON
-DITK_USE_FFTWD=ON
-DITK_USE_SYSTEM_HDF5=ON
-DITK_USE_SYSTEM_JPEG=ON
-DITK_USE_SYSTEM_PNG=ON
-DITK_USE_SYSTEM_TIFF=ON
-DITK_USE_SYSTEM_GDCM=ON
-DITK_LEGACY_REMOVE=ON
-DModule_ITKLevelSetsv4Visualization=ON
-DModule_ITKReview=ON
-DModule_ITKVtkGlue=ON
-DITK_USE_GPU=ON
]
mkdir "build" do
system "cmake", "..", *args
system "make"
system "make", "install"
end
end
test do
(testpath/"test.cxx").write <<-EOS
#include "itkImage.h"
int main(int argc, char* argv[])
{
typedef itk::Image<unsigned short, 3> ImageType;
ImageType::Pointer image = ImageType::New();
image->Update();
return EXIT_SUCCESS;
}
EOS
v = version.to_s.split(".")[0..1].join(".")
# Build step
system ENV.cxx, "-std=c++11", "-isystem", "#{include}/ITK-#{v}", "-o", "test.cxx.o", "-c", "test.cxx"
# Linking step
system ENV.cxx, "-std=c++11", "test.cxx.o", "-o", "test",
"#{lib}/libITKCommon-#{v}.1.dylib",
"#{lib}/libITKVNLInstantiation-#{v}.1.dylib",
"#{lib}/libitkvnl_algo-#{v}.1.dylib",
"#{lib}/libitkvnl-#{v}.1.dylib"
system "./test"
end
end