73 lines
2.3 KiB
Ruby
73 lines
2.3 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.1.tar.gz"
|
|
sha256 "f1ee8ebda7a465281abada329b4dbca6e036a42ead6ad58070ff4f94da7819d9"
|
|
revision 2
|
|
|
|
bottle do
|
|
sha256 "6f4314bef2cd7c0849f04d6cd27a858ab6ced1f1b8987af52ccfc22461fe0759" => :mojave
|
|
sha256 "f4102a34b9787a50db114b97a9456e30bff18e26846ac3ad17fd0e48f0ecb192" => :high_sierra
|
|
sha256 "f74a4c29513115a9d6f9745abba1c33dfb1d93ecfd87e9f5f37563cbff2bce8a" => :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"
|
|
depends_on "vtk"
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
xy = Language::Python.major_minor_version "python3"
|
|
python_include = Utils.popen_read("python3 -c 'from distutils import sysconfig;print(sysconfig.get_python_inc(True))'").chomp
|
|
python_executable = Utils.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 "python3", "-c", "import gdcm"
|
|
end
|
|
end
|