Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Latest commit

 

History

History
197 lines (121 loc) · 6.93 KB

BUILD.md

File metadata and controls

197 lines (121 loc) · 6.93 KB

BUILD.md

Set up the repositories locally

If you think you may be contributing to development, we suggest forking and then cloning your forks of these 2 repositories. If you only want to build and test out the game, and have no plans of submitting patches, you don't need to worry about using the fork option (You can fork later if you change your mind).

Procedure for cloning

  1. Create a new directory to clone your glest-source and glest-data into e.g. call it Glest.

  2. Enter (or 'cd') into the new directory (Glest in the example).

  3. clone glest-source and glest-data using the clone info provided by your fork or the main repos. (Use the "Clone or Download" link, but do select clone not Download Zip.) Make sure the cloned repo directories are in the same directory, adjacent to each other (and not in a subdirectory).

Extra Options for compiling

Most people will never have to change the options when running cmake.

To view all available options, use cmake .. -LH while in the build directory.

Dependencies

Windows

On Windows simply run setup.bat in \mk\windows. setup.bat also updates the game before rebuilding.

Follow the instructions listed in the Windows directory for further information.

Linux

For Linux, there are four options:

  1. (Standard) Using the build script:

    git clone https://github.com/Glest/glest-source.git glest; sudo glest/mk/linux/setup.sh
    

    Then run the following command to start the game:

    glest/mk/linux/build/glest
    

    To update and rebuild the game, simply rerun sudo glest/mk/linux/setup.sh, as it performs a git pull as part of the process.

  2. Build a Flatpak installer: https://github.com/glest/io.glest.Glest

  3. Build a Snapcraft installer. (n.b.: Glest snap develop packages are already built automatically and can be tested by running snap install --devmode --edge glest.)

    1. Download: https://github.com/glest/glest-source/blob/master/snapcraft.yaml

    2. Move snapcraft.yaml to a directory where you're happy to build the project. Next, in the same directory as snapcraft.yaml, run:

      sudo snapcraft
      
    3. You should now have a file with a name like Glest_*.snap. To install it, run:

      snap install --devmode Glest_*.snap
      
    4. Run the game:

      glest
      
  4. Building manually using CMake (see below)

For a more thorough approach:

On Debian, Ubuntu, Fedora, Opensuse and even more Linux distributions, after you clone the source repository, you may use

cd mk/linux
sudo ./build-deps.sh

which will run your package manager and attempt to install the needed packages.

(These may vary based on your operating system or Linux distribution; we will attempt to document dependencies in more detail)

Below is a list of most dependencies you will need.

gcc g++ cmake libsdl2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev
libx11-dev liblua5.2-dev libjpeg-dev libpng-dev libcurl4-gnutls-dev libircclient-dev
libglew-dev libftgl-dev libfribidi-dev libcppunit-dev libminiupnpc-dev libfreetype6-dev
libgnutls28-dev libkrb5-dev libkrb5-dev libnghttp2-dev libopenal-dev libldap2-dev
librtmp-dev libwxgtk3.0-dev libwxgtk3.0-dev (wxWidgets)

Mac OS

You can install the dependencies with brew

brew install sdl2 lua fontconfig freetype ftgl libogg glew libvorbis cppunit glib fribidi miniupnpc wxmac
brew outdated cmake || brew upgrade cmake; brew outdated pkgconfig || brew upgrade pkgconfig
brew install Caskroom/cask/xquartz

BSD

Below is a list of most of dependencies you will need.

A C++11 compiler is mandatory, so base (or package) eg++ and egcc

You can install the dependencies using pkg_add:

pkg_add cmake curl freealut ftgl glew gnutls icu4c jpeg lua libircclient libvorbis miniupnpc nghttp2 openal png sdl2 wxWidgets xerces-c

Arch Linux

You can install the dependencies using pacman:

pacman -S curl ftgl glew glu icu libgl libircclient libvorbis libx11 lua51 miniupnpc openal sdl2 wxgtk3 xerces-c cmake ftjam git mesa wxgtk2

Installing

Now that you have the source code and the dependencies, you can either compile Glest and run it without installing, or you can set options to install it. If you plan to install, then you can skip the sections below and read INSTALL.md

Compiling

Windows

./build.bat

Linux, Mac OS, BSD

From the top of the project source directory:

mkdir build
cd build

(cmake On Linux or Mac OS)

cmake ..

(cmake on BSD. Setting the 2 variables before the cmake command tells cmake to use the correct compiler)

CC=`which egcc` CXX=`which eg++` cmake ..

Now that the build configuration has been set, run make, replacing X with the number of CPU cores in your computer:

make -jX

On Linux, X can be substituted with $(nproc), to automatically get the number of CPU threads:

make -j$(nproc)

The glest binaries will be in the build/ directory. Run ./glest to start the game.

See running for detailed information about running a server or hosting a game.

After you run cmake for the first time, you won't need to specify any options unless you want to change previously-used options. Just use

cmake ..

(You'll need to run make and make install to rebuild.)

If you want to completely erase your previously-used options, remove build/CMakeCache.txt.

If your build doesn't seem to be using the options you gave it, first try removing CMakeCache.txt and rebuilding.