2017-09-20 21:11:53 +00:00
|
|
|
class Gdcm < Formula
|
|
|
|
desc "Grassroots DICOM library and utilities for medical files"
|
|
|
|
homepage "https://sourceforge.net/projects/gdcm/"
|
2018-04-10 12:10:36 +00:00
|
|
|
url "https://downloads.sourceforge.net/project/gdcm/gdcm%202.x/GDCM%202.8.6/gdcm-2.8.6.tar.gz"
|
|
|
|
sha256 "05c912e3777af5d266641fbb4869fdcb5f6e955cadf3eaea803fecb9060b145a"
|
2017-09-20 21:11:53 +00:00
|
|
|
|
2017-09-27 10:30:16 +00:00
|
|
|
bottle do
|
2018-04-10 13:07:32 +00:00
|
|
|
sha256 "2bd95f05df6e1d55db4494a8553e95af0efa14c8ed7a811fc809ea44abb89f2b" => :high_sierra
|
|
|
|
sha256 "6e8305b80da7c30655e2c9354fa48c6547156fe06faf2a23590f4d2284309fc9" => :sierra
|
|
|
|
sha256 "5648c8c74bc0d6e8972f2a6df81a08dd209a902b0cbb72c91a3456178e36b0b4" => :el_capitan
|
2017-09-27 10:30:16 +00:00
|
|
|
end
|
|
|
|
|
2018-03-02 07:06:48 +00:00
|
|
|
option "without-python@2", "Build without python2 support"
|
2017-10-17 15:01:11 +00:00
|
|
|
|
2018-03-02 07:06:48 +00:00
|
|
|
deprecated_option "with-python3" => "with-python"
|
|
|
|
deprecated_option "without-python" => "without-python@2"
|
|
|
|
|
2018-04-07 08:36:49 +00:00
|
|
|
depends_on "python@2" => :recommended
|
2018-03-02 07:06:48 +00:00
|
|
|
depends_on "python" => :optional
|
|
|
|
depends_on "swig" => :build if build.with?("python") || build.with?("python@2")
|
2017-10-17 15:01:11 +00:00
|
|
|
|
2017-09-20 21:11:53 +00:00
|
|
|
depends_on "cmake" => :build
|
2017-10-30 06:35:14 +00:00
|
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "openjpeg"
|
2017-09-20 21:11:53 +00:00
|
|
|
depends_on "openssl"
|
|
|
|
|
|
|
|
needs :cxx11
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV.cxx11
|
|
|
|
|
2017-10-17 15:01:11 +00:00
|
|
|
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
|
2017-12-24 13:01:22 +00:00
|
|
|
-DGDCM_USE_VTK=OFF
|
2017-10-30 06:35:14 +00:00
|
|
|
-DGDCM_USE_SYSTEM_OPENJPEG=ON
|
2017-10-17 15:01:11 +00:00
|
|
|
-DGDCM_USE_SYSTEM_OPENSSL=ON
|
|
|
|
]
|
|
|
|
|
2017-09-20 21:11:53 +00:00
|
|
|
mkdir "build" do
|
2018-03-02 07:06:48 +00:00
|
|
|
if build.without?("python") && build.without?("python@2")
|
2017-10-17 15:01:11 +00:00
|
|
|
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
|
2017-09-20 21:11:53 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2018-02-15 16:11:45 +00:00
|
|
|
(testpath/"test.cxx").write <<~EOS
|
2017-09-20 21:11:53 +00:00
|
|
|
#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"
|
2017-10-17 15:01:11 +00:00
|
|
|
|
|
|
|
Language::Python.each_python(build) do |python, _py_version|
|
|
|
|
system python, "-c", "import gdcm"
|
|
|
|
end
|
2017-09-20 21:11:53 +00:00
|
|
|
end
|
|
|
|
end
|