GG: Building GG

GG

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

Building GG

# Requirements

GG requires GCC 3.4 or later, or MSVC++ 8.0 SP1 or later. Note that both are available for free download.

GG relies on a few other open-source libraries:

- FreeType 2 - http://www.freetype.org
- Boost >= 1.36 - http://www.boost.org

Image loading library/libraries: Either:

- DevIL 1.6.1 - http://openil.sourceforge.net

Or, at least one of:

- libpng - http://www.libpng.org/pub/png/libpng.html
- libjpeg - http://www.ijg.org
- libtiff - http://www.libtiff.org

Optional libraries for input drivers:

- SDL >= 1.2 - http://www.libsdl.org
- Ogre >= 1.4 - http://ogre3d.org

GG's documentation relies on Doxygen (http://www.stack.nl/~dimitri/doxygen). If you have Doxygen installed in a standard location, the docs will be built automatically. Otherwise, from the GG/doc directory, run Doxygen; the documentation will appear in the GG/doc/GG directory.

# How To Build GG

## All Platforms

You will need to first build the buildable portions of the Boost libraries. See http://boost.org/more/getting_started/index.html for details on building Boost. There are often pre-built binaries available for download for the latest Microsoft C++ compiler. You will also need to decide whether to use DevIL, or GG's built-in image loading code (built-in is the default). The built-in image loader only supports PNG, JPEG, and TIFF formats, using a modified version of Boost.GIL from Boost 1.37. DevIL supports more image formats, but is less portable. If you choose not to use DevIL, you must make at least one of the PNG, JPEG, and TIFF format-specific libraries available instead.

GG uses CMake to generate makefiles, MSVC and XCode projects files, etc. Here is the quick-and-dirty info on using CMake. Download and install CMake if necessary, of course. You run ccmake (Linux) or cmake-gui (Windows or Mac OS X) to set the build options, such as whether to use DevIL, whether to build static or dynamic libs, etc. It's really straightforward, and the end result of using CMake is that you get to use make, Visual Studio's IDE, XCode projects, or whatever CMake-supported build tool you like. It supports just about everything.

## Unix

To build GG, you will need to have CMake installed. The headers and built binaries for the libraries you intend to use should be available in your include and link paths, respectively. just run cmake from the command line, and the defaults will probably work for you just fine. If you need to configure the build in some way, run ccmake next. Once you've picked your options, hit 'c' for configure, then 'g' for generate.

You can let CMake know about any nonstandard paths to these headers and library binaries by running ccmake, then toggling on advanced mode by hitting 't', then filling in what CMake couldn't find. For example, if you want to use your own zlib, you can point CMake at it by setting ZLIB_INCLUDE_DIR and ZLIB_LIBRARY from the advanced mode. Other than cases like this, you shouldn't need to use the advanced mode.

Once this is done, Unix users can simply type

      make
      make install [as root, if necessary]

## Windows

First off, try to avoid building GG altogether by downloading a Windows installer containing pre-built GG binaries and headers from the SourceForge download page.

If you want to build GG, you will need to have CMake installed, even if you want to use the Visual Studio IDE. Run cmake-gui, and select the top-level GG folder for the "Where is the source code" field, and wherever you want the build products to go for the "Where to build the binaries" field (these can be the same place if you like). Next, hit the Configure button. If the config step succeeds (unlikely ;) ), hit "Generate". Be sure to select the generator you want – I think Borland CodeBuilder is the default, if you can believe that. After this, you should be able to launch your favorite IDE, or build using nmake, or whatever, from the "Where to build the binaries" folder.

If the config step fails, which is very likely, select the "Advanced View" in the view drop-list, and fill in the paths to headers and libs that CMake couldn't find. For instance, you'll probably need to fill in FREETYPE_INCLUDE_DIR_freetype2, FREETYPE_INCLUDE_DIR_ft2build, and FREETYPE_LIBRARY with the paths to the freetype2 folder, the path to the ft2build.h header, and the path to the FreeType link library, respectively. The fields you need to fill in will contain {field name}-NOTFOUND. Note that some fields are optional, e.g. those related to DevIL.

## Mac OS X

As of this writing, GG builds fine on Mac OS X. As for the generation of XCode projects and makefiles, I'm not so certain, since I don't have access to a Mac OS X box.