homebrew-core/Formula/opencascade.rb

96 lines
4.5 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_3;sf=tgz"
version "7.6.3"
sha256 "baae5b3a7a38825396fc45ef9d170db406339f5eeec62e21b21036afeda31200"
license "LGPL-2.1-only"
revision 1
# 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_ventura: "ee40f04033b6e18e85244585165ae9fe4f607819f90832b987c33ec7dcc0bcf7"
sha256 cellar: :any, arm64_monterey: "3a0ea3b12845cac63ec0adde1f3af3bb079dbde60c37b184fd3b2e00c1c24d32"
sha256 cellar: :any, arm64_big_sur: "9f50bbcd16fd80e9da21a2eacc995baa8ec45875a3f2a07dfe9cfb12c26c6cdc"
sha256 cellar: :any, ventura: "48de264e07506765c06e625955b9e399e5537c5b6328e24130c51700c6a4849d"
sha256 cellar: :any, monterey: "0ee55bb56dbc02c26f0d6321737ced2ede197f210fc796dc4bfa99c1d422b7ac"
sha256 cellar: :any, big_sur: "e8c67ba581ab52d35d11c6f7f93fdd582ef3f5185ace8da4b5afd6af743831a4"
sha256 cellar: :any, catalina: "9b6224a6ccd3484fb4e2b9cd14bfdd3e46ad1b555641f001422fc42cd00eb8be"
sha256 cellar: :any_skip_relocation, x86_64_linux: "b28effcc715e0a7aaeb02ae137536f3326fb540e6115e32602c63cf2a4fd5682"
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"]
libtcl = tcltk.opt_lib/shared_library("libtcl#{tcltk.version.major_minor}")
libtk = tcltk.opt_lib/shared_library("libtk#{tcltk.version.major_minor}")
system "cmake", "-S", ".", "-B", "build",
"-DUSE_FREEIMAGE=ON",
"-DUSE_RAPIDJSON=ON",
"-DUSE_TBB=ON",
"-DINSTALL_DOC_Overview=ON",
"-DBUILD_RELEASE_DISABLE_EXCEPTIONS=OFF",
"-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=#{libtcl}",
"-D3RDPARTY_TK_LIBRARY:FILEPATH=#{libtk}",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
bin.env_script_all_files(libexec, 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