86 lines
2.8 KiB
Ruby
86 lines
2.8 KiB
Ruby
class Gdcm < Formula
|
|
desc "Grassroots DICOM library and utilities for medical files"
|
|
homepage "https://sourceforge.net/projects/gdcm/"
|
|
url "https://downloads.sourceforge.net/project/gdcm/gdcm%202.x/GDCM%202.8.7/gdcm-2.8.7.tar.gz"
|
|
sha256 "7a08baa93e90bce17d9999d59b95876808801a287812348e27a23decb1ebc58c"
|
|
|
|
bottle do
|
|
sha256 "ad87ce2f85f16278131b692b12c33cbf1f02af7263c04a9b3dc1cb8188bcdf53" => :high_sierra
|
|
sha256 "ba985660d7000a4f8b054a63269c60cab9c542e46e81864d8ef8621c2a246cbf" => :sierra
|
|
sha256 "66d1542a14b6c6e75946853944662d4a934101ceb9c865a9c1da527884133bd6" => :el_capitan
|
|
end
|
|
|
|
option "without-python@2", "Build without python2 support"
|
|
|
|
deprecated_option "with-python3" => "with-python"
|
|
deprecated_option "without-python" => "without-python@2"
|
|
|
|
depends_on "python@2" => :recommended
|
|
depends_on "python" => :optional
|
|
depends_on "swig" => :build if build.with?("python") || build.with?("python@2")
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "openjpeg"
|
|
depends_on "openssl"
|
|
|
|
needs :cxx11
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
common_args = std_cmake_args + %w[
|
|
-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=OFF
|
|
-DGDCM_USE_SYSTEM_OPENJPEG=ON
|
|
-DGDCM_USE_SYSTEM_OPENSSL=ON
|
|
]
|
|
|
|
mkdir "build" do
|
|
if build.without?("python") && build.without?("python@2")
|
|
system "cmake", "..", *common_args
|
|
system "make", "install"
|
|
else
|
|
ENV.append "LDFLAGS", "-undefined dynamic_lookup"
|
|
|
|
Language::Python.each_python(build) do |python, py_version|
|
|
python_include = Utils.popen_read("#{python} -c 'from distutils import sysconfig;print(sysconfig.get_python_inc(True))'").chomp
|
|
args = common_args + %W[
|
|
-DGDCM_WRAP_PYTHON=ON
|
|
-DPYTHON_EXECUTABLE=#{python}
|
|
-DPYTHON_INCLUDE_DIR=#{python_include}
|
|
-DGDCM_INSTALL_PYTHONMODULE_DIR=#{lib}/python#{py_version}/site-packages
|
|
-DCMAKE_INSTALL_RPATH=#{lib}
|
|
-DGDCM_NO_PYTHON_LIBS_LINKING=ON
|
|
]
|
|
|
|
system "cmake", "..", *args
|
|
system "make", "install"
|
|
end
|
|
end
|
|
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, "-isystem", "#{include}/gdcm-2.8", "-o", "test.cxx.o", "-c", "test.cxx"
|
|
system ENV.cxx, "test.cxx.o", "-o", "test", "-L#{lib}", "-lgdcmDSED"
|
|
system "./test"
|
|
|
|
Language::Python.each_python(build) do |python, _py_version|
|
|
system python, "-c", "import gdcm"
|
|
end
|
|
end
|
|
end
|