-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL.txt
176 lines (149 loc) · 13.6 KB
/
INSTALL.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
Recommended Dependency versions:
AngelScript: 2.29.0
OpenSceneGraph: 3.2.x
CEGUI: 0.8.x
A few notes (mainly for programmers):
OpenSceneGraph:
OSG has a cmake option "OSG_GL3_AVAILABLE" that's actually not needed for GL3 support. All it does is disable support for the fixed function pipeline. And for me, it stopped OSG from compiling. Leave it off.
Building on Linux:
Install a few essential applications:
cmake
make
codeblocks
Install library dependencies. To make things simpler, try to use your package manager where possible, rather than building everything from source. Remember to install the development packages as well so you have header files. If you can't find a suitable package for your system, download and compile from source.
OpenSceneGraph
CEGUI
Must use version 0.8. If you don't have that version in your repositories, you'll need to compile from source.
Bullet
AngelScript
Don't use your package manager for this one, because we're using some of the addons that come with it.
Download version 2.29.0 from http://angelcode.com/angelscript/downloads.html and extract it to "dependencies/angelscript/", then use the makefile in "angelscript/sdk/angelscript/projects/gnuc/"
yaml-cpp
Boost
Building on OS X:
The way Code::Blocks launches the OS X Terminal launches it in your home directory, not the project directory. Since we have files we need to load, you'll need to modify the launching script (settings->Environment->"general settings"->"Terminal to launch console programs" to read:
osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "cd Documents/SOTE; $SCRIPT"' -e 'end tell'
If the base directory of SOTE is not "/Users/(yourName)/Documents/SOTE", you'll need to change the "cd" to reflect where you put SOTE.
Install a few essential applications:
cmake
Code::Blocks
http://codeblocks.org/downloads
Xcode
Install library dependencies:
Create a folder named "dependencies" in the base SOTE directory and extract all the dependencies to that folder, then use CMake to generate Unix makefiles for each dependency and use make to compile.
OpenSceneGraph
http://openscenegraph.org
As of the time of this writing, OSG doesn't set itself up to compile the way we want it to. We need to edit CMakeLists.txt a bit, around line 816:
Change CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD from "c++98" to "c++11"
Change CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY from "libstdc++" to "libc++"
Change CMAKE_CXX_FLAGS so that it has "-std=c++11" and "-stdlib=libc++".
CEGUI
http://cegui.org.uk/download
Must use version 0.8
Compile the dependencies package first.
CEGUI has a bunch of options for which libraries to use as the backend. For the most part, it doesn't matter what you choose here. You'll need an xml parser, image loaders, and the GL stuff (GLEW, GLFW, and GLM). I chose expat, freetype2, GLEW, GLFW, GLM, PCRE, and Silly.
Once the dependencies are built, copy the cegui-deps-0.8.x-src/dependencies folder to cegui-0.8.4 (actual folder names/paths may differ).
When configuring CEGUI in cmake-gui, make sure to select the same libraries you selected when you build the dependencies.
Apparently OS X has system libraries with the same names as standard open source libraries (e.g. libjpeg) included in CEGUI's dependencies. To avoid confusing the linker (SOTE uses the open source libs through CEGUI, and the OS X libs through OSG, so we need both), you need to tell CEGUI to link to its dependencies staticly so they won't interfere. To do so, enable "CEGUI_BUILD_SHARED_LIBS_WITH_STATIC_DEPENDENCIES" in cmake-gui.
You may get an error about undefined symbols (specifically stuff like "_inflate") when building the SILLY codec. This is due to cmake screwing up and not telling the linker to link with libzlib.a To fix it:
Edit the file "cegui/src/ImageCodecModules/SILLY/CMakeFiles/CEGUISILLYImageCodec.dir/link.txt", adding "../../../../dependencies/lib/static/libzlib.a" to the end of it
You may also need to edit the file "cegui/src/ImageCodecModules/SILLY/CMakeFiles/CEGUISILLYImageCodec.dir/build.make". Around line 109, it should list a bunch of the dependencies that should be linked to. Add a line telling it to link to "dependencies/lib/static/libzlib.a"
Bullet
http://code.google.com/p/bullet/downloads/list
May have to copy the libraries into build/lib/ after compiling.
AngelScript
Download from http://angelcode.com/angelscript/downloads.html and extract it to the "dependencies/" folder. If it comes out as a folder named "sdk", create a new folder named "angelscript" and put "sdk" in that.
Use "angelscript/sdk/angelscript/projects/xcode/angelscript.xcodeproj"
For some reason (maybe I did things wrong), XCode puts the library in a crazy location. Move libangelscript.a to "angelscript/sdk/angelscript/lib/"
On OS X, we're using clang, which AngelScript fails to account for when checking for C++11.
In angelscript/sdk/addons/scripthelper/scripthelper.h, add "|| defined(__clang__)" to the end of the line that says "#if defined(__GNUC__) && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) " (line 53)
Also replace
bool hasAssignmentOperator = std::is_copy_assignable<T>::value && !std::has_trivial_copy_assign<T>::value;
bool hasCopyConstructor = std::is_copy_constructible<T>::value && !std::has_trivial_copy_constructor<T>::value;
with
#if defined(__clang__)
bool hasAssignmentOperator = std::is_copy_assignable<T>::value && !std::is_trivially_copy_assignable<T>::value;
bool hasCopyConstructor = std::is_copy_constructible<T>::value && !std::is_trivially_copy_constructible<T>::value;
#else
bool hasAssignmentOperator = std::is_copy_assignable<T>::value && !std::has_trivial_copy_assign<T>::value;
bool hasCopyConstructor = std::is_copy_constructible<T>::value && !std::has_trivial_copy_constructor<T>::value;
#endif
yaml-cpp
https://code.google.com/p/yaml-cpp/downloads/list
You'll need to install boost for yaml-cpp. You can do so through Fink, or just download Boost manually and put it in the dependencies folder
There's some chance that we may have a HUGE rendering efficiency issue on OS X. The only Mac I have to test on is a fairly crappy old Macbook Pro with 128 MB of VRAM, and it got around 3 FPS or something. I think it's just a crappy video card, but I can't be sure.
Building on Windows:
First, install a few programs you'll need.
CMake
TDM-gcc
http://tdm-gcc.tdragon.net/
Make sure not to install TDM-gcc over an existing MinGW/GCC installation. It messes things up, especially if the previous installation is for 32 bit and you want to compile for 64 bit, or vice versa. If you have a folder named "C:/MinGW" or something like that, either delete it or rename it.
If you need a different version of MinGW for some other project, you can try to compile SOTE with that. It should work, but I can't guarantee it.
Code::Blocks
http://codeblocks.org/
Install library dependencies.
The easy way:
Download the dependencies zip file from http://alicrow.com/SOTE/dependencies-WindowsBinaries.zip and extract to the base directory of SOTE.
Build SOTE itself:
You need to set up Code::Blocks to recognize TDM MinGW.
In "Settings->Compiler...", copy the GCC compiler entry
name the new entry "TDM MinGW 64"
edit the search directory to point to "C:\TDM-GCC-64"
C compiler is "gcc.exe"
C++ compiler is "g++.exe"
Linker for dynamic libs is "g++.exe"
Open the Code::Blocks project file ("ScumOfTheEarth.cbp") and hit "build".
Troubleshooting:
When compiling the framework, you may get errors about libraries not being found. Check the build log to see if it says something like "skipping incompatible <the file you want it to link to>". This may mean you compiled the library as 32 bit instead of 64. Rerun cmake-gui (deleting the cache so it starts over), and make sure it's set to use the TDM-gcc compiler.
Another reason for the linker not finding the libraries is if you don't have the same directory structure that the project expects (e.g. you have a different revision of the dependency and it has a different name for its folder). If this happens, just add the right search directory to the Code::Blocks file.
If there are linker errors you don't understand, or the program fails to start, download Dependency Walker (http://www.dependencywalker.com/), which can help you fix any dependency errors. Note that using it directly on the project's executable doesn't work very well, because the search paths are relative to the SOTE base directory, not the directory where the executable is. My recommendation is try using it on the libraries you're linking with, or any of their example programs.
If debugging isn't working, check to make sure you have your environment set up to use the TDM version of gdb (not the version that came with Code::Blocks)
Installing dependencies from source (it's a pain in the ass, but necessary in some cases)
All libraries should be downloaded and extracted to the "dependencies/" folder (you'll need to create the folder). The procedure to compile them usually comes down to using cmake-gui to configure options and generate project files, then using make to compile. Make sure to tell cmake to create files for mingw, not Visual Studio. Once cmake has generated the files, open up the TDM MinGW command prompt, and navigate to the folder with the newly-generated Makefile. To compile, enter "mingw32-make".
CEGUI
http://prdownloads.sourceforge.net/crayzedsgui/cegui-0.8.4.zip?download
Compile the dependencies package first.
http://prdownloads.sourceforge.net/crayzedsgui/cegui-deps-0.8.x-src.zip?download
CEGUI has a bunch of options for which libraries to use as the backend. For the most part, it doesn't matter what you choose here. You'll need and xml parser, image loaders, and the GL stuff (GLEW, GLFW, and GLM). I chose expat, freetype2, GLEW, GLFW, GLM, PCRE, and Silly.
You may get some errors from .def files for some dependencies. If so, open the offending files, and comment out any lines that say "LIBRARY" (add a semicolon to the beginning of the line). This occured for me in src/libpng-1.4.7/scripts/pngwin.def and src/expat-2.0.1/lib/libexpat.def, but depending on which libraries you selected, you may get it in more/other/no places.
Once the dependencies are built, copy the cegui-deps-0.8.x-src/dependencies folder to cegui-0.8.4 (actual folder names/paths may differ).
When configuring CEGUI in cmake-gui, make sure to select the same libraries you selected when you built the dependencies.
OpenSceneGraph
You'll need the dependencies source package
http://www.osgvisual.org/public_download/3rdParty_x86_x64-src_V9.7z
extract that to the dependencies folder, alongside OpenSceneGraph.
Start by building zlib
Run "mingw32-make -fwin32/Makefile.gcc" from the zlib directory.
Then do libpng
You'll need to check the advanced options in cmake-gui, and point ZLIB_INCLUDE_DIR and ZLIB_LIBRARY to the right places.
If you use other image formats (jpeg, tiff, et cetera), you'll need to build those, too.
Copy the DLLs into the base "dependencies" folder (you'll need "zlib1.dll" and "libpng16.dll"
Tell cmake to build the binaries in the root OSG directory (same place with CMakeLists.txt)
Point ZLIB_INCLUDE_DIR and ZLIB_LIBRARY to the right places, then reconfigure and point PNG_LIBRARY_RELEASE and PNG_PNG_INCLUDE_DIR to the right places.
Bullet
http://code.google.com/p/bullet/downloads/list
Use Bullet 2.x, not Bullet 3 (We'll likely update to Bullet 3 when appropriate).
Tell CMake to build the binaries in the "build" directory
Uncheck the options to build extras and demos.
May need to add "#include <algorithm>" to any files that complain about std::max and std::min not being found
If you get errors about fmin and fmax being redefined, try unchecking the options for building examples in cmake-gui.
As of the time of this writing, there's a bug that causes gcc to seg fault when you compile Bullet with level 2 or 3 optimizations. As a workaround, specify build type "none" in cmake-gui so no optimizations are performed.
AngelScript
http://angelcode.com/angelscript/downloads.html
Use "angelscript/sdk/angelscript/projects/mingw/makefile" to compile.
Boost
You can get it from http://www.boost.org/, or just use the version in the OpenSceneGraph dependencies package.
Go for 1.55.0
You'll need to build the regex library yourself with TDM-GCC.
http://redmine.webtoolkit.eu/projects/1/wiki/Installing_Wt_on_MinGW
open the boost folder in the MinGW Command Prompt and run:
bootstrap.bat
bjam.exe toolset=gcc link=static threading=multi --layout=versioned --prefix=c:/Boost --without-context install
Copy "libboost_regex-mgw48-mt-1_55.a" (or similarly-named file) to "libboost_regex.a"
May need to do the same for any other Boost libraries we use in the future
If making a dependencies package, you'll need to copy the libraries you want from the installation directory to your dependencies folder.
yaml-cpp
https://code.google.com/p/yaml-cpp/downloads/list (note these are .tar.gz files, not .zip files. To extract them, you'll need an archive manager like peazip (http://peazip.sourceforge.net/).)
This requires boost, so get boost first.
After configuring, cmake-gui will tell you it couldn't find boost. Check the box marked "advanced" to see all cmake variables. Change "Boost_INCLUDE_DIR" to point to the folder with Boost.
May need to add "#include <algorithm>" to any files that complain about std::max and std::min not being found