class Gmsh < Formula desc "3D finite element grid generator with CAD engine" homepage "https://gmsh.info/" url "https://gmsh.info/src/gmsh-4.0.6-source.tgz" sha256 "dce0aa4154908f9be8c48ec9bb31d4425c7c28b26897d882a2bce8f72c692a04" head "https://gitlab.onelab.info/gmsh/gmsh.git" bottle do cellar :any sha256 "3e839bb7045b14b4d9f1aed8928eec4464e8253ab7d89eb0b4701b9ea5a68518" => :mojave sha256 "5ae7512d0763a0b092207dc40c4f8eb38062064ab2a8613e06ae02368246a5af" => :high_sierra sha256 "54e76a8a8857c3a00059b4fbf3a5fb503563f13eaa9a376d2c76ea19da435df7" => :sierra end option "with-opencascade", "Build with opencascade support" depends_on "cmake" => :build depends_on "gcc" # for gfortran depends_on "open-mpi" depends_on "fltk" => :optional depends_on "cairo" if build.with? "fltk" depends_on "opencascade" => :optional def install args = std_cmake_args + %W[ -DENABLE_OS_SPECIFIC_INSTALL=0 -DGMSH_BIN=#{bin} -DGMSH_LIB=#{lib} -DGMSH_DOC=#{pkgshare}/gmsh -DGMSH_MAN=#{man} -DENABLE_BUILD_LIB=ON -DENABLE_BUILD_SHARED=ON -DENABLE_NATIVE_FILE_CHOOSER=ON -DENABLE_PETSC=OFF -DENABLE_SLEPC=OFF ] if build.with? "opencascade" ENV["CASROOT"] = Formula["opencascade"].opt_prefix args << "-DENABLE_OCC=ON" else args << "-DENABLE_OCC=OFF" end args << "-DENABLE_FLTK=OFF" if build.without? "fltk" mkdir "build" do system "cmake", "..", *args system "make" system "make", "install" # Move onelab.py into libexec instead of bin mkdir_p libexec mv bin/"onelab.py", libexec end end def caveats "To use onelab.py set your PYTHONDIR to #{libexec}" end test do system "#{bin}/gmsh", "#{share}/doc/gmsh/tutorial/t1.geo", "-parse_and_exit" end end