homebrew-core/Formula/opencascade.rb

88 lines
4.1 KiB
Ruby

class Opencascade < Formula
desc "3D modeling and numerical simulation software for CAD/CAM/CAE"
homepage "https://dev.opencascade.org/"
url "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=refs/tags/V7_6_2;sf=tgz"
version "7.6.2"
sha256 "443f782f4adfd316e3f81bfad01d5367ae55ceb0d04c1acec1b87baae5c75e1c"
license "LGPL-2.1-only"
# The first-party download page (https://dev.opencascade.org/release)
# references version 7.5.0 and hasn't been updated for later maintenance
# releases (e.g., 7.6.2, 7.5.2), so we check the Git tags instead. Release
# information is posted at https://dev.opencascade.org/forums/occt-releases
# but the text varies enough that we can't reliably match versions from it.
livecheck do
url "https://git.dev.opencascade.org/repos/occt.git"
regex(/^v?(\d+(?:[._]\d+)+(?:p\d+)?)$/i)
strategy :git do |tags, regex|
tags.map { |tag| tag[regex, 1]&.gsub("_", ".") }.compact
end
end
bottle do
sha256 cellar: :any, arm64_monterey: "fcc339d2b37a2b8cb0d2abfe18278b377052db2efc4e878f3041172cf4556fd8"
sha256 cellar: :any, arm64_big_sur: "d1fe34d968ef3cc896ef218dac0c874f3c878ad9b2ec3fe2745d97246d23775a"
sha256 cellar: :any, monterey: "aab016c958c57cbba2bfc69aae276dabd8262ceae3534f6a11161015649774a7"
sha256 cellar: :any, big_sur: "c8a1c82ba773d2172970286fb8e3bc497bf36cdf2ea496be1fc0ccdb900db16c"
sha256 cellar: :any, catalina: "7a3b452e17479cb7c94b3e85a1c9de6e364ececa0cfe99cfc558791420a731b0"
sha256 cellar: :any_skip_relocation, x86_64_linux: "952cd53fcd596b002bf2e914d498280240597b892022b102c6c04c13ac67064b"
end
depends_on "cmake" => :build
depends_on "doxygen" => :build
depends_on "rapidjson" => :build
depends_on "fontconfig"
depends_on "freeimage"
depends_on "freetype"
depends_on "tbb"
depends_on "tcl-tk"
on_linux do
depends_on "mesa" # For OpenGL
end
# Fix compilation errors with oneTBB 2021
# Issue ref: https://tracker.dev.opencascade.org/view.php?id=0032697
patch do
url "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=patch;h=740833a6a88e481f474783c426b6f6311ed586d3"
sha256 "04932bf0674906dbc8f9c4ff0702aad3147c5db9abd0262973e18a1e4cd73976"
end
def install
tcltk = Formula["tcl-tk"]
system "cmake", ".",
"-DUSE_FREEIMAGE=ON",
"-DUSE_RAPIDJSON=ON",
"-DUSE_TBB=ON",
"-DINSTALL_DOC_Overview=ON",
"-D3RDPARTY_FREEIMAGE_DIR=#{Formula["freeimage"].opt_prefix}",
"-D3RDPARTY_FREETYPE_DIR=#{Formula["freetype"].opt_prefix}",
"-D3RDPARTY_RAPIDJSON_DIR=#{Formula["rapidjson"].opt_prefix}",
"-D3RDPARTY_RAPIDJSON_INCLUDE_DIR=#{Formula["rapidjson"].opt_include}",
"-D3RDPARTY_TBB_DIR=#{Formula["tbb"].opt_prefix}",
"-D3RDPARTY_TCL_DIR:PATH=#{tcltk.opt_prefix}",
"-D3RDPARTY_TK_DIR:PATH=#{tcltk.opt_prefix}",
"-D3RDPARTY_TCL_INCLUDE_DIR:PATH=#{tcltk.opt_include}",
"-D3RDPARTY_TK_INCLUDE_DIR:PATH=#{tcltk.opt_include}",
"-D3RDPARTY_TCL_LIBRARY_DIR:PATH=#{tcltk.opt_lib}",
"-D3RDPARTY_TK_LIBRARY_DIR:PATH=#{tcltk.opt_lib}",
"-D3RDPARTY_TCL_LIBRARY:FILEPATH=#{tcltk.opt_lib}/libtcl#{tcltk.version.major_minor}.dylib",
"-D3RDPARTY_TK_LIBRARY:FILEPATH=#{tcltk.opt_lib}/libtk#{tcltk.version.major_minor}.dylib",
"-DCMAKE_INSTALL_RPATH:FILEPATH=#{lib}",
*std_cmake_args
system "make", "install"
bin.env_script_all_files(libexec/"bin", CASROOT: prefix)
# Some apps expect resources in legacy ${CASROOT}/src directory
prefix.install_symlink pkgshare/"resources" => "src"
end
test do
output = shell_output("#{bin}/DRAWEXE -b -c \"pload ALL\"")
# Discard the first line ("DRAW is running in batch mode"), and check that the second line is "1"
assert_equal "1", output.split(/\n/, 2)[1].chomp
end
end