This guide is designed to get you building OGRE from source with the default settings in the shortest possible time, showing you the barest minimum of CMake to do that, and minus any real discussion. Remember that there is a lot more to the hows and whys of this process, so it's a good idea to go back to the Getting Started With CMake page and read the whole thing when you have time.
We assume here that you've already downloaded / extracted the OGRE source code into a folder on your local machine. From here, go to the section for your platform.
Make sure that you've sorted out the Prerequisites before attempting to build Ogre with CMake!
- Download the Dependencies repository. To i.e. C:\OgreSDK\Dependencies
- Download and install CMake. You want the 'Win32 installer' release in the binary distribution section. Use version +2.8; version 3.x is not widely tested yet.
- Launch CMake via Start > Program Files > CMake 2.8 > CMake
- Point "Where is the source code" to C:\OgreSDK\Dependencies; and "Where to build the binaries" pointing to "C:\OgreSDK\Dependencies\build"
- Click 'Configure' and select the generator (i.e. if you're using Visual Studio 2013, select Visual Studio 12)
- Answer 'Ok' when asked if you want to create the build directory
- Sometimes on bleeding edge repos there might be CMake syntax warnings. Ignore them.
- Now click 'Generate'.
- Open C:\OgreSDK\Dependencies\build\OGREDEPS.sln under Visual Studio. If you have multiple versions of VS, make sure you open it with the one you targeted for in CMake.
- Build the whole solution; which should build FreeImage, freetype, OIS, zlib and zziplib. Make sure to build both Debug and Release
- Once it's finished, right click on INSTALL project, and click build. THIS IS VERY IMPORTANT. It will create the folder structure that Ogre needs. You need to do this both for Debug and Release.
- This should've created an SDK folder structure under C:\OgreSDK\Dependencies\build\ogredeps
- Now download Ogre from the repository into C:\OgreSDK.
- We now repeat the same process: Open CMake, set C:\OgreSDK and C:\OgreSDK\build as "Where is the source code" and "Where to build the binaries" respectively.
- Hit Configure and choose the same Visual Studio generator you did for the dependencies. It will now complain it can't find the Dependencies.
- Set OGRE_DEPENDENCIES_DIR to point to C:\OgreSDK\Dependencies\build\ogredeps as in the picture. Use the search filter to find the option quickly. Now hit configure again.
- Pro tip: If "C:\OgreSDK\Dependencies" contains the files that are generated in C:\OgreSDK\Dependencies\build\ogredeps; you can skip the previous step.
- Click Generate.
- Open the solution C:\OgreSDK\build\OGRE.sln and compile.
- Right click on INSTALL project if you wish to generate the SDK structure we provide in our official releases.
- You're done.
- If you are like me (I don't like using INSTALL feature for my own projects), you can add C:\OgreSDK\build\include to your project's include location and C:\OgreSDK\build\lib\Debug (and Release) to your additional library paths. The DLLs will be located in bin\debug (or release)
That's it for CMake! You now have a set of project files that are very much like you're used to in previous versions of OGRE, in the output folder you chose. There is now a special target called 'ALL_BUILD' which is a quick way to build all targets for a specific configuration. Note that all build output is now stored in a subfolder of this build folder, and not in the original OGRE source folder - so you can create multiple builds from one source directory now.
If you're more into video tutorials instead of reading, here's one:
If the embedded player is not showing up, here's the link: https://www.youtube.com/watch?v=-3XwyYQ9OLg