117 lines
4.0 KiB
Ruby
117 lines
4.0 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"
|
|
revision 4
|
|
head "https://github.com/InsightSoftwareConsortium/ITK.git", branch: "master"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 arm64_ventura: "1410301f5cc936c0e950328b6390d42a6fb0dc87fd7a53a8d9a3b6a83e46d76e"
|
|
sha256 arm64_monterey: "f55fbffb6f9b00f5f78e5823a70257e55c8ce675967df69fbf655058e7a99c15"
|
|
sha256 arm64_big_sur: "3e6ca9bc77673500b57b30b8c5a5d73aacdcf3bf9ee1b365b752847e3c68cd97"
|
|
sha256 ventura: "b4b2581f753c57f72babbb20800a9034f6135f2b7d14f9e041b9ec26f5880c39"
|
|
sha256 monterey: "0ab063f285db8f83792070e8702ba51d2b9b14342114921b7fedccde7478b503"
|
|
sha256 big_sur: "23babc0810e7aca8372c414f3b85f9405668448aaead6d4491292be4b58d054f"
|
|
sha256 x86_64_linux: "ed6fa53b507ff8aba2b20653ffed65cfc040f312f20b360e4e2eda248a8a4403"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "double-conversion"
|
|
depends_on "fftw"
|
|
depends_on "gdcm"
|
|
depends_on "hdf5"
|
|
depends_on "jpeg-turbo"
|
|
depends_on "libpng"
|
|
depends_on "libtiff"
|
|
depends_on "vtk"
|
|
|
|
on_linux do
|
|
depends_on "alsa-lib"
|
|
depends_on "unixodbc"
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
# Avoid CMake trying to find GoogleTest even though tests are disabled
|
|
(buildpath/"Modules/ThirdParty/GoogleTest").rmtree
|
|
|
|
args = %W[
|
|
-DBUILD_SHARED_LIBS=ON
|
|
-DCMAKE_INSTALL_RPATH:STRING=#{lib}
|
|
-DCMAKE_INSTALL_NAME_DIR:STRING=#{lib}
|
|
-DITKV3_COMPATIBILITY:BOOL=OFF
|
|
-DITK_LEGACY_REMOVE=ON
|
|
-DITK_USE_64BITS_IDS=ON
|
|
-DITK_USE_FFTWF=ON
|
|
-DITK_USE_FFTWD=ON
|
|
-DITK_USE_SYSTEM_FFTW=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_USE_SYSTEM_ZLIB=ON
|
|
-DITK_USE_SYSTEM_EXPAT=ON
|
|
-DITK_USE_SYSTEM_DOUBLECONVERSION=ON
|
|
-DITK_USE_SYSTEM_LIBRARIES=ON
|
|
-DModule_ITKReview=ON
|
|
-DModule_ITKVtkGlue=ON
|
|
-DModule_SCIFIO=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
|
|
|
|
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
|
|
system "cmake", "--build", "build"
|
|
system "cmake", "--install", "build"
|
|
|
|
# Remove the bundled JRE installed by SCIFIO ImageIO plugin
|
|
(lib/"jre").rmtree if OS.linux? || Hardware::CPU.intel?
|
|
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/shared_library("libITKCommon-#{v}", 1),
|
|
lib/shared_library("libITKVNLInstantiation-#{v}", 1),
|
|
lib/shared_library("libitkvnl_algo-#{v}", 1),
|
|
lib/shared_library("libitkvnl-#{v}", 1)
|
|
system "./test"
|
|
end
|
|
end
|