Skip to main content

History: Building MOGRE 1.7 from source

Source of version: 18 (current)

Copy to clipboard
            !Important Note

This page is related is __not__ related to the official Mogre sources!
It's related to a modified bundle of Mogre and some add-ons. This bundle was offered by the Mogre maintainer ''mstoyke''.

%help% __Instructions for compiling the official Mogre sources you find in a text file inside the Mogre repository:__
https://bitbucket.org/mogre/mogre/src/tip/BUILD

For instructions for __other Mogre versions__, look to the overview page ((Building MOGRE from source)).

!Build the modified Mogre 1.7 version

This tutorial describes how to build a __modified__ ((MOGRE|Mogre 1.7.x)) from its sources. The repository was created by the Mogre maintainer ''mstoyke''.
In the repository everything is already wrapped and patched. It also includes all dependecies which are needed to compile Ogre.

It has be designed for and tested with __Visual Studio 2010__ and the __.NET 4.0__ Framework. Other combinations may work but then the steps below must be adjusted accordingly. 

For now this tutorial uses the code from an unofficial code repositories. The benefit of this repository is that it already contains compilable code (that is including all dependencies, auto-generated code, and Visual Studio solution files). For a more "manual" way see ((|#Building_Mogre_from_scratch|Building Mogre from scratch below)).

This tutorial assumes that all files are place in a single folder. For better recognition this folder is called:

{CODE()}C:\MyMogreBuild{CODE}

Of course you can place this folder whereever you like but then you need to adjust the commands below (which isn't difficult).

For questions about building Mogre 1.7 please refer to __[http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=12967|this forum thread]__.

!Prerequisites
For using this tutorial you need the following pieces of software:
* Visual Studio (preferably in version 2010) ~tc~It tested it with the Ultimate Edition. Does the Express Edition work?~/tc~
* [http://en.wikipedia.org/wiki/Mercurial_%28software%29|Mercurial] for accessing the code repository. The command line client will suffice but for newbies to Mercurial the GUI client [http://tortoisehg.bitbucket.org/|TortoiseHG] is recommended.
* The [http://msdn.microsoft.com/en-us/directx/aa937788.aspx|DirectX SDK] (February 2010). Other versions may work but in this case some paths in the "RenderSystem_Direct3D9" project needs to be adjusted manually.


!The repositories
A pre-wrapped version of the Mogre sources can be found here: [http://bitbucket.org/mstoyke/mogre17vs2010|My Mogre repository]
To clone the repository and get the right version use:
{CODE()}hg clone -u MST http://bitbucket.org/mstoyke/mogre17vs2010 C:\MyMogreBuild{CODE}

Then we need to grab the Ogre sources and put them in the right place. A pre-patched version of Ogre can be found here: [http://bitbucket.org/mstoyke/ogre171vs2010|My Ogre repository]
To clone the repository and get the right version use:

{CODE()}hg clone -u MST http://bitbucket.org/mstoyke/ogre171vs2010 C:\MyMogreBuild\Main\OgreSrc\ogre{CODE}


!Building Mogre
First build Ogre without any references to Mogre. To do this, open the solution file "C:\MyMogreBuild\Main\OgreSrc\ogre\lib\OGRE.sln" in Visual Studio 2010. In Visual Studio open the file "CLRConfig.h" in "OgreMain->Header Files" and change the define "LINK_TO_MOGRE 1" to "LINK_TO_MOGRE 0".
~tc~Why do we actually need to do this? Why do we need to set to 1?~/tc~

Depending on where you installed the DirectX SDK, and your operating system's default program files path, you may need to alter some of the preset values for the projects in the ogre solution:  "Linker" -> "additional input" -> "additional dependencies" -> change paths with "C:\Program Files (x86)\" to "C:\Program Files\"   this change may also need to be applied to the DirectX paths in "C/C++" -> "General" -> "Additional Include Directories"

I recommend using batch build now to rebuild all projects in the solution. Make some coffee, this will take some time.

After some time Ogre will be compiled and we can now build the Mogre wrapper.  Open the solution file "C:\MyMogreBuild\Main\Mogre_vs2010.sln" in Visual Studio 2010

By default Mogre will be targeting the .NET Framework v4.0 [http://msdn.microsoft.com/en-us/library/bb772098%28VS.90%29.aspx|How to change the target .NET Framework]  Make sure Visual Studio 2008 is installed if targeting 2.0/3.0/3.5  Project references must also be changed to the respective target .NET Framework version  WARNING: choosing v2.0 will result in several linker errors and wasted time (I haven't tested v3 or v3.5 yet)

Use batch build to rebuild all projects in the solution.

When Mogre finished compiling, go back to Ogre solution file "mogre\Main\OgreSrc\ogre\lib\OGRE.sln" and change back the define "LINK_TO_MOGRE 0" to "LINK_TO_MOGRE 1" in "CLRConfig.h".

This time only use batch build to do a normal build for all projects. Rebuild all would just take too long this time because it's not necessary to rebuild everything completely.


!Where are the compiled binaries?
''Ogre'' binaries can be found here:
* C:\MyMogreBuild\Main\OgreSrc\ogre\lib\bin\debug
* C:\MyMogreBuild\Main\OgreSrc\ogre\lib\bin\release

''Mogre'' binaries can be found here:
* C:\MyMogreBuild\Main\lib\Debug
* C:\MyMogreBuild\Main\lib\Release

__Important:__  You need either to copy all ''Ogre'' .dlls to your application/project folders or put the Ogre folder in your PATH variable. You should also make sure that no other Ogre folder is included in your PATH (as this might lead to loading the wrong dlls). Note also that the ''Mogre'' dll(s) don't need to be placed in the PATH variable.

!MogreFramework classes
The classes from the {MONO()}MogreFramework{MONO} namespace (which are used in the ((Mogre Tutorials|tutorials))) are not part of the official Mogre sources. Instead they're developed by the ((Mogre SDK development|Mogre SDK)) project. The sources then can be found in the folder:

~pp~MogreSDK\smiley80\mogre_basic_tutorials\MogreFramework~/pp~


!Building Mogre manually from scratch
In my repositories everything is already wrapped and patched. I will add some instructions how to patch Ogre and rebuild the wrapper files later. I also included all dependecies needed to compile Ogre. Except for Boost, because I didn't use it.

A more common manual for building Mogre should be added here later. Alternatively you could look to ((Building MOGRE 1.6 from source)).

!ToDo
Things to do on this page:
* Include an description of how to build Mogre from scratch.
* Currently the binaries don't seem to contain any documentation (DocumentXML). This needs to be reenabled somehow.
* Change instructions to match steps for bitbucket/mogre repositories instead of obsolete bitbucket/mstoyke repositories

---
Alias: (alias(Building_MOGRE_1.7_from_source))