Loading...
Searching...
No Matches
How to create your own project using OpenMesh and cmake

In this tutorial we will explain, how to create a new app using a pre build or installed OpenMesh library.

We assume that you already donwloaded and installed OpenMesh or compiled and installed it.

- Create a folder in which you want to place the source code of your application.
- Create a file called CMakeLists.txt containing the following lines:

cmake_minimum_required(VERSION 3.25)
project(OpenMesh-Example)
find_package(OpenMesh)
set (targetName MyOwnProject)
add_executable (${targetName} build_cube.cc)
target_link_libraries(${targetName} PRIVATE OpenMeshCore OpenMeshTools)
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition MeshItems.hh:59

- We assume, that your source code is in build_cube.cc. You can take the code from First Steps - Building a cube
- Create a build directory
- Run cmake inside the build directory. The source directory is the directory with the new CMakelists.txt file.
- If cmake can't find OpenMesh, Set the cmake variable OpenMesh_DIR to the installed OpenMesh directory and add share/OpenMesh/cmake
- Go to the build directory and compile your application using the generated build files