-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildingOgre.txt
190 lines (159 loc) · 8.87 KB
/
BuildingOgre.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
GUIDE TO BUILDING OGRE
========================================================================
Ogre uses CMake as its build system on all supported platforms. This
guide will explain to you how to use CMake to build Ogre from source.
1. What is CMake?
-------------------
CMake is a cross-platform build system - or perhaps more accurately a
build configurator. It is a program which, from a set of CMake scripts,
creates a native build system for your platform that allows you to
build Ogre.
The build process is configurable via CMake. Ogre provides several
options which you can use to customise your build.
2. Getting CMake
------------------
CMake is available from http://www.cmake.org (Resources -> Downloads).
You can get its sources, but there are precompiled binaries for all
platforms. Furthermore, if you are on a Linux system, chances are high
that your distributor offers a package for CMake. You need a CMake
version >= 2.6.
For Ubuntu, type the following in a console to install CMake:
> sudo apt-get install cmake-gui
3. Getting dependencies
-------------------------
Ogre requires the freetype library, but there are other dependencies we
strongly recommend you to use unless you know what you are doing. You
can get source or binary packages for each from their respective websites
listed below. We also offer precompiled dependencies or bundled source
packages for certain platforms, please refer to our download page:
http://www.ogre3d.org/download/source
Linux distributions usually offer packages for each dependency. On Ubuntu
Karmic, the following command will install all of the dependencies:
> sudo apt-get install libfreetype6-dev libboost-date-time-dev \
> libboost-thread-dev nvidia-cg-toolkit libfreeimage-dev \
> zlib1g-dev libzzip-dev libois-dev libcppunit-dev doxygen \
> libxt-dev libxaw7-dev libxxf86vm-dev libxrandr-dev libglu-dev
If you cannot obtain prebuilt binaries of a dependency for your platform,
please refer to the list below and get a source package from the website,
then build it according to its documentation.
Required dependencies:
* freetype: http://www.freetype.org
Recommended dependencies:
* Boost: http://www.boost.org (+)
* Cg: http://developer.nvidia.com/object/cg_toolkit.html
* DirectX SDK: http://msdn.microsoft.com/en-us/directx/
* FreeImage: http://freeimage.sourceforge.net
* zlib: http://www.zlib.net
* zziplib: http://zziplib.sourceforge.net
Optional dependencies:
* CppUnit: http://cppunit.sourceforge.net
* Doxygen: http://doxygen.org
* OIS: http://sourceforge.net/projects/wgois
* POCO: http://pocoproject.org (+)
* TBB: http://www.threadingbuildingblocks.org (+)
(+) Boost is used to build threaded versions of Ogre. Only the
boost-thread and boost-date-time libraries are required. For Visual C++
you can find binary installers at http://www.boostpro.com.
Alternatively, you can use either POCO or TBB instead of Boost to
enable thread support in Ogre.
4. Preparing the build environment
------------------------------------
You should now create a build directory for Ogre somewhere outside
Ogre's sources. This is the directory where CMake will create the
build system for your chosen platform and compiler, and this is also
where the Ogre libraries will be compiled. This way, the Ogre source
dir stays clean, and you can have multiple build directories all
working from the same Ogre source.
If you are on Windows, you should now gather all the compiled
dependencies in a common directory called 'Dependencies'. Inside
this directory you should have the subdirectories bin, lib and include
where you place .dll, .lib and header files of the dependencies,
respectively. (If you are using one of our precompiled binary packages,
then this layout will already have been created for you.)
This 'Dependencies' dir can then be placed either inside the Ogre
source directory or inside your chosen build directory. You can also
put it somewhere else, but you will then need to tell CMake the location
as described below.
5. Running CMake
------------------
Now start the program cmake-gui by either typing the name in a console
or selecting it from the start menu. In the field 'Where is the source
code' enter the path to the Ogre source directory (the directory which
contains this file). In the field 'Where to build the binaries' enter
the path to the build directory you created in step 4.
Hit 'Configure'. A dialog will appear asking you to select a generator.
Choose the appropriate one for your platform and compiler. On Unix, you
most likely want to use 'Unix Makefiles'; for Visual Studio select the
appropriate version and platform (Win32 | Win64); on Apple use Xcode.
Click 'Finish'. CMake will now gather some information about your
build environment and try to locate the dependencies (+). It will then show
a list of build options. You can adjust the settings to your liking; for
example unchecking any of the OGRE_BUILD_XXX options will disable that
particular component from being built. Once you are satisfied, hit
'Configure' again and then click on 'Generate'. CMake will then create
the build system for you.
(+) If you receive errors about dependencies not being found, even though
you have successfully installed or compiled them in step 3, then you may
need to tell CMake where to look. On Unix platforms CMake should usually
be able to pick up all the dependencies if they are installed in standard
locations. If you followed the advice of step 4 and put all dependencies
in a common directory, then you can specify that directory in the
variable OGRE_DEPENDENCIES_DIR. Otherwise, you can specify the directory
for each dependency individually. Click on 'Add entry' to add a new CMake
variable, then select 'PATH' as the type. The name of the variable is
XXX_HOME, where XXX is to be replaced by the dependency package, e. g.
ZLIB_HOME, ZZIP_HOME or FREETYPE_HOME. For the value, specify the directory
where the dependency can be found and click Ok. Once you are done, hit
'Configure' again.
6. Building Ogre
------------------
Go to your chosen build directory. CMake has generated a build system for
you which you will now use to build Ogre. If you are using Visual Studio,
you should find the file OGRE.sln. Open it and compile the target
'BUILD_ALL'. Similarly you will find an Xcode project to build Ogre
on MacOS. If you are using a Makefile generator, then instead open a
console and cd to your build directory, then call the appropriate make
program. E. g. on Linux type
> make
to start the build process.
If you have doxygen installed and CMake picked it up, then there will
be an additional build target called doc which you can optionally build.
This will freshly generate the API documentation for Ogre's classes from
the header files. In Visual Studio, just select and build the target
'DOC', on Linux type:
> make doc
7. Installing Ogre
--------------------
Once the build is complete, you can optionally have the build system
copy the built libraries and headers to a clean location. This location
will strongly resemble the layout of our prebuilt Ogre SDKs. We recommend
you do this step as it will make it easier to use Ogre in your projects.
In Visual Studio, just select and build the target 'INSTALL'. This will
create the folder 'sdk' inside your build directory and copy all the
required libraries there. For Makefile based generators, type:
> make install (or sudo make install, if root privileges are required)
On Linux Ogre will by default be installed to /usr/local. You can change
the install location by changing the variable CMAKE_INSTALL_PREFIX in
CMake.
8. Building Ogre on Mac OS X for iOS OS
--------------------------------------------
To build Ogre for the iOS, you need to check the option
OGRE_BUILD_PLATFORM_APPLE_IOS in cmake-gui before you generate the Xcode
project. Unfortunately, you will now have to do a few manual steps to
make the generated build system work properly.
A Xcode project has now been generated in the build directory, so
to start the Ogre build, open OGRE.xcodeproj and build as usual.
To run samples on your device you will need to have a valid iOS Developer
certificate installed. For each sample, double click on target in the Groups &
Files list. Ensure that a valid identity is selected in the Code Signing Identity
drop menu.
Also, because we can't tell CMake what Xcode project format you want, you will
have to change it yourself. Open the Project Menu, choose Edit Project Settings.
Click on the General tab in the settings window. Change Project Format to
Xcode 3.1-compatible.
And another thing. You will need to manually set the Bundle Identifier property of
the Info.plist file to match the App ID of the chosen code signing identity.
This can be done from the Target Properties panel. It must match the bundle
identifier of a valid developer certificate if you are building for devices.
See the following PDF for information under Generating an App ID:
http://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iphone_development/index.html