OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: Building Ogre V2 with CMake
View page
Source of version: 37
(current)
{BOX(width="100%",class="Layout_box9")}{SPLIT(colsize=10%|70%)}{IMG(src="img/wiki_up/CMake.png",imalign="left",link="Building Ogre V2 with CMake",title="Building Ogre V2 with CMake")}{IMG} --- {DIV(class="bigBold")}((Building Ogre V2 with CMake)){DIV} This section explains how to use CMake to build Ogre V2 from source. {SPLIT}{BOX} !!OUTDATE NOTICE This guide seems to have gotten old. You can see the [https://ogrecave.github.io/ogre-next/api/latest/_setting_up_ogre.html|official manual instructions] which are kept up to date. !!Getting the Ogre Sources First you need to download the Ogre sources. You can get them from [http://github.com/OGRECave/ogre-next]. Make sure you get the correct branch. Ogre V2 starts with branch '2-1' (use a tool like Sourcetree to pull this branch from Bitbucket). You also need the [https://github.com/OGRECave/ogre-next-deps|'dependencies' pack]. In most cases the 'default' branch of the 'dependencies' pack will suffice. Make sure you copy the whole 'ogredeps' directory in the Ogre root (on the same level as 'OgreMain') and rename it to 'Dependencies' (somewhere in the CMake scripts this name is needed). A pull from Bitbucket will automatically create an Ogre source directory at the place of your choice. In addition to the source directory, you also need to decide on a build directory - this is the place where CMake will setup a build system for you and where all compiled object files will reside. If you intend to build Ogre just once and then move on, you can pick any location. If, however, you plan on building Ogre several times, potentially with different configurations (static builds, threaded builds, ...), I recommend to adopt a directory layout similar to the following (but this is up to you): * __Ogre__ (the root directory for all Ogre versions, somewhere on your disk) ** __ogre2.1__ (Ogre branch 2.1) *** __.hg__ (used by Mercurial) *** __CMake__ *** __Components__ *** __Docs__ *** __Dependencies__ (copied 'ogredeps' structure and renamed it to Dependencies) *** __OgreMain__ *** __Other__ *** __PlugIns__ *** __RenderSystems__ *** __Samples__ *** __Scripts__ *** __SDK__ *** __Tests__ *** __Tools__ *** __VCBuild__ (Visual Studio build) *** __VCBuild.static__ (Visual Studio static build) !!Preparing the Environment !!Some adjustments Running CMake results in errors. Somehow, it cannot find RapidJson (used for loading and saving HLMS materials) and SDL2 (used for tutorials and samples). Make the following changes: * Change in __Dependencies\src\rapidjson\CMakeLists.txt__ the line ''set(rapidjson_INCLUDE_DIR "${rapidjson_SOURCE_DIR}" CACHE PATH "" FORCE)'' into ''set(__R__apidjson_INCLUDE_DIR "${rapidjson_SOURCE_DIR}" CACHE PATH "" FORCE)'' (watch the capital __R__). * Copy the complete directory __Dependencies\src\rapidjson\include__ to the same level and rename it to __Dependencies\src\rapidjson\rapidjson__, because the Ogre files are referring to that level, for example ''#include "rapidjson/document.h"'' in file ''__OgreHlmsJson.cpp__''. * For SDL2, currently the easiest option is to compile SDL2 separately (__Dependencies\src\SDL2\CMakeLists.txt__ needs some work). E.g. if you use Visual Studio, there is a separate ''__.sln__'' solution in __src\SDL2\VisualC__. If you build it, the paths for SDL2MAIN_LIBRARY, SDL2_INCLUDE_DIR and SDL2_LIBRARY_TEMP can be set manually (see next paragraph). !!Running CMake For this step, you need to have downloaded and installed CMake. If you need instructions on that, look here: ((Getting Started With CMake)). Run CMake to prepare your build directory. Instructions are at the page linked above, but in quintessence: Start cmake-gui, then at the top select the build and source directory you want to use and click on "Configure". Choose the compiler of choice. {IMG(src="tiki-download_file.php?fileId=2303&display",imalign="center")}{IMG} CMake returns with an error message. Ignore it for now and hit "Configure" again. Note, that SDL2 couldn't be located. The CMake properties SDL2MAIN_LIBRARY, SDL2_INCLUDE_DIR and SDL2_LIBRARY_TEMP must be manually filled (do not forget to compile SDL2 separately). The settings below refer to a 64bit build on Windows: * SDL2MAIN_LIBRARY = C:\Users\__LoggedInUser__\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\SDL2\VisualC\x64\Release\SDL2main.lib * SDL2_INCLUDE_DIR = C:\Users\__LoggedInUser__\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\SDL2\include * SDL2_LIBRARY_TEMP = C:\Users\__LoggedInUser__\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\SDL2\VisualC\x64\Release\SDL2.lib {DIV(class="Bloody_box1")}__LoggedInUser__ = Current user{DIV} Ogre offers a variety of build options you can configure with the help of cmake-gui. The default options provide a sensible default. Following is a list of available Ogre build options and their effect on the build process. * __CMAKE_BACKWARDS_COMPATIBILITY__ For backwards compatibility, what version of CMake commands and syntax should this version of CMake try to support. * __CMAKE_BUILD_TYPE__ Choose the type of build, options are: Debug, Release. * __CMAKE_CONFIGURATION_TYPES__ Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored. * __CMAKE_INSTALL_PREFIX__ OGRE install prefix. * __DirectX_DINPUT8_LIBRARY__ Refers to the input library of DirectX 9 (user for SDL2). * __EXECUTABLE_OUTPUT_PATH__ Single output directory for building all executables. * __LIBRARY_OUTPUT_PATH__ Single output directory for building all libraries. * __OGREDEPS_BUILD_AMD_QBS__ Build AMD Quad Buffer SDK dependency * __OGREDEPS_BUILD_CG__ Setting to build CG * __OGREDEPS_BUILD_FREEIMAGE__ Setting to build freeimage * __OGREDEPS_BUILD_FREETYPE__ Setting to build freetype * __OGREDEPS_BUILD_NVIDIA_NVAPI__ Build NVIDIA NVAPI dependency * __OGREDEPS_BUILD_OIS__ Setting to build OIS; this has become obsolete for Ogre V2, because keyboard input (tutorials and samples) is done by means of SDL2. * __OGREDEPS_BUILD_RAPIDJSON__ Setting to use RapidJson; Enable it when you want to save and load HLMS materials. * __OGREDEPS_BUILD_SDL2__ Setting to build OIS; this is needed for keyboard input (tutorials and samples). * __OGREDEPS_BUILD_ZLIB__ Setting to build zlib * __OGREDEPS_BUILD_ZZIPLIB__ Setting to build zziplib * __OGREDEPS_INSTALL_DEV__ Install development headers and libraries * __OGRE_ASSERT_MODE__ Enable Ogre asserts and exceptions. Possible values: ** 0 - Standard asserts in debug builds, nothing in release builds. ** 1 - Standard asserts in debug builds, exceptions in release builds. ** 2 - Exceptions in debug builds, exceptions in release builds. * __OGRE_BUILD_COMPONENT_HLMS_PBS__ Build the PBS (Physically Based Shaders) HLMS (High Language Material Shader). * __OGRE_BUILD_COMPONENT_HLMS_PBS_MOBILE__ Build option for PBS shaders (Physically Based Shaders) using HLMS (High Language Material Shader) - for mobile devices. * __OGRE_BUILD_COMPONENT_HLMS_UNLIT__ Build option for Unlit shaders using HLMS. * __OGRE_BUILD_COMPONENT_HLMS_UNLIT_MOBILE__ Build option for Unlit shaders using HLMS - for mobile devices. * __OGRE_BUILD_COMPONENT_MESHLODGENERATOR__ If enabled, Ogre's optional meshlod generator component will be built. * __OGRE_BUILD_COMPONENT_OVERLAY__ If enabled, Ogre's optional overlay component will be built. * __OGRE_BUILD_COMPONENT_PAGING__ If enabled, Ogre's optional paging component will be built. * __OGRE_BUILD_COMPONENT_RTSHADERSYSTEM__ If enabled, Ogre's optional runtime shader system component will be built; this component was introduced as a replacement of the fixed function pipeline, but has become obsolete in Ogre V2. * __OGRE_BUILD_MSVC_MP__ Multi processor build flag for Visual Studio; see [https://msdn.microsoft.com/en-us/library/bb385193.aspx] * __OGRE_BUILD_MSVC_ZM__ Specify memory allocation limit for Visual Studio; see [https://msdn.microsoft.com/en-us/library/bdscwf1c.aspx]; Add /Zm256 compiler option to Visual Studio to fix PCH errors * __OGRE_BUILD_PLATFORM_NACL__ If enabled, Ogre will be built for Google's Native Client platform * __OGRE_BUILD_PLUGIN_CG__ If enabled, the Cg ProgramManager plugin will be built. This requires that Nvidia's Cg compiler library was found by CMake. * __OGRE_BUILD_PLUGIN_PFX__ If enabled, the ParticleFX plugin will be built. * __OGRE_BUILD_RENDERSYSTEM_3D11__ If enabled, the Direct3D11 RenderSystem will be built. This requires a Windows platform and a sufficiently recent DirectX SDK. * __OGRE_BUILD_RENDERSYSTEM_GL3PLUS__ If enabled, the OpenGL 3+ RenderSystem will be built. * __OGRE_BUILD_RENDERSYSTEM_GLES__ If enabled, the OpenGL ES RenderSystem will be built. This requires that CMake needs to have found the Open GL ES SDK. * __OGRE_BUILD_SAMPLES__ Obsolete for Ogre V2 * __OGRE_BUILD_SAMPLES2__ If enabled, Ogre V2 tutorial and samples will be built. * __OGRE_BUILD_TESTS__ If enabled, Ogre library test cases will be built. This requires that the cppunit library was found by CMake. * __OGRE_BUILD_TOOLS__ If enabled, this will build Ogre's command line tools (MeshUpgrader and [[OgreXmlConverter|XMLConverter]]). * __OGRE_CONFIG_ENABLE_JSON__ If enabled, Ogre is capable to save and load HLMS materials (and other types ) in Json format. * __OGRE_CONFIG_ENABLE_QUAD_BUFFER_STEREO__ Enable stereoscopic 3D support * __OGRE_CONFIG_THREADS__ This setting determines Ogre's threading support. A value of 0 disables threading support. A setting of 1 enables full background resource loading, whereas a value of 2 enables only background resource preparation. ''Setting this to 1 does not work under Linux, using only modes 0 and 2 is recommended.'' * __OGRE_CONFIG_THREAD_PROVIDER__ Determines which library is used for threading; you must have a good reason to use a threading library. Using this is considered 'old style' in Ogre and not recommended in Ogre 2.1 and beyond. ** boost - Boost thread library. ** poco - (Poco thread library. ** tbb - ThreadingBuildingBlocks library. ** stl - STL thread library (requires compiler support). ** none * __OGRE_CONFIG_COPY_DEPENDENCIES__ * __OGRE_CONFIG_DEPENDENCIES_DIR__ * __OGRE_INSTALL_DEPENDENCIES__ Install dependency libs needed for samples. * __OGRE_INSTALL_DOCS__ Install documentation. * __OGRE_INSTALL_PDB__ Install debug pdb files. * __OGRE_INSTALL_SAMPLES__ Install Ogre demos. * __OGRE_INSTALL_TOOLS__ Install Ogre tools. * __OGRE_INSTALL_VSPROPS__ Install Visual Studio Property Page. * __OGRE_LEGACY_ANIMATION__ Use the skeletal animation from Ogre 1.x. It's much slower, but the new system is still experimental. * __OGRE_RESTRICT_ALIASSING__ * __OGRE_SIMD_NEON__ Enable SIMD (Include NEON files). * __OGRE_SIMD_SSE2__ Enable SIMD (Include SSE2 files). * __OGRE_STATIC__ Static build * __OGRE_UNITY_BUILD__ Enable unity build for Ogre. * __OGRE_UNITY_FILES_PER_UNIT__ Number of files per compilation unit in Unity build. * __SDL2MAIN_LIBRARY__ Location (path) of SDL main library * __SDL2_INCLUDE_DIR__ Location (path) of SDL header files * __SDL2_LIBRARY__ Location (path) of SDL library Choose options according to your wishes; e.g. OGRE_BUILD_SAMPLES2 is not checked; check it if you want to build the Ogre V2 samples. OGRE_BUILD_SAMPLES is unchecked. Leave it this way, because they refer to samples of previous Ogre version. In particular, disabling features you don't need will apparently reduce your compile time. Once you're satisfied, hit 'Configure' again in cmake-gui until all red lines are disappeard, then select 'Generate'. This will create a customised build system in your build directory, according to the options you just selected. !!Configure and compile {VERSIONS(nav="y",title="y",default="Microsoft Windows")} {SPLIT(colsize=10%|70%)}{IMG(src="img/wiki_up/Big_Logo_Windows.jpg",height="66",width="66",imalign="left")}{IMG} --- ~tc~clear~/tc~ !!! %done% Visual Studio Open the file ''__OGRE.sln__'' in the path you defined in the CMake gui (''"Where to build the binaries"'') and choose the option "Build Solution" from the Visual Studio menu. The binaries are build in the __bin\release__ directory. {SPLIT} ---(Linux)--- {SPLIT(colsize=10%|70%)}{IMG(src="img/wiki_up/Big_Logo_Linux.jpg",height="66",width="66",imalign="left")}{IMG} --- ~tc~clear~/tc~ {DIV(class="Bloody_box1")} This part must still be completed for Linux. Please refer to ((Building Ogre With CMake)) for previous Ogre versions. {DIV} {SPLIT} ---(Mac OS X & iOS)--- {SPLIT(colsize=10%|70%)}{IMG(src="img/wiki_up/Big_Logo_Macintosh.jpg",height="66",width="66",imalign="left")}{IMG} --- ~tc~clear~/tc~ {DIV(class="Bloody_box1")} This part must still be completed for Mac OS X & iOS. Please refer to ((Building Ogre With CMake)) for previous Ogre versions. {DIV} {SPLIT} {VERSIONS}
Search by Tags
Search Wiki by Freetags
Latest Changes
IDE Eclipse
FMOD SoundManager
HDRlib
Building Ogre V2 with CMake
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
...more
Search
Find
Advanced
Search Help
Online Users
72 online users