First of all you should consider that Glest's developed has stopped in april 2009. There are two projects which continue and have added lots of features, factions and maps since then. ... but based on this where you are you maybe want to compile MegaGlest instead, then just follow this link: MegaGlest Development
Glest's source is divided into 2 parts:
- Game source: Glest game specific code.
- Shared library source: Code that is shared among all Glest tools and other projects Glest has.
We have to compile the shared library as static library and the link the main code against it. Both of them use a single thread so you don't need multi-thread support.
This shared library is also divided into several sub-modules:
- graphics: math and graphics
- graphics_gl: opengl graphics
- sound: sound (including the direct sound player)
- util: conversion functions and other utilities
- platform: platform dependent code (to make a port of Glest to other platforms only this part needs to be changed)
- 1 Requirements
- 2 Compiling with Microsoft Visual Studio 2008
- 3 See also
- A compiler
- Glest's Source
- Header files
The name is most likely [libraryname]-devel especially in package management software.
If not using Microsoft Visual Studio
Compiling with Microsoft Visual Studio 2008
- Download and install Microsoft Visual C++ 2008 Express Edition (MSVC++). MSDN documentation is optional, but helpful. Decide where you want to check out glest and put your dependencies. This location will be referred to as [root] from this point on.
- Download and extract the all-in-one win32-glest-deps.rar into [root]. Checkout the glest sources. This should look something like this:
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.
Create an empty solution named "Glest"
- Create a new solution with a dummy project: Click File > New > Project From Existing Code. Visual C++ project should be selected.
- Set the project file location to [root]\glest\source and the project name to Glest.
- Remove the Glest project from the solution.
- Close & save the solution (File > Close Solution).
- Browse to [root]\glest\source and delete all of the files that were just created except for Glest.sln
Now we have our blank solution that we'll add subprojects to later.
- To create the individual projects, File > New project from existing code and set the Project file location to [root]\glest\sourced\shared_lib and the project name to libglest.
- Set the project type as a Static library (LIB) project.
- Repeat this for [root]\glest\sourced\glest_game with the project name game.
- This can optionally be repeated for g3d_viewer and map_editor.
- Close the open solution (File > Close Solution).
- Using windows explorer, 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.
Put it all together
Open the original "Glest" solution and add each project (File > Add > Existing Project).
Configure project properties
- Go to Project > Project Dependencies and set all projects besides libglest as being dependent on libglest.
- 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. Just delimit them with a semicolon 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
- 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 to yes.
- 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
- 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
Removing unused sources & adding glprocs
Not all subdirectories of this project should be compiled on windows. Additionally, the D3D implementation 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
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 Microsoft Visual C++ 2008 Redistributable Package (x86) 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.