compiling.docu 6.18 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117

/** \page compiling Compiling OpenMesh

\section compilers Tested compilers

%OpenMesh has been successfully tested for the following operating
systems / compilers. This is only a list of tested compilers. 
More might be supported but are not tested. Make sure that your compiler
supports at least C++11


<tr><td> Linux </td><td>
gcc   >= 4.8.x<br>
clang >= 3.3<br>

<tr><td> Windows </td><td> 
Microsoft Visual Studio 2013<br>
Microsoft Visual Studio 2015<br>
Microsoft Visual Studio 2017<br>

<tr><td> Tested MacOS X Compilers</td>
XCode  <br>


\section req_libs Required libraries (Only if you want to build the included Apps)

Install the following external libraries / frameworks if you want to use the included Applications:<br><br>
<tr><td>Qt5</td><td><a href="" target="_blank"></a></td></tr>

\section build_systems Chosing build system

%OpenMesh can be built using the <b>cmake</b> build system.

\section sec_compiling_unix Unix

\subsection linux_using_cmake Compiling OpenMesh using CMake

In order to compile %OpenMesh, create a directory named e.g. "build" in
OpenMesh's root directory. <b>Change to the newly created directory</b> and type
cmake&nbsp;..&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;## Generates the appropriate Makefiles<br>
make&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;## Builds the project<br>

\warning If your compiler does not support c++11 natively, you might have to enable it by changing the cmake call to: <br>
         <tt>cmake .. -DCMAKE_CXX_FLAGS=-std=c++98</tt>

You can choose the build type by using cmake with the flag<br>
<b>-DCMAKE_BUILD_TYPE=(Debug|Release)</b>    The default is: Release <br>

Other flags are:<br/>
<b>-DBUILD_APPS=OFF</b> to disable build of applications and<br/>
<b>-DCMAKE_INSTALL_PREFIX=&lt;path&gt;</b> to specify the install path.<br/>

When calling <b>make install</b> cmake will install %OpenMesh into this
directory using the subdirectories lib/include/bin.

CMake builds both shared and static under Linux.

Everything will then be build in the <b>Build</b> subdirectory containing the libraries in <b>lib</b> and the binaries in <b>bin</b>.

There are some additional targets:<br>
<b>doc</b>: Builds the Documentation<br>
<b>doc-install</b>: Builds the Documentation and installs it<br>
\note When you link against the static libraries of OpenMesh and get the error "can not be used when making a
shared object; recompile with -fPIC" you need to add "-fPIC" to the CMAKE_CXX_FLAGS. (This is usually added automatically)

\section sec_compiling_windows Windows

\subsection windows_using_cmake Compiling OpenMesh using CMake

Building OpenMesh on Windows requires cmake to generate the project files for Visual Studio.

<li> Get Visual Studio ( 2013-2017 ) </li>
<li> Extract %OpenMesh source code. </li>
<li> Get all required libraries and install them ( including headers! ).</li>
<li> Download and install cmake:  <a href=""></a>.<br> </li>
<li> Start the cmake gui and open the %OpenMesh toplevel directory as source directory </li>
<li> Choose a build directory (e.g. create a directory called "build" in OpenMesh's root folder) </li>
<li> Click on configure .... If any libraries are left unconfigured, you can adjust the path manually. Rerun configure until everything is configured correctly. <br>
     Attention: Some build variables are only visible in advanced view mode. Select Visual Studio 9 (2008), Visual Studio 10(2010), Visual Studio 11 (2012), Visual Studio 12 (2013)  (Depending on your version) as
     generator. </li>
<li> Click generate to create the visual studio project files </li>
<li> You can now find a Visual Studio solution file (OpenMesh.sln) in the <b>build</b> directory you chose in cmake </li>
<li> Now you can build %OpenMesh from within Visual Studio using the newly created project file. </li>


\section sec_compiling_macosx MacOS X

Download and install required libraries as stated above.
Jan Möbius's avatar
Jan Möbius committed
118 119
You can download %OpenMesh's sources from <tt></tt> or check out the latest repository via GIT:<br/>
Jan Möbius's avatar
Jan Möbius committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163

\subsection mac_using_cmake Compiling OpenMesh using CMake

We recommend you to use CMake >= 3.7 as build system. This can also easily be installed
via MacPorts as well as the Qt >= 5.6 library which is used for some example applications
in %OpenMesh.<br/>
Once installed, change to %OpenMesh's root directory and create a directory
named e.g. "buildDebug" (assuming you want to build with debug symbols).<br/>
Then type in the following command to initially set up the build environment:
cmake&nbsp;..&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;## Generates the appropriate Makefiles<br>
Note: If the build directory is not a subdirectory of %OpenMesh's root folder, replace ".." with %OpenMesh's
absolute (or relative) path.
In order to manually set specific build variables, just type:
ccmake&nbsp;.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;## Configure build environment<br>
This opens the CMake configure tool. Change the CMAKE_BUILD_TYPE variable to "Release" in order to prepare build
for release configuration. Now, when everything is set up, just type:
make&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;## Build %OpenMesh<br>
And optionally:
make&nbsp;doc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;## Build %OpenMesh's documentation<br>
The mac application bundle will be found under "Build" in the recently created build folder. 
It automatically contains all needed shared objects (libs, fonts, textures, etc.).

CMake builds both shared and static under MacOS X.