138 lines
4.7 KiB
Ruby
138 lines
4.7 KiB
Ruby
class Vtk < Formula
|
|
desc "Toolkit for 3D computer graphics, image processing, and visualization"
|
|
homepage "https://www.vtk.org/"
|
|
url "https://www.vtk.org/files/release/9.1/VTK-9.1.0.tar.gz"
|
|
sha256 "8fed42f4f8f1eb8083107b68eaa9ad71da07110161a3116ad807f43e5ca5ce96"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/Kitware/VTK.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "8d643fb283e3da2a2cf20c2787826b139a43d1b27de373dd97f2a59a030d00ee"
|
|
sha256 arm64_big_sur: "8a36ea9bc18cc1dcda17265e9bd57c67d2988182af3fee0299f9c6654fe94f38"
|
|
sha256 big_sur: "b213eef44f72f772a71579a36f94f16d02e4dbfb390e858edb7b66f0672d66fa"
|
|
sha256 catalina: "1a702b1c3def8710fe01b4c61e6b5e17fd7c56e505dc75f54dab687926cf5089"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "194988f3f713541e043db994b6701cbf8d8ae7227ff725280fe208a8af54f688"
|
|
end
|
|
|
|
depends_on "cmake" => [:build, :test]
|
|
depends_on "boost"
|
|
depends_on "double-conversion"
|
|
depends_on "eigen"
|
|
depends_on "fontconfig"
|
|
depends_on "gl2ps"
|
|
depends_on "glew"
|
|
depends_on "hdf5"
|
|
depends_on "jpeg"
|
|
depends_on "jsoncpp"
|
|
depends_on "libogg"
|
|
depends_on "libpng"
|
|
depends_on "libtiff"
|
|
depends_on "lz4"
|
|
depends_on "netcdf"
|
|
depends_on "pugixml"
|
|
depends_on "pyqt@5"
|
|
depends_on "python@3.9"
|
|
depends_on "qt@5"
|
|
depends_on "sqlite"
|
|
depends_on "theora"
|
|
depends_on "utf8cpp"
|
|
depends_on "xz"
|
|
|
|
uses_from_macos "expat"
|
|
uses_from_macos "libxml2"
|
|
uses_from_macos "tcl-tk"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "gcc"
|
|
depends_on "szip"
|
|
depends_on "mesa-glu"
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
args = std_cmake_args + %W[
|
|
-DBUILD_SHARED_LIBS:BOOL=ON
|
|
-DBUILD_TESTING:BOOL=OFF
|
|
-DCMAKE_INSTALL_NAME_DIR:STRING=#{opt_lib}
|
|
-DCMAKE_INSTALL_RPATH:STRING=#{rpath}
|
|
-DVTK_WRAP_PYTHON:BOOL=ON
|
|
-DVTK_PYTHON_VERSION:STRING=3
|
|
-DVTK_LEGACY_REMOVE:BOOL=ON
|
|
-DVTK_MODULE_ENABLE_VTK_InfovisBoost:STRING=YES
|
|
-DVTK_MODULE_ENABLE_VTK_InfovisBoostGraphAlgorithms:STRING=YES
|
|
-DVTK_MODULE_ENABLE_VTK_RenderingFreeTypeFontConfig:STRING=YES
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_doubleconversion:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_eigen:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_expat:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_glew:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_lz4:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_lzma:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_ogg:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_png:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_theora:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_tiff:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_utf8:BOOL=ON
|
|
-DVTK_MODULE_USE_EXTERNAL_VTK_zlib:BOOL=ON
|
|
-DPython3_EXECUTABLE:FILEPATH=#{Formula["python@3.9"].opt_bin}/python3
|
|
-DVTK_GROUP_ENABLE_Qt:STRING=YES
|
|
]
|
|
|
|
# https://github.com/Homebrew/linuxbrew-core/pull/21654#issuecomment-738549701
|
|
args << "-DOpenGL_GL_PREFERENCE=LEGACY"
|
|
|
|
args << "-DVTK_USE_COCOA:BOOL=ON" if OS.mac?
|
|
|
|
mkdir "build" do
|
|
system "cmake", "..", *args
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"CMakeLists.txt").write <<~EOS
|
|
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
|
|
project(Distance2BetweenPoints LANGUAGES CXX)
|
|
find_package(VTK REQUIRED COMPONENTS vtkCommonCore CONFIG)
|
|
add_executable(Distance2BetweenPoints Distance2BetweenPoints.cxx)
|
|
target_link_libraries(Distance2BetweenPoints PRIVATE ${VTK_LIBRARIES})
|
|
EOS
|
|
|
|
(testpath/"Distance2BetweenPoints.cxx").write <<~EOS
|
|
#include <cassert>
|
|
#include <vtkMath.h>
|
|
int main() {
|
|
double p0[3] = {0.0, 0.0, 0.0};
|
|
double p1[3] = {1.0, 1.0, 1.0};
|
|
assert(vtkMath::Distance2BetweenPoints(p0, p1) == 3.0);
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
vtk_dir = Dir[opt_lib/"cmake/vtk-*"].first
|
|
system "cmake", "-DCMAKE_BUILD_TYPE=Debug", "-DCMAKE_VERBOSE_MAKEFILE=ON",
|
|
"-DVTK_DIR=#{vtk_dir}", "."
|
|
system "make"
|
|
system "./Distance2BetweenPoints"
|
|
|
|
(testpath/"Distance2BetweenPoints.py").write <<~EOS
|
|
import vtk
|
|
p0 = (0, 0, 0)
|
|
p1 = (1, 1, 1)
|
|
assert vtk.vtkMath.Distance2BetweenPoints(p0, p1) == 3
|
|
EOS
|
|
|
|
system bin/"vtkpython", "Distance2BetweenPoints.py"
|
|
end
|
|
end
|