Merge branch 'cmake_build_doc' into 'master'

Added documentation about using cmake to build an application using OpenMesh

See merge request OpenMesh/OpenMesh!328
This commit is contained in:
Jan Möbius
2023-02-28 13:58:06 +00:00
5 changed files with 39 additions and 5 deletions

View File

@@ -0,0 +1,11 @@
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)

View File

@@ -35,7 +35,8 @@
<b>Documentation</b> <b>Documentation</b>
<ul> <ul>
<li>Added some information on how to build and run the unittests.</li> <li>Added information on how to build and run the unittests.</li>
<li>Added documentation about using cmake to build an application using OpenMesh.</li>
</ul> </ul>
</tr> </tr>

View File

@@ -80,6 +80,7 @@ repeatedly replacing each vertex' position by the center of gravity
\li \ref mesh_type \li \ref mesh_type
\li \ref tutorial_01 \li \ref tutorial_01
\li \ref tutorial_build \li \ref tutorial_build
\li \ref tutorial_build_internal_apps
\li \ref tutorial_02 \li \ref tutorial_02
\li \ref tutorial_03 \li \ref tutorial_03
\li \ref tutorial_04 \li \ref tutorial_04

View File

@@ -1,15 +1,18 @@
/** \page tutorial_build How to create your own project using OpenMesh /**
\page tutorial_build_internal_apps How to create your own project inside OpenMesh
In this tutorial we will explain, how to create a new project using In this tutorial we will explain, how to create a new app inside the source code of
%OpenMesh and build it with the CMake build system. We assume, that you have already %OpenMesh and compile 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. downloaded the %OpenMesh source files as well as installed the CMake build tools.
<b>If you only want to use OpenMesh from your program, please refer to the tutorial \ref tutorial_build !</b>
There are quite few steps to follow to successfully add your own application to the build tree: There are quite few steps to follow to successfully add your own application to the build tree:
\li Go to OpenMeshRoot/src/OpenMesh/Apps and create a new directory, say "MyOwnProject" \li Go to OpenMeshRoot/src/OpenMesh/Apps and create a new directory, say "MyOwnProject"
\li Now create a new file called "CMakeLists.txt" containing the following lines: \li Now create a new file called "CMakeLists.txt" containing the following lines:
\include CMakeLists.txt \include CMakeLists.txt-internal
(Remember to replace "MyProjectName" with whatever you have chosen as your project's name. (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 Note: If you don't want to use *.hh and *.cc as your C++ source file suffices, you'll
@@ -26,4 +29,22 @@ add this line right after the other projects or at the end of the file).
That's all. Your project will now be built. That's all. Your project will now be built.
\page tutorial_build 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.
\li Create a folder in which you want to place the source code of your application.
\li Create a file called CMakeLists.txt containing the following lines:
\include CMakeLists.txt-external
\li We assume, that your source code is in build_cube.cc. You can take the code from \ref tutorial_01
\li Create a build directory
\li Run cmake inside the build directory. The source directory is the directory with the new CMakelists.txt file.
\li If cmake can't find OpenMesh, Set the cmake variable <b>OpenMesh_DIR</b> to the installed OpenMesh directory and add <b>share/OpenMesh/cmake</b>
\li Go to the build directory and compile your application using the generated build files
**/ **/