class Gmsh < Formula desc "3D finite element grid generator with CAD engine" homepage "http://gmsh.info/" url "http://gmsh.info/src/gmsh-3.0.4-source.tgz" sha256 "f3105bcd30f843f5842d7d5507b7c3e40a6dfb3fdcf38f4bae2739dc10c7719d" head "http://gitlab.onelab.info/gmsh/gmsh.git" bottle do cellar :any sha256 "7a28135adb27d4005d83c51950d4566abb41865a90a87b4136e4d159649e571b" => :sierra sha256 "09d964553b98f6807b8799af30564b3f38b65696c3b8c818a99012bd555ba957" => :el_capitan sha256 "9cd224592b9c5a6b647f27402294c4399ca4e85f50cdfdc4e0ac0099cb8eef55" => :yosemite end option "with-oce", "Build with oce support (conflicts with opencascade)" option "with-opencascade", "Build with opencascade support (conflicts with oce)" depends_on "cmake" => :build depends_on :fortran depends_on :mpi => [:cc, :cxx, :f90] depends_on "homebrew/science/oce" => :optional depends_on "homebrew/science/opencascade" => :optional depends_on "fltk" => :optional depends_on "cairo" if build.with? "fltk" if build.with?("opencascade") && build.with?("oce") odie "gmsh: '--with-opencascade' and '--with-oce' conflict." end 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? "oce" ENV["CASROOT"] = Formula["oce"].opt_prefix args << "-DENABLE_OCC=ON" elsif 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