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 (ACGCommon)
include_directories (
../../..
${CMAKE_CURRENT_SOURCE_DIR}
)
set (targetName MyOwnProject)
# collect all header and source files
acg_append_files (headers "*.hh" .)
acg_append_files (sources "*.cc" .)
acg_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, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .