class OpenMesh < Formula desc "Generic data structure to represent and manipulate polygonal meshes" homepage "https://openmesh.org/" url "https://www.openmesh.org/media/Releases/8.0/OpenMesh-8.0.tar.bz2" sha256 "f3311232d3611847c523bd4792ce8700f7ec81e9e1ff2a4bdda18eac70577d33" head "https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git" bottle do cellar :any sha256 "6bd14d6bbc21d69422c0af5e5ea2239c7fd2d4327d54de780a09d1d728a46459" => :catalina sha256 "2b6ca56b68c75abb0599ffb58d8f53479fcf7e523ae5be0d2cd914c4d18bfba6" => :mojave sha256 "85e4165e12cbf7ac988c1aebce01509d383665f6f2a775da64965d860f6195af" => :high_sierra sha256 "348b75951d4960940111b8abbb352aff0caf1d0fb2ab8a2f8a167aaf326e5db9" => :sierra end depends_on "cmake" => :build def install ENV.cxx11 mkdir "build" do system "cmake", "..", "-DBUILD_APPS=OFF", *std_cmake_args system "make", "install" end end test do (testpath/"test.cpp").write <<~EOS #include #include #include typedef OpenMesh::PolyMesh_ArrayKernelT<> MyMesh; int main() { MyMesh mesh; MyMesh::VertexHandle vhandle[4]; vhandle[0] = mesh.add_vertex(MyMesh::Point(-1, -1, 1)); vhandle[1] = mesh.add_vertex(MyMesh::Point( 1, -1, 1)); vhandle[2] = mesh.add_vertex(MyMesh::Point( 1, 1, 1)); vhandle[3] = mesh.add_vertex(MyMesh::Point(-1, 1, 1)); std::vector face_vhandles; face_vhandles.clear(); face_vhandles.push_back(vhandle[0]); face_vhandles.push_back(vhandle[1]); face_vhandles.push_back(vhandle[2]); face_vhandles.push_back(vhandle[3]); mesh.add_face(face_vhandles); try { if ( !OpenMesh::IO::write_mesh(mesh, "triangle.off") ) { std::cerr << "Cannot write mesh to file 'triangle.off'" << std::endl; return 1; } } catch( std::exception& x ) { std::cerr << x.what() << std::endl; return 1; } return 0; } EOS flags = %W[ -I#{include} -L#{lib} -lOpenMeshCore -lOpenMeshTools --std=c++11 ] system ENV.cxx, "test.cpp", "-o", "test", *flags system "./test" end end