112 lines
3.6 KiB
Ruby
112 lines
3.6 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.2.1/InsightToolkit-5.2.1.tar.gz"
|
|
sha256 "192d41bcdd258273d88069094f98c61c38693553fd751b54f8cda308439555db"
|
|
license "Apache-2.0"
|
|
head "https://github.com/InsightSoftwareConsortium/ITK.git", branch: "master"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_big_sur: "7b59055f5a4d15929975183ff03593a0500f6f9a4ff70d740ab184b29e182b99"
|
|
sha256 big_sur: "b7b30cd49b92cfcbd05404a4d0a592f3623f122354a82e458d5ee01ac2f9aa73"
|
|
sha256 catalina: "2e87abe07201cd013ac9535b02f3a012e79b049327d5ecc6ff015b1752c0a7f8"
|
|
sha256 mojave: "d2020a7710d5b42d0d833ff04ee2d821ff8080f34c8d2d00a86feaa39f6dfa25"
|
|
sha256 x86_64_linux: "c848dd47f4c45a3def027fac4d9b640f554ceb3ef97e35e6f2d45b3e44f8a73c"
|
|
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 "gcc"
|
|
depends_on "unixodbc"
|
|
|
|
ignore_missing_libraries "libjvm.so"
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
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
|
|
]
|
|
|
|
args << "-DITK_USE_GPU=ON" if OS.mac?
|
|
|
|
# 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",
|
|
shared_library("#{lib}/libITKCommon-#{v}", 1),
|
|
shared_library("#{lib}/libITKVNLInstantiation-#{v}", 1),
|
|
shared_library("#{lib}/libitkvnl_algo-#{v}", 1),
|
|
shared_library("#{lib}/libitkvnl-#{v}", 1)
|
|
system "./test"
|
|
end
|
|
end
|