= Building Ogre3D 1.81 on MinGW = Oct 31 2012 [[Image(htdocs:images/ogre3d/logo-img-only-halfsize.png, alt="Ogre 3D", align=center)]] '''Assumptions:''' You're familiar with Windows & Unix utilities, shell scripting ( bash & cmd ), have knowledge of command line compilation and are generally fearless, like a lion. I put all third party code in ~/external, build them to ~/build/output and install them to ~/build/install. I eschew system wide installs and prefer to use local installation where possible, but I don't fight it too much - take the case of python. I'd prefer a simple unzip of python, but that doesn't work for a bunch of stuff ( like mercurial, !NumPy, pygame ) that looks for registry entries in Windows for successful installation. So, I just use the installer from the python.org site. == Building Ogre == Here's my development setup: ||Platform||Windows 7 x64|| ||Toolchain||mingw gcc on msys which you can get [http://www.mingw.org/ here].|| ||gcc version||4.7.0 - get this with mingw|| ||python version||2.7.3 for x86 from [http://python.org python.org]|| ||mercurial version||2.3.2 for x86, I use the '''python package'''. From the [http://mercurial.selenic.com/ official site].|| ||Ogre version||1.8.1 from the [https://bitbucket.org/sinbad/ogre/src/461061ec4d470547fdcd8a73ded6aee29df20505/?at=v1-8 bitbucket repo]|| ||Ogre dependencies||default branch from the [https://bitbucket.org/cabalistic/ogredeps bitbucket repo]|| ||Boost version||1.51|| ||DirectX SDK version||[http://www.microsoft.com/en-us/download/details.aspx?id=6812 June 2010]|| If you run into issues, see [http://stackoverflow.com/questions/4102259/directx-sdk-june-2010-installation-problems-error-code-s1023 this Stack Overflow question]|| === Step 1: Boost === This step is completely optional, as boost is not a required dependency. I'm planning on using multi-threading and a whole host of boost libraries. See the post [Programming/Cpp/Boost/BuildingBoostOnMinGw Building boost on MinGW]. '''Note:''' I build '''everything''' in boost, rather than just the bare minimum required for multi-threading. === Step 2: Ogre Dependencies === 1. Get a bitbucket account if you don't already have one. Add your ssh pub key to the account - there are instructions on the bitbucket site, if you don't already know how to do this. You can use https instead of ssh, but modify the URL passed to hg clone accordingly. 1. Fetch the source code. {{{#!bash export OGRE_SOURCE_DIR=~/external/ogre/v1-8 mkdir -p $OGRE_SOURCE_DIR cd $OGRE_SOURCE_DIR hg clone ssh://hg@bitbucket.org/cabalistic/ogredeps export OGREDEPS_SOURCE_DIR=$OGRE_SOURCE_DIR/ogredeps }}} 1. Set up some environment vars and build the deps: {{{#!bash export BUILD_OUTPUT_DIR=~/build/output export OGRE_OUTPUT_DIR=$BUILD_OUTPUT_DIR/ogre/v1-8 export OGREDEPS_OUTPUT_DIR=$OGRE_OUTPUT_DIR/ogredeps export BUILD_INSTALL_DIR=~/build/install export OGREDEPS_INSTALL_DIR=$BUILD_INSTALL_DIR/ogredeps mkdir -p $OGREDEPS_OUTPUT_DIR cd $OGREDEPS_OUTPUT_DIR }}} 1. If you're using MinGW under MSYS: `cmake $OGREDEPS_SOURCE_DIR -G "MSYS Makefiles"` '''or''' if you're using MinGW without MSYS: `cmake $OGREDEPS_SOURCE_DIR -G "MinGW Makefiles"` {{{#!bash make mkdir $BUILD_INSTALL_DIR make install mv ogredeps $OGREDEPS_INSTALL_DIR }}} === Step 3: Ogre SDK === This is rather similar to building the dependencies. 1. Fetch the source code. {{{#!bash export OGRE_SOURCE_DIR=~/external/ogre/v1-8 mkdir -p $OGRE_SOURCE_DIR cd $OGRE_SOURCE_DIR hg clone ssh://hg@bitbucket.org/sinbad/ogre export OGRESDK_SOURCE_DIR=$OGRE_SOURCE_DIR/ogre }}} 1. We need to tell Ogre where boost is: {{{#!bash export BOOST_ROOT=~/build/install/boost_1_51_0 export BOOST_INCLUDEDIR=$BOOST_ROOT/include/boost-1_51 export BOOST_LIBRARYDIR=$BOOST_ROOT/library }}} On posix systems, you don't need to set BOOST_INCLUDEDIR or BOOST_LIBRARYDIR, but if you do set them, BOOST_INCLUDEDIR should be set as follows: `export BOOST_INCLUDEDIR=$BOOST_ROOT/include` 1. And where the dependencies are: `export OGRE_DEPENDENCIES_DIR=~/build/install/ogredeps` 1. Set up some environment vars for build and install locations: {{{#!bash export BUILD_OUTPUT_DIR=~/build/output export OGRE_OUTPUT_DIR=$BUILD_OUTPUT_DIR/ogre/v1-8 export OGRESDK_OUTPUT_DIR=$OGRE_OUTPUT_DIR/ogre export BUILD_INSTALL_DIR=~/build/install export OGRESDK_INSTALL_DIR=$BUILD_INSTALL_DIR/ogre mkdir -p $OGRESDK_OUTPUT_DIR cd $OGRESDK_OUTPUT_DIR }}} 1. If you're using MinGW under MSYS: `cmake $OGRESDK_SOURCE_DIR -G "MSYS Makefiles"` '''or '''if you're using MinGW without MSYS: `cmake $OGRESDK_SOURCE_DIR -G "MinGW Makefiles"` {{{#!bash make mkdir $BUILD_INSTALL_DIR make install mv sdk $OGRESDK_INSTALL_DIR }}} At this point, you should have your boost stuff in {{{#!bash ~/build/install/boost_1_51_0 }}}, ogre dependencies in {{{#!bash ~/build/install/ogredeps }}} and the ogre sdk in {{{#!bash ~/build/install/ogre }}}. To build applications, simply add the relevant include and library paths to the compiler and linker options. On posix systems, add the bin directories to LD_LIBRARY_PATH environment variable. On Windows and MinGW, add the bin directories to the PATH environment variable.