105 lines
3.3 KiB
Ruby
105 lines
3.3 KiB
Ruby
class Itk < Formula
|
|
desc "Insight Toolkit is a toolkit for performing registration and segmentation"
|
|
homepage "https://itk.org"
|
|
url "https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.1/InsightToolkit-5.1.1.tar.gz"
|
|
sha256 "39e2a63840054361b728878a35b21bbe38374682ffb4b5c4f8f8f7514dedb58e"
|
|
license "Apache-2.0"
|
|
head "https://github.com/InsightSoftwareConsortium/ITK.git"
|
|
|
|
livecheck do
|
|
url :head
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 "fc3663a70cf636219ede4bfd9a8b92d4d2613e938f0b865020abba0e91957b0b" => :big_sur
|
|
sha256 "0f61a4a6db8935c74dad672472a9df7a920dcad0081db2ff9b8af62291cd27f7" => :catalina
|
|
sha256 "cdab5fa00fc056cb691b95ee762bee986af9f90bf388dc178cd71fc708be5cab" => :mojave
|
|
sha256 "6693ad5cd1d63c568eb9613553333e04b0fd808a6ebace4e6fdaee2cddaee0fd" => :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@8.2" # needed for gdcm
|
|
|
|
on_linux do
|
|
depends_on "alsa-lib"
|
|
depends_on "unixodbc"
|
|
end
|
|
|
|
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_ITKReview=ON
|
|
-DModule_ITKVtkGlue=ON
|
|
-DITK_USE_GPU=ON
|
|
]
|
|
|
|
# Avoid references to the Homebrew shims directory
|
|
inreplace "Modules/Core/Common/src/CMakeLists.txt" do |s|
|
|
s.gsub!(/MAKE_MAP_ENTRY\(\s*\\"CMAKE_C_COMPILER\\",
|
|
\s*\\"\${CMAKE_C_COMPILER}\\".*\);/x,
|
|
"MAKE_MAP_ENTRY(\\\"CMAKE_C_COMPILER\\\", " \
|
|
"\\\"#{ENV.cc}\\\", \\\"The C compiler.\\\");")
|
|
|
|
s.gsub!(/MAKE_MAP_ENTRY\(\s*\\"CMAKE_CXX_COMPILER\\",
|
|
\s*\\"\${CMAKE_CXX_COMPILER}\\".*\);/x,
|
|
"MAKE_MAP_ENTRY(\\\"CMAKE_CXX_COMPILER\\\", " \
|
|
"\\\"#{ENV.cxx}\\\", \\\"The CXX compiler.\\\");")
|
|
end
|
|
|
|
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.major_minor
|
|
# 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
|