Tuesday, October 15, 2013

Building OGRE

Building OGRE itself

Prerequisites

     You will need the following tools:
  • All the prerequisites from the tutorial on building the Ogre dependencies
  • The built binaries for the Ogre dependencies.
  • Boost


Clone the repository

    Clone the Hg repository found at https://bitbucket.org/sinbad/ogre/.
You can do this by going to a folder of your choice in Windows Explorer, right clicking a window background in Windows Explorer, selecting TortoiseHg from the context menu and then Clone from the sub-menu.
My local OGRE repository clone folder
My local OGRE repository clone folder

    You should receive a smaller window where you can specify the details of the clone operation. Here you should specify the  source (https://bitbucket.org/sinbad/ogre/) and the destination (E.g. C:\code\ogre). Just make sure you add the name of the sub-folder to use. Mercurial will not create a sub-folder otherwise. You should see that the text box on the bottom side of the window is updated according to the changes you perform. You could run the command provided there in a cmd window to get the same results.
The OGRE clone repository command window in TortoiseHg
The OGRE clone repository command window in TortoiseHg
    It might take a few minutes for the repository to be downloaded. After the clone operation is completed, you should be able to see the files in the local directory.

Update the repository to the used branch

    Go to the folder you used as a local clone; you should right click on the window background and bring up the context menu again. Select TortoiseHg from there and then click the Update entry from the sub-menu.
Ogre directory (almost clean)
Ogre directory (almost clean)
    You should be presented with the Update dialog, where you can select the branch to use for Ogre. For this tutorial please select the v1-9 branch, then click the Update button. The procedure should be fairly similar for other branch versions.
Hg: Update Ogre on the 1.9 branch
Hg: Update Ogre on the 1.9 branch


Copy the build dependency binaries

    The ogre package should be able to find most of the files it has and dependencies. In order to be able to easily prepare the OGRE solution, you should copy the dependencies to their standard location. You can always choose to use a different location, but that would take more time. Please create a Dependencies sub-folder in the Ogre folder (E.g. c:\code\ogre\Dependencies\).
Ogre dependencies copied
Ogre dependencies copied

    You should take the dependencies built with the INSTALL project (E.g. c:\code\ogredeps\build\ogredeps\) . The ogredeps folder should typically contain 3 folders: bin, include and lib. Copy these to the Dependencies sub-folder.

Configure and create the solution

    Now it is time to start CMake. Simply copy the destination you used in the repository cloning to the CMake text-box corresponding to the source code ("Where is the source code", E.g. C:\code\ogre\). While it would be nice to use a different folder for the destination ("Where to build the binaries"), that would make some CMake scripts to have difficulties in finding the Ogre files. Therefore, please use the same folder (E.g. "C:\code\ogre\") as the destination.
Click the Configure button, select the default compiler from the dialog and click the Finish button.
CMake: Ogre configuration. OGRE_UNITY_BUILD enabled
CMake: Ogre configuration. OGRE_UNITY_BUILD enabled
     As you are presented with the configuration options, please mark the option OGRE_UNITY_BUILD, but leave all other options on their defaults. Click the Configure button again to take the option into account. All lines should turn from red to white as a result. Finally, click the Generate button to create the projects and solution file. Keep an eye out on the log in the bottom side of the screen to identify any potential errors.

Build the solution

    Finally, you can build the solution. Select the Release configuration, and build (F7) the solution. There will likely be plenty of warnings encountered, but there should be no errors. Once done, you should see the following line in the Output window:
========== Build: 64 succeeded, 0 failed, 0 up-to-date, 2 skipped ==========


    When finished, do the same for the Debug configuration.

    You can test some of the Ogre functionality by going into the bin/release or bin/debug folder and launching the sample browser. (E.g. c:\code\ogre\bin\release\SampleBrowser.exe )

No comments:

Post a Comment