Last Updated Feb 21, 2008. Edits:
[li]updated [/li][/list]
[url=http://glest.codemonger.org/files/glest-vc2008proj.tgz]project files[/url]
to use relative paths as well[/li]
[li]g3d_viewer and map_editor require wxWindows, not included in these instructions. You can omit these subprojects if you wish.[/li][/list]
I finally got a good compile on my work machine (WindowsXP) using MS Visual C++ 2008 Express Edition. I'll try to keep this guide updated.
1. Prerequisites- Download and install Microshaft Visual C++ 2008 Express Edition. MSDN documentation is optional, but helpful.
- Decide where you want to check out glest and put your dependencies. I put mine under C:\Projects\glest. Henceforth, we shall call this location <root>.
- Download and extract the all-in-one
[url=http://glest.codemonger.org/files/win32-glest-deps.rar]win32-glest-deps.rar[/url]
- Checkout the glest sources. This should look something like this:
svn co https://glest.svn.sourceforge.net/svnroot/glest/trunk glest
2a. Download project filesAre you lazy? Then download my project files and hope they work:
[url=http://glest.codemonger.org/files/glest-vc2008proj.tgz]glest-vc2008proj.tgz[/url]
. You extract this in the <root>/glest/source directory.
If you can't get those to work (maybe you're using a different version of VC++), you can omit this step and create your project files following the rest of this article.
2b. Creating the "Solution" and "Projects"MSVC++ projects are contained in a "solution" (analogous to a "workspace" in other IDEs). A single solution can contain multiple projects. We want to create a single solution in the <root>\glest\source directory that contains projects for each of the shared_lib, glest_game and optionally g3d_viewer and map_editor directories. However, Visual C++ Express Edition is a pain in the ass for stuff like this, probably because they would prefer you to buy their commercial products. Thus, we have to kludge our way through.
3. Create an empty solution named "Glest"Since there isn't a simple way to do this, we have to screw with it.
- Create a new solution with a dummy project: Click File, New, Project From Existing Code...
- Visual C++ project should be selected
- Next
- Project file location: <root>\glest\source
- Project name: Glest
- Finish
- Remove the Glest project from the solution: Right click on Glest project (not the solution) and select remove
- Close & save the solution (File, Close Solution, save when prompted)
- Browse to <root>\glest\source and delete all of the files that were just created except for Glest.sln (cheesy huh?)
Now we have our blank solution that we'll add subprojects to later.
4. Create projects- File, new project from existing code
- Next, Next
- Project file location: <root>\glest\sourced\shared_lib
- Project name: libglest
- Next
- Project type: Static library (LIB) project
- Finish
- File, New, Project From Existing Code...
- Next, Next
- Project file location: <root>\glest\sourced\glest_game
- Project name: game
- Finish
- Optional: repeat for g3d_viewer and map_editor
- Close the open solution (File, Close Solution)
- Use explorer and go to each of the subproject folders and delete the .ncb, .sln and .suo files. These are for the solution tied each of these projects that we don't need.
5. Put it all together- Open the original "Glest" solution: File, Open, Project/Solution... and select <root>\glest\source\Glest.sln
- Add each project (File, Add, Existing Project...)
6. Configure project properties- Click Project, Project Dependencies... and set all projects besides libglest as being dependent on libglest.
- Click OK.
- Select all projects and go to properties page.
- From the Configuration drop down at the top of the window, select All Configurations. We will now be editing the properties for all projects and all configurations, so be careful what you change.
- Set C/C++ -> General -> Additional Include Directories using the below values. If you don't want to screw with their user interface, just delimit them with a semi-colen and copy and paste.
..\..\..\deps\include
..\shared_lib\include\sound\ds8
..\shared_lib\include\graphics
..\shared_lib\include\graphics\gl
..\shared_lib\include\platform\win32
..\shared_lib\include\sound
..\shared_lib\include\util
..\shared_lib\include\xml
[/li]- Set C/C++ -> General -> Warning Level to 2 to avoid excess spam
- If you want to debug using the edit and continue debug database, click Apply, switch to the debug configuration and set C/C++ -> Code Generation -> Enable Function-Level Linking = yes
- Click OK
- Select only the game project and go into it's properties.
- Add all of the directories in the game project to it's own include path (C/C++ -> General -> Additional Include Directories).
- Now select only the exe projects (game, g3d_viewer and map_editor) and go into those project properties.
- Again, select all configurations
- Set Linker -> General -> Additional Library Directories to include:
..\..\..\deps\lib
..\shared_lib\$(ConfigurationName)
[/li]- Set Linker -> Input -> Additional Dependencies to the below value. (Note: This presumes that you want to statically link as much as possible. Otherwise, you can choose to use dyanamic .lib files, but the DLLs will be required at run time.)
dsound.lib dxguid.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib xerces-c_2.lib opengl32.lib glu32.lib wsock32.lib libglest.lib mmc.lib
7. Removing unused sources & adding glprocsNot all subdirectories of this project should be compiled on windows. Additionally, the D3D implementation appears to be/is incomplete. So select the following subdirectories of shared_lib, right click and select Exclude From Project.
- sources/graphics/d3d9
- sources/graphics/gl2
- sources/platform/sdk
- sources/platform/posix
- sources/sound/openal
Right click on the libglest project, select Add/Existing Item... and browse to deps/src/glprocs.c.
8. Troubleshooting- If you compile Glest and somebody else tries to run in on their machine and they get "Application failed to start because side-by-side configuration is incorrect" then they either need to install
[url=http://www.microsoft.com/downloads/details.aspx?familyid=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en]Microshaft Visual C++ 2008 Redistributable Package (x86)[/url]
or you need to link in the C runtime libraries statically. The later basically involves setting C/C++ -> Code Generation -> Runtime Libray to "Multi-threaded (/MT)" and then adding libcmt.lib in Linker -> Input -> Additional Dependencies and will generate a slightly larger file.[/li]