| 1 | = Building Ogre3D 1.81 on MinGW = |
| 2 | Oct 31 2012 |
| 3 | |
| 4 | [[Image(htdocs:images/ogre3d/logo-img-only-halfsize.png, alt="Ogre 3D", align=center)]] |
| 5 | |
| 6 | '''Assumptions:''' You're familiar with Windows & Unix utilities, shell scripting ( bash & cmd ), |
| 7 | have knowledge of command line compilation and are generally fearless, like a lion. |
| 8 | |
| 9 | I put all third party code in ~/external, build them to ~/build/output and install them to |
| 10 | ~/build/install. I eschew system wide installs and prefer to use local installation where possible, |
| 11 | but I don't fight it too much - take the case of python. I'd prefer a simple unzip of python, |
| 12 | but that doesn't work for a bunch of stuff ( like mercurial, !NumPy, pygame ) that looks for |
| 13 | registry entries in Windows for successful installation. |
| 14 | So, I just use the installer from the python.org site. |
| 15 | |
| 16 | == Building Ogre == |
| 17 | Here's my development setup: |
| 18 | |
| 19 | ||Platform||Windows 7 x64|| |
| 20 | ||Toolchain||mingw gcc on msys which you can get [http://www.mingw.org/ here].|| |
| 21 | ||gcc version||4.7.0 - get this with mingw|| |
| 22 | ||python version||2.7.3 for x86 from [http://python.org python.org]|| |
| 23 | ||mercurial version||2.3.2 for x86, I use the '''python package'''. From the [http://mercurial.selenic.com/ official site].|| |
| 24 | ||Ogre version||1.8.1 from the [https://bitbucket.org/sinbad/ogre/src/461061ec4d470547fdcd8a73ded6aee29df20505/?at=v1-8 bitbucket repo]|| |
| 25 | ||Ogre dependencies||default branch from the [https://bitbucket.org/cabalistic/ogredeps bitbucket repo]|| |
| 26 | ||Boost version||1.51|| |
| 27 | ||DirectX SDK version||[http://www.microsoft.com/en-us/download/details.aspx?id=6812 June 2010]|| |
| 28 | |
| 29 | If you run into issues, see [http://stackoverflow.com/questions/4102259/directx-sdk-june-2010-installation-problems-error-code-s1023 this Stack Overflow question]|| |
| 30 | |
| 31 | === Step 1: Boost === |
| 32 | 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. |
| 33 | See the post [http://vijay.axham.com/blog/478/building-boost-binaries-on-mingw Building boost Binaries on MinGW]. |
| 34 | '''Note:''' I build '''everything''' in boost, rather than just the bare minimum required for multi-threading. |
| 35 | |
| 36 | === Step 2: Ogre Dependencies === |
| 37 | 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. |
| 38 | 1. Fetch the source code. |
| 39 | {{{#!bash |
| 40 | export OGRE_SOURCE_DIR=~/external/ogre/v1-8 |
| 41 | mkdir -p $OGRE_SOURCE_DIR |
| 42 | cd $OGRE_SOURCE_DIR |
| 43 | hg clone ssh://hg@bitbucket.org/cabalistic/ogredeps |
| 44 | export OGREDEPS_SOURCE_DIR=$OGRE_SOURCE_DIR/ogredeps |
| 45 | }}} |
| 46 | 1. Set up some environment vars and build the deps: |
| 47 | {{{#!bash |
| 48 | export BUILD_OUTPUT_DIR=~/build/output |
| 49 | export OGRE_OUTPUT_DIR=$BUILD_OUTPUT_DIR/ogre/v1-8 |
| 50 | export OGREDEPS_OUTPUT_DIR=$OGRE_OUTPUT_DIR/ogredeps |
| 51 | export BUILD_INSTALL_DIR=~/build/install |
| 52 | export OGREDEPS_INSTALL_DIR=$BUILD_INSTALL_DIR/ogredeps |
| 53 | mkdir -p $OGREDEPS_OUTPUT_DIR |
| 54 | cd $OGREDEPS_OUTPUT_DIR |
| 55 | }}} |
| 56 | 1. If you're using MinGW under MSYS: |
| 57 | |
| 58 | `cmake $OGREDEPS_SOURCE_DIR -G "MSYS Makefiles"` |
| 59 | |
| 60 | '''or''' if you're using MinGW without MSYS: |
| 61 | |
| 62 | `cmake $OGREDEPS_SOURCE_DIR -G "MinGW Makefiles"` |
| 63 | |
| 64 | {{{#!bash |
| 65 | make |
| 66 | mkdir $BUILD_INSTALL_DIR |
| 67 | make install |
| 68 | mv ogredeps $OGREDEPS_INSTALL_DIR |
| 69 | }}} |
| 70 | |
| 71 | === Step 3: Ogre SDK === |
| 72 | |
| 73 | This is rather similar to building the dependencies. |
| 74 | |
| 75 | 1. Fetch the source code. |
| 76 | {{{#!bash |
| 77 | export OGRE_SOURCE_DIR=~/external/ogre/v1-8 |
| 78 | mkdir -p $OGRE_SOURCE_DIR |
| 79 | cd $OGRE_SOURCE_DIR |
| 80 | hg clone ssh://hg@bitbucket.org/sinbad/ogre |
| 81 | export OGRESDK_SOURCE_DIR=$OGRE_SOURCE_DIR/ogre |
| 82 | }}} |
| 83 | 1. We need to tell Ogre where boost is: |
| 84 | {{{#!bash |
| 85 | export BOOST_ROOT=~/build/install/boost_1_51_0 |
| 86 | export BOOST_INCLUDEDIR=$BOOST_ROOT/include/boost-1_51 |
| 87 | export BOOST_LIBRARYDIR=$BOOST_ROOT/library |
| 88 | }}} |
| 89 | On posix systems, you don't need to set BOOST_INCLUDEDIR or BOOST_LIBRARYDIR, |
| 90 | but if you do set them, BOOST_INCLUDEDIR should be set as follows: |
| 91 | `export BOOST_INCLUDEDIR=$BOOST_ROOT/include` |
| 92 | 1. And where the dependencies are: |
| 93 | `export OGRE_DEPENDENCIES_DIR=~/build/install/ogredeps` |
| 94 | 1. Set up some environment vars for build and install locations: |
| 95 | {{{#!bash |
| 96 | export BUILD_OUTPUT_DIR=~/build/output |
| 97 | export OGRE_OUTPUT_DIR=$BUILD_OUTPUT_DIR/ogre/v1-8 |
| 98 | export OGRESDK_OUTPUT_DIR=$OGRE_OUTPUT_DIR/ogre |
| 99 | export BUILD_INSTALL_DIR=~/build/install |
| 100 | export OGRESDK_INSTALL_DIR=$BUILD_INSTALL_DIR/ogre |
| 101 | mkdir -p $OGRESDK_OUTPUT_DIR |
| 102 | cd $OGRESDK_OUTPUT_DIR |
| 103 | }}} |
| 104 | 1. If you're using MinGW under MSYS: |
| 105 | |
| 106 | `cmake $OGRESDK_SOURCE_DIR -G "MSYS Makefiles"` |
| 107 | |
| 108 | '''or '''if you're using MinGW without MSYS: |
| 109 | |
| 110 | `cmake $OGRESDK_SOURCE_DIR -G "MinGW Makefiles"` |
| 111 | {{{#!bash |
| 112 | make |
| 113 | mkdir $BUILD_INSTALL_DIR |
| 114 | make install |
| 115 | mv sdk $OGRESDK_INSTALL_DIR |
| 116 | }}} |
| 117 | |
| 118 | At this point, you should have your boost stuff in {{{#!bash ~/build/install/boost_1_51_0 }}}, |
| 119 | ogre dependencies in {{{#!bash ~/build/install/ogredeps }}} and the ogre sdk in |
| 120 | {{{#!bash ~/build/install/ogre }}}. |
| 121 | To build applications, simply add the relevant include and library paths to the compiler and |
| 122 | linker options. On posix systems, add the bin directories to LD_LIBRARY_PATH environment variable. |
| 123 | On Windows and MinGW, add the bin directories to the PATH environment variable. |
| 124 | |