84 lines
2.7 KiB
Ruby
84 lines
2.7 KiB
Ruby
class Gdcm < Formula
|
|
desc "Grassroots DICOM library and utilities for medical files"
|
|
homepage "https://sourceforge.net/projects/gdcm/"
|
|
url "https://github.com/malaterre/GDCM/archive/v3.0.8.tar.gz"
|
|
sha256 "47b96be345b1611784f9e65fc39367c7450c9a1ef81c21f8acddfb6207098315"
|
|
license "BSD-3-Clause"
|
|
revision 1
|
|
|
|
livecheck do
|
|
url "https://github.com/malaterre/GDCM/releases/latest"
|
|
regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 "2f416ce53cbca29849bf6d3720d289f0b778593620937ba8a833c75a257aaf89" => :big_sur
|
|
sha256 "d5ce02b3b5473665b241484eff50b226d7b7f800253255362c26195fc69e40eb" => :catalina
|
|
sha256 "3e75b52ddc6151a6f39a63e2d4403c960247b0a6b780a2488cc6bda293a773fa" => :mojave
|
|
sha256 "8a5ac94c29c78add6e335dd5a07ef2f2b2f2d0c7da9704d7655d9800f5278dd8" => :high_sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "ninja" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "swig" => :build
|
|
depends_on "openjpeg"
|
|
depends_on "openssl@1.1"
|
|
depends_on "python@3.9"
|
|
depends_on "vtk@8.2"
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
python3 = Formula["python@3.9"].opt_bin/"python3"
|
|
xy = Language::Python.major_minor_version python3
|
|
python_include =
|
|
Utils.safe_popen_read(python3, "-c", "from distutils import sysconfig;print(sysconfig.get_python_inc(True))")
|
|
.chomp
|
|
python_executable = Utils.safe_popen_read(python3, "-c", "import sys;print(sys.executable)").chomp
|
|
|
|
args = std_cmake_args + %W[
|
|
-GNinja
|
|
-DGDCM_BUILD_APPLICATIONS=ON
|
|
-DGDCM_BUILD_SHARED_LIBS=ON
|
|
-DGDCM_BUILD_TESTING=OFF
|
|
-DGDCM_BUILD_EXAMPLES=OFF
|
|
-DGDCM_BUILD_DOCBOOK_MANPAGES=OFF
|
|
-DGDCM_USE_VTK=ON
|
|
-DGDCM_USE_SYSTEM_OPENJPEG=ON
|
|
-DGDCM_USE_SYSTEM_OPENSSL=ON
|
|
-DGDCM_WRAP_PYTHON=ON
|
|
-DPYTHON_EXECUTABLE=#{python_executable}
|
|
-DPYTHON_INCLUDE_DIR=#{python_include}
|
|
-DGDCM_INSTALL_PYTHONMODULE_DIR=#{lib}/python#{xy}/site-packages
|
|
-DCMAKE_INSTALL_RPATH=#{lib}
|
|
-DGDCM_NO_PYTHON_LIBS_LINKING=ON
|
|
]
|
|
|
|
mkdir "build" do
|
|
ENV.append "LDFLAGS", "-undefined dynamic_lookup"
|
|
|
|
system "cmake", "..", *args
|
|
system "ninja"
|
|
system "ninja", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cxx").write <<~EOS
|
|
#include "gdcmReader.h"
|
|
int main(int, char *[])
|
|
{
|
|
gdcm::Reader reader;
|
|
reader.SetFileName("file.dcm");
|
|
}
|
|
EOS
|
|
|
|
system ENV.cxx, "-std=c++11", "-isystem", "#{include}/gdcm-3.0", "-o", "test.cxx.o", "-c", "test.cxx"
|
|
system ENV.cxx, "-std=c++11", "test.cxx.o", "-o", "test", "-L#{lib}", "-lgdcmDSED"
|
|
system "./test"
|
|
|
|
system Formula["python@3.9"].opt_bin/"python3", "-c", "import gdcm"
|
|
end
|
|
end
|