OpenMesh
How to create your own project using OpenMesh

In this tutorial we will explain, how to create a new project using OpenMesh and build it with the CMake build system.

We assume, that you have already downloaded the OpenMesh source files as well as installed the CMake build tools.

There are quite few steps to follow to successfully add your own application to the build tree:

  • Go to OpenMeshRoot/src/OpenMesh/Apps and create a new directory, say "MyOwnProject"
  • Now create a new file called "CMakeLists.txt" containing the following lines:
include (VCICommon)
include_directories (
../../..
${CMAKE_CURRENT_SOURCE_DIR}
)
set (targetName MyOwnProject)
# collect all header and source files
vci_append_files (headers "*.hh" .)
vci_append_files (sources "*.cc" .)
vci_add_executable (${targetName} ${headers} ${sources})
target_link_libraries (${targetName}
OpenMeshCore
OpenMeshTools
)

(Remember to replace "MyProjectName" with whatever you have chosen as your project's name. Note: If you don't want to use *.hh and *.cc as your C++ source file suffices, you'll have to change this, too, because CMake won't build your sources otherwise.

  • Create your source files as for example explained in the previous tutorial (First Steps - Building a cube) and save them in the same directory.
  • Add
    add_subdirectory (MyOwnProject)
    to OpenMeshRoot/src/OpenMesh/Apps/CMakeLists.txt (note: You can either add this line right after the other projects or at the end of the file).
  • Create a directory called "build" in OpenMesh's root directory. Change to the newly created directory and call
    cmake ..
    and
    make

That's all. Your project will now be built.


Project OpenMesh, ©  Visual Computing Institute, RWTH Aachen. Documentation generated using doxygen .