74 lines
2.4 KiB
Ruby
74 lines
2.4 KiB
Ruby
class OpenMesh < Formula
|
|
desc "Generic data structure to represent and manipulate polygonal meshes"
|
|
homepage "https://openmesh.org/"
|
|
url "https://www.openmesh.org/media/Releases/7.1/OpenMesh-7.1.tar.bz2"
|
|
sha256 "71cd5eb25893b0369ac766bb8305a525ffbb39b7f796d2878c7f9b8e0827cbac"
|
|
head "https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "569d019aa380afeff5ab62e031426ef62660b391ee6eb5b55ef1fd793860015e" => :mojave
|
|
sha256 "b7cefbc94249260c254e22d7502c2e21d86149784c20580ad5708f69a177ad81" => :high_sierra
|
|
sha256 "5d7fbe275ebec95a6f3abe24ac13d6b9bdb1df2e07bb43c92dd8e9e6383105c5" => :sierra
|
|
sha256 "77e73ad0a825ceae51b0bb906005a1c3e6fab6527adf7f2fcde9a12351d89dc8" => :el_capitan
|
|
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 <iostream>
|
|
#include <OpenMesh/Core/IO/MeshIO.hh>
|
|
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
|
|
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<MyMesh::VertexHandle> 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
|
|
]
|
|
system ENV.cxx, "test.cpp", "-o", "test", *flags
|
|
system "./test"
|
|
end
|
|
end
|