Building Dependencies         Most of the time you will grab precompiled dependencies for OGRE, at least on Windows. However, if you want to build them yourself, here's a guide
Print

Most of the time you will grab precompiled dependencies for OGRE, at least on Windows. However, if you want to build them yourself, here's a guide. The dependencies are (for Eihort):

Core Dependencies

 
Optional Plugin Dependencies

  • Cg(external link) (required for Plugin_CgProgramManager)

 
Sample Program Dependencies

 

MS Visual C++

You'll notice some tweaks have to be made to a few of the dependencies to make them build using the /MD or /MDd options (Multithreaded [Debug] DLL runtime library). This is required to ensure the memory heap and library functions used are consistent across the board.

Freetype

  • Grab the latest source from the FreeType website(external link) and extract it somewhere
  • Open freetype.sln from freetype-x.x.x/builds/win32/visualc
  • FreeType is already configured to use /MD or /MDd code generation, so no change
  • Freetype has no dependencies of its own so just hit 'Tools|Batch Build' and pick only the Debug and Release targets. Ignore the Debug Multithreaded and other targets. The default Debug and Release targets produce a static lib which is in fact multithreaded, and crucially uses the Multithreaded [Debug] DLL runtime, ie /MD or /MDd. The others use non-compatible runtimes.
  • Once that's done, copy:
    • the contents of freetype-x.x.x/include into ogrenew/Dependencies/include
    • freetype-x.x.x/objs/freetypexxx.lib to ogrenew/Dependencies/lib/Release
    • freetype-x.x.x/objs/freetypexxx_D.lib to ogrenew/Dependencies/lib/Debug

 

Zlib

  • Grab the latest from the Zlib site(external link)
  • Open zlib-x.x.x/old/visualc6/zlib.dsw and upgrade it
  • Edit the LIB_Debug and LIB_Release project settings and in the Resources|General section, remove the resource name
  • Hit 'Build|Batch Build' and select the zlib LIB_Debug and LIB_Release projects
  • Copy:
    • zlib.h and zconf.h from zlib-x.x.x/ to ogrenew/Dependencies/include
    • zlib.lib from zlib-x.x.x/old/visualc6/Win32_LIB_Release to ogrenew/Dependencies/lib/Release
    • zlibd.lib from zlib-x.x.x/old/visualc6/Win32_LIB_Release to ogrenew/Dependencies/lib/Debug

 

FreeImage

  • FreeImage relies on Zlib, but notice that a copy of Zlib is already shipped with it. Do not confuse this with the copy of Zlib you just installed.
  • Grab the latest from the FreeImage website(external link)
  • Open FreeImage.sln
  • Change the C++ Code Generation option in all projects to 'Multithreaded [Debug] DLL', instead of the default 'Multithreaded [Debug]'.
  • Hit Build|BatchBuild and pick the FreeImageLib Debug and FreeImageLib Release targets - dependencies will be built automatically.
  • Copy from the 'Dist' folder:
    • FreeImage.h to ogrenew/Dependencies/include
    • FreeImage.lib to ogrenew/Dependencies/lib/Release
    • FreeImaged.lib to ogrenew/Dependencies/lib/Debug

 

Cg

  • Grab the latest supported version from the NVidia developer site(external link). Cg 1.4.x and Cg 2.0.x are currently supported. Cg 1.5 has a SM1 bug in it and should not be used.
  • Copy:
    • the contents of the Cg distribution 'include' folder into ogrenew/Dependencies/include/Cg
    • lib/cg.lib into ogrenew/Dependencies/lib/Debug and ogrenew/Dependencies/lib/Release
    • bin/cg.dll into ogrenew/Samples/Common/bin/Debug and ogrenew/Samples/Common/bin/Release

 

Zziplib

  • Grab the latest from the Zziplib site(external link)
  • Open zziplib-x.x.x/msvc7(or8)/zzliplib.sln
  • Change the C++ Code Generation option in Debug and Release targets to 'Multithreaded [Debug] DLL', instead of the default 'Multithreaded [Debug]'.
  • Change the linker input from zdll.lib to zlib.lib in release and zlibd.lib in debug.
  • Make sure zlib is on your path
  • Hit 'Build|Batch Build' and select both projects
  • Copy:
    • _msvc.h, conf.h, types.h and zzip.h from zziplib-x.x.x/zzip to ogrenew/Dependencies/include/zzip
    • zziplib.lib from zziplib-x.x.x/lib to ogrenew/Dependencies/lib/Release
    • zziplibd.lib from zziplib-x.x.x/lib to ogrenew/Dependencies/lib/Debug

 

OIS

  • Grab the latest stable version from OIS site(external link)
  • Open ois/win32/ois_vc8.sln (or ois.sln)
  • Hit 'Build|Batch Build', select OIS_DebugDLL and OIS_ReleaseDLL
  • Copy:
    • All headers from ois/includes to ogrenew/Dependencies/include/OIS
    • OIS.lib from ois/dll to ogrenew/Dependencies/lib/Release
    • OIS_d.lib from ois/dll to ogrenew/Dependencies/lib/Debug
    • OIS.dll from ois/dll to ogrenew/Samples/Common/bin/Release
    • OIS_d.dll from ois/dll to ogrenew/Samples/Common/bin/Debug

 

CEGUI

  • Grab the latest stable from the CEGUI Site(external link), including dependencies for your compiler
  • In makefiles/premake, run the batch file for your compiler version, then open the .sln it creates
  • CEGUI is already configured to use /MD or /MDd code generation
  • Hit 'Build|Batch Build' and pick CEGUIBase, CEGUIExpatParser, and CEGUIFalagardWRBase in both Debug and Release forms (ignore the with symbols version)
  • Copy:
    • The contents of the include folder, with subfolders elements and falagard, to ogrenew/Dependencies/include/CEGUI
    • CEGUIBase.lib from the lib folder to ogrenew/Dependencies/lib/Release
    • CEGUIBase_d.lib from the lib folder to ogrenew/Dependencies/lib/Debug
    • CEGUIBase.dll, CEGUIExpatParser.dll and CEGUIFalagardWRBase.dll from the bin folder to ogrenew/Samples/Common/bin/Release
    • CEGUIBase_d.dll, CEGUIExpatParser_d.dll and CEGUIFalagardWRBase_d.dll from the bin folder to ogrenew/Samples/Common/bin/Debug

 

Boost

  • Grab the latest release from Boost.org(external link), and also the bjam binary archive
  • Copy bjam.exe into the extracted boost folder
  • To build the minimal set of components you need, run this at the command-line:
call <path_to_MSVC>\VC\bin\vcvars32.bat
rem for VC8  (MS Visual Studio 2005)
bjam --build-dir=vc8 --toolset=msvc-8.0 --with-thread --with-date_time --build-type=complete stage
rem for VC9 (MS Visual Studio 2008)
bjam --build-dir=vc9 --toolset=msvc-9.0 --with-thread --with-date_time --build-type=complete stage
rem for VC10 (MS Visual Studio 2010)
bjam --build-dir=vc10 --toolset=msvc-10.0 --with-thread --with-date_time --build-type=complete stage
rem for MinGW
bjam --build-dir=mingw --toolset=gcc --with-thread --with-date_time --build-type=complete stage
rem for gcc
bjam --build-dir=gcc --toolset=gcc --with-thread --with-date_time --build-type=complete stage

 
Reference the include and stage/lib folder in your compiler settings.

OS X

zziplib

 

FreeImage

  • If you're using XCode 3.2, and your version of FreeImage is still configured to use the 10.3.9 XCode SDK (this was the case up to the time of writing, v3.13.1), then you need to alter the Makefile.osx and change INCLUDE_PPC to point at /Developer/SDKs/MacOSX10.4u.sdk instead
  • Run make
  • The libfreetype.a library and FreeType.h are found in the Dist folder

 

FreeType

 

Cg

  • Download Cg 2.2 from nvidia and install
  • Copy the created framework from /Library/Frameworks into Dependencies

 

OIS

  • Grab the HEAD branch from CVS
  • If you're using XCode 3.2, click on the root OIS project, press CMD-I and under "All Configurations" change "C/C++ Compiler Version" to "GCC 4.0". This is required to buid against the 10.4 SDK (for max compatibility)
  • Open ois/Mac/XCode-2.2/OIS.xcodeproj and build Debug and Release
  • Copy the libOIS.a from build/Release and build/Debug

 

Boost

The script below builds universal binaries for Boost and was adapted from here: http://www.mani.de/backstage/?p=324(external link)

#!/usr/bin/perl
# usage:
# - make sure $PREFIX and $VER are correct
# - Extract the boost source archive and cd into the extracted folder (e.g. "boost_1_44_0").
# - Run bootstrap.sh to build bjam
# - Execute this script
 
use strict;
use File::Basename;
 
#my $PREFIX = "/usr/local";
my $PREFIX = "stage";
my $COMPONENTS = "--with-thread --with-date_time";
my $VER = "1_45";
my $GCC = "xgcc42-mt";
 
#compile boost for Intel 32-Bit:
 
system("./bjam $COMPONENTS --prefix=$PREFIX --libdir=$PREFIX/libIntel32 --layout=versioned toolset=darwin-4.2 macosx-version=10.6 
macosx-version-min=10.6 architecture=x86 address-model=32 link=static variant=release,debug install");
 
#compile boost for Intel 64-Bit:
 
system("./bjam $COMPONENTS --prefix=$PREFIX --libdir=$PREFIX/libIntel64 --layout=versioned toolset=darwin-4.2 macosx-version=10.6 
macosx-version-min=10.6 architecture=x86 address-model=64 link=static variant=release,debug install");
 
#collect all boost libraries in libIntel32, and libIntel64:
 
my %libs;
my @globLibs;
my $lib;
 
@globLibs = glob("$PREFIX/libIntel32/libboost_*-$GCC-$VER.a");
foreach $lib (@globLibs) {
%libs = map { $_ => 1 } keys %libs, basename($lib);
}
@globLibs = glob("$PREFIX/libIntel64/libboost_*-$GCC-$VER.a");
foreach $lib (@globLibs) {
%libs = map { $_ => 1 } keys %libs, basename($lib);
}
 
# debug
@globLibs = glob("$PREFIX/libIntel32/libboost_*-$GCC-d-$VER.a");
foreach $lib (@globLibs) {
%libs = map { $_ => 1 } keys %libs, basename($lib);
}
@globLibs = glob("$PREFIX/libIntel64/libboost_*-$GCC-d-$VER.a");
foreach $lib (@globLibs) {
%libs = map { $_ => 1 } keys %libs, basename($lib);
}
 
#iterate over all boost libraries and execute the appropriate lipo command to create universal libraries in lib:
 
# create the output directory if it doesn't already exist
 
mkdir("$PREFIX/lib");
 
my $cmd;
my $archs;
my $archLib;
foreach $lib (keys %libs) {
$archs = "";
$cmd = "lipo -create";
$archLib = "$PREFIX/libIntel32/$lib";
if (-e $archLib) {
$cmd = $cmd." ".$archLib;
$archs = $archs." i386";
}
$archLib = "$PREFIX/libIntel64/$lib";
if (-e $archLib) {
$cmd = $cmd." ".$archLib;
$archs = $archs." x86_64";
}
 
$cmd = $cmd." -output $PREFIX/lib/$lib";
 
print("----------------------------------------------\nCreating universal$archs library $lib ...\n");
`$cmd`;
   system("lipo -info $PREFIX/lib/$lib");
}

 


Alias: BuildingDependencies


Contributors to this page: Gwynbleidd356 points  , masterfalcon435 points  , Jacmoe177744 points  and edoardo781 points  .
Page last modified on Sunday 25 of December, 2011 02:04:06 UTC by Gwynbleidd356 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.