Difference between revisions of "CompilingWesnoth"

From The Battle for Wesnoth Wiki
(prerequisites: quick way to install deps on openSuSE)
m (merge the 2 sentences about MD5 checksums for SCons and CMake)
 
(92 intermediate revisions by 19 users not shown)
Line 1: Line 1:
 +
{{Translations}}
 
{{Compiling Wesnoth}}
 
{{Compiling Wesnoth}}
 
==  Compiling Wesnoth  ==
 
==  Compiling Wesnoth  ==
  
This page covers compilation on a '''Unix-like''' system.
+
This page covers compilation on a '''Unix-like''' system, using the scons and cmake build systems.
 +
 
 
See also:
 
See also:
 
*[[CompilingWesnothOnWindows|Compiling Wesnoth on Windows]]
 
*[[CompilingWesnothOnWindows|Compiling Wesnoth on Windows]]
 
*[[CompilingWesnothOnFreeBSD|Compiling Wesnoth on FreeBSD]]
 
*[[CompilingWesnothOnFreeBSD|Compiling Wesnoth on FreeBSD]]
*[[CompilingWesnothOnMacOSX|Compiling Wesnoth on Mac OS X]]
+
*[[CompilingWesnothOnMacOSX|Compiling Wesnoth on macOS]]
 
*[[CompilingWesnothOnSyllable|Compiling Wesnoth on Syllable]]
 
*[[CompilingWesnothOnSyllable|Compiling Wesnoth on Syllable]]
*[[WesnothOnLinuxPDAs|Wesnoth on Linux PDAs]]
 
 
*[[CompilingWesnothOnSuSE|Compiling Wesnoth on SuSE]] -For install on SuSE 10.0
 
*[[CompilingWesnothOnSuSE|Compiling Wesnoth on SuSE]] -For install on SuSE 10.0
  
 
Forcemstr has cross compiled for Windows using the free
 
Forcemstr has cross compiled for Windows using the free
[http://www.mingw.org/ mingw32] tools, running under Linux.
+
[http://www.mingw.org/ mingw32] tools, running under Linux.<sup>ref ?</sup>
  
Here's documentation of another cross compilation attempt: [[CompilingWesnoth/CrossCompiling]]
+
For detailed instructions and full prerequisites, please consult the current
 +
[https://github.com/wesnoth/wesnoth/blob/master/INSTALL.md INSTALL] file in the source code.
  
For detailed instructions and full prerequisites, please consult the current
+
==  Prerequisites  ==
[http://svn.gna.org/viewcvs/wesnoth/trunk/INSTALL?view=markup INSTALL] file in the source code.
 
  
NOTE: it seems the compilation of trunk has problems with Debian Sarge see [https://gna.org/bugs/index.php?8126]
+
You need a C++ compiler (such as gcc).
  
==  Prerequisites  ==
+
You must have the following libraries installed on your system to build '''Wesnoth 1.14'''. Many Linux distributions split development packages from libraries. If so, you need to have the '''development''' packages to build Wesnoth (the -dev packages include the header files which are required to build packages from source). You will also need the '''runtime''' packages to actually run Wesnoth.
  
You need to have the '''development''' packages of these libraries and a compiler (such as gcc) installed to build Wesnoth.
+
* libsdl >= 2.0.4 (https://www.libsdl.org/)
You will also need the '''runtime''' packages to actually run Wesnoth.
+
* sdl-image >= 2.0.0 (with PNG and JPEG support) (https://www.libsdl.org/projects/SDL_image/)
* >=libsdl-1.2.7 (http://www.libsdl.org/)
+
* sdl-mixer >= 2.0.0 (with Vorbis support) (https://www.libsdl.org/projects/SDL_mixer/)
* >=sdl-image-1.2 (with PNG support) (http://www.libsdl.org/projects/SDL_image)
+
* sdl-ttf >= 2.0.12 (https://www.libsdl.org/projects/SDL_ttf)
* >=sdl-mixer-1.2 (with Vorbis support) (http://www.libsdl.org/projects/SDL_mixer)
+
* libboost >= 1.50.0 (https://www.boost.org/)
* sdl-net (http://www.libsdl.org/projects/SDL_net)
+
** If your distro splits boost, you need: boost_filesystem, boost_iostreams, boost_locale, boost_random, boost_regex, boost_asio, boost_program_options, boost_system, boost_thread.
* >=sdl-ttf-2.0.8 (http://www.libsdl.org/projects/SDL_ttf)
+
** You need gzip and bzip2 support in boost_iostreams
* libintl (and other libraries found in gettext package) (http://www.gnu.org/software/gettext/gettext.html)
+
** You must use the icu backend of boost_locale
* >=libboost-1.35.0 (libboost-iostreams and libboost-regex, http://www.boost.org/)
+
* libcrypto (https://wiki.openssl.org/index.php/Libcrypto_API)
 +
* bzip2 (http://www.bzip.org/)
 
* zlib (in theory already needed for libsdl-image, http://www.zlib.org/)
 
* zlib (in theory already needed for libsdl-image, http://www.zlib.org/)
* >=pangocairo-1.14.8 (http://www.pango.org/)
+
* libvorbisfile (https://xiph.org/vorbis/)
* >=libfontconfig-2.4.1 (http://fontconfig.org/wiki/)
+
* pangocairo >= 1.22.0 (http://www.pango.org/)
* >=lua-5.1.4 (http://www.lua.org/)
+
* cairo >= 1.10.0 (https://www.cairographics.org/)
 +
* libfontconfig >= 2.4.1 (https://www.freedesktop.org/software/fontconfig/front.html)
 +
 
 +
The following libraries are optional.
 +
* libdbus-1 (only required desktop notifications, https://www.freedesktop.org/wiki/Software/dbus)
 +
* libreadline (command history and history expansion in the built-in Lua console)
 +
* fribidi >= 0.10.9 (only required for RTL languages)
  
 +
=== Dev Version Additional Requirements ===
  
The following libraries are optional. If they are available at configure time, desktop notifications will be enabled:
+
For '''Wesnoth 1.15''', the following are additionally required:
* libdbus-1 (http://www.freedesktop.org/wiki/Software/dbus)
 
  
 +
* C++14 capable compiler (GCC 5.0/Clang 3.8 or above)
 +
* libboost >= 1.56.0
 +
* sdl-ttf is no longer required
 +
 +
=== Build Tool ===
 +
 +
To be able to build things, you will need a build tool, either
 +
* scons >=1.0 (https://www.scons.org/)
  
To be able to build things, you also need some dependencies to have a working "build system". On *nix based systems, when not using any IDE (as in "you are building in a terminal") these are the possible options for build systems (yes, several are possible and all should work):
 
* autoconf >=2.60
 
* automake >=1.9
 
Or
 
* cmake >=2.6 (http://www.cmake.org/)
 
 
Or
 
Or
* scons >=0.98.3 (http://www.scons.org/)
+
* cmake >=2.8.5 (https://www.cmake.org/)
 +
 
 +
=== Linux Tips to Easily Gather Dependencies ===
 +
 
 +
On all Linux distributions that are based on Debian (like e.g. Ubuntu, Linux Mint) it may be enough to use these commands if your distribution ships a recent version of Wesnoth. (However dependencies might be outdated for building the Development version or building Stable versions newer than are shipped with your distribution. In those case you will need to install the additional dependencies by hand after running the following commands):
 +
sudo apt build-dep wesnoth-1.12
 +
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libboost-all-dev libvorbis-dev libcairo2-dev libpango1.0-dev libssl-dev libreadline-dev cmake make scons pkgconf
  
 +
For testing purposes wesnoth uses Docker images, you can also have a look at which packages are installed by them [http://raw.githubusercontent.com/wesnoth/wesnoth/1.14/docker/Dockerfile-base-1604-1.14 here]. (Though note that your system may use different version numbers.)
  
On all linux distributions that are based on Debian (like eg Ubuntu) it should be enough to use this command (if your distribution does ship the respective series, otherwise dependencies might be outdated and you have to install the respective dependencies by hand, i.e. if your distribution does only ship wesnoth-1.6 you won't get the build dependencies for 1.8 with the following command):
+
The following command will install the prerequisites for Wesnoth 1.14 in openSuSE. All dependencies are in the standard OSS repository.
sudo apt-get build-dep wesnoth
 
  
To make sure Wesnoth 1.8 builds, you might need these:
+
  sudo zypper install libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel boost-devel libopenssl-devel libbz2-devel zlib-devel libvorbis-devel pango-devel cairo-devel fontconfig-devel dbus-1-devel readline-devel fribidi-devel gettext-runtime cmake make scons pkg-config
  sudo apt-get install liblua-5.1-dev libboost1.40-all-dev
 
  
OR
+
The following command will install the prerequisites for Wesnoth 1.14 in CentOS, RedHat or Fedora. All dependencies are in the standard OSS repository. You may use <code>yum</code> instead of <code>dnf</code>
  
  sudo apt-get install liblua-5.1-0-dev libboost1.40-all-dev
+
  sudo dnf install SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel boost-devel openssl-devel bzip2-devel zlib-devel libvorbis-devel pango-devel cairo-devel fontconfig-devel dbus-devel readline-devel fribidi-devel gettext cmake make scons pkgconf-pkg-config
  
For all Ubuntu from Dapper to Lucid the package name would be ''liblua5.1-0-dev''. (For Intrepid and earlier, look in the Universe repository to see the package.)
+
This command installs the prerequisites for Wesnoth 1.14 in Arch Linux.
{{DevFeature1.9}} Lua is integrated into Wesnoth, so there is no need to download liblua-5.1-dev.
+
sudo pacman -S sdl2 sdl2_image sdl2_mixer sdl2_ttf boost-libs openssl bzip2 zlib libvorbis pango cairo fontconfig dbus readline fribidi boost gettext cmake make scons pkgconf
  
==  Sourcecode ==
+
==  Source Code ==
  
 
You can get it here:
 
You can get it here:
* http://www.wesnoth.org/downloads
+
* [[Download]] — Public releases
* [[WesnothSVN]]
+
* [[WesnothRepository]] — Work-in-progress from the official Git repository
  
 
== Compiling ==
 
== Compiling ==
  
In the development branch, the autotools build is deprecated and unsupported.  Our future choice of build system is not yet final -- [[SCons]] and [[CMake]] are both in contention -- but for the moment all three build systems (autotools, [[SCons]] and [[CMake]]) should in general work though bugs will probably only be fixed for [[SCons]] and [[CMake]].
+
Our future choice of build system is not yet final -- [[SCons]] and [[CMake]] are both in contention -- but for the moment both build systems ([[SCons]] and [[CMake]]) should in general work.
 
 
=== prerequisites ===
 
  
You must have the following libraries installed on your system, which are in many linux distributions can as lib and development package (the -dev packages include the header files which are required to build packages from source):
+
scons is a better choice for beginners, because it requires less configuration and it is more widely used and tested. cmake is used primarily for making certain releases, and is not as well tested.
 
 
* Boost iostreams library version >= 1.35.0
 
* gzip support in Boost Iostreams
 
* Boost smart_ptr library
 
* Simple DirectMedia Layer library version >= 1.2.7 and <= 1.2.13 (see below)
 
* SDL_net library
 
* Pango with cairo backend
 
* fontconfig
 
* Lua development files version 5.1
 
* Boost regex library version >= 1.35.0
 
* SDL_ttf library version >= 2.0.8
 
* SDL_mixer library version >= 1.2.0
 
* SDL_image library version >= 1.2.0
 
* Ogg Vorbis support in SDL
 
* C library X11
 
* dbus-1 (optional, only required for Desktop notifications)
 
* fribidi >= 0.10.9 (optional, only required for RTL languages)
 
* Boost unit_test_framework library
 
 
 
Note that there is a [https://gna.org/bugs/?14770 known bug] with SDL 1.2.14 that can be solved by downgrading to 1.2.13.
 
  
 
If any config checks fail, look in the respective log files (eg in build/config.log when using scons) for details. When using scons, a check can spuriously fail due to caching. If this happens, please use --config=force to force its rerun.
 
If any config checks fail, look in the respective log files (eg in build/config.log when using scons) for details. When using scons, a check can spuriously fail due to caching. If this happens, please use --config=force to force its rerun.
  
The following command will install most prerequisites for openSuSE 12.1, wesnoth 1.10.1. All dependencies are in the standard OSS repository.
+
Because both SCons and CMake checks for out-of-dateness with MD5 checksums of a target's ancestors and its build environment (including compiler and linker flags), the "make clean" and "make uninstall" preliminaries that you need for safety under autotools won't be necessary.
 
 
<pre>
 
zypper install libSDL-devel gettext-runtime zlib-devel cairo-devel fontconfig-devel cmake make libSDL_mixer-devel libSDL_image-devel libSDL_net-devel libSDL_ttf-devel gettext-tools boost-devel libSDL_Pango-devel lua-devel dbus-1-devel
 
</pre>
 
  
 
===Building with SCons===
 
===Building with SCons===
Line 113: Line 103:
 
Equivalents of many configure options will be available, and you can easily build individual targets such as wesnothd.  
 
Equivalents of many configure options will be available, and you can easily build individual targets such as wesnothd.  
  
Because scons checks for out-of-dateness with MD5 checksums of a target's ancestors and its build environment (including compiler and linker flags), the "make clean" and "make uninstall" preliminaries that you need for safety under autotools won't be necessary.
+
 
 +
====Tips====
 +
 
 +
Good options to use with scons are
 +
 
 +
* ctool=clang 
 +
:This uses clang instead of gcc, which is empirically significantly faster (about 2x)
 +
* ccache=true
 +
:Enables ccache.
 +
:If you have ccache available on your system, and you are using git, then this is highly recommended, it can enable you to switch branches and rebuild in minutes.
 +
* build=release vs. build=debug
 +
:Determines whether you build with -O3 optimizations, or -O0 with debugging symbols.
 +
:Keep in mind this preference, like the others mentioned, are "sticky" and will be remembered in the future.
 +
* -j 2, or --jobs 4, etc.
 +
: Build parallelism: This tells scons to run multiple compilation steps in parallel. The number of jobs you tell it to run at once should not be larger than the number of cores that you have.
  
 
===Building with CMake===
 
===Building with CMake===
 
[[CMake]] supports so called "out of tree" builds. That is you compile in a place completely different from the folder where your checkout is in. To do so, simply create a folder to compile in and call cmake with the path to your checkout. Of course you can also just call cmake from the checkout folder with a plain ''cmake .'', but this is boring, isn't it?
 
[[CMake]] supports so called "out of tree" builds. That is you compile in a place completely different from the folder where your checkout is in. To do so, simply create a folder to compile in and call cmake with the path to your checkout. Of course you can also just call cmake from the checkout folder with a plain ''cmake .'', but this is boring, isn't it?
  
To have cmake build wesnoth in a new dir called ''cmake_build_dir'', just use these commands (''PATH/TO/WESNOTH/TOPLEVEL-DIR'' means the base of your svn checkout or the folder where you extracted the tarball to, not src/ in there!):
+
To have cmake build wesnoth in a new dir called ''cmake_build_dir'', just use these commands (''PATH/TO/WESNOTH/TOPLEVEL-DIR'' means the base of your repository checkout or the folder where you extracted the tarball to, not src/ in there!):
 
  $ mkdir cmake_build_dir
 
  $ mkdir cmake_build_dir
 
  $ cd cmake_build_dir
 
  $ cd cmake_build_dir
Line 130: Line 134:
 
This by default builds all the targets you activated. If you want to you can also just build specific targets like ''wesnothd''.
 
This by default builds all the targets you activated. If you want to you can also just build specific targets like ''wesnothd''.
  
Because CMake checks for out-of-dateness, the "make clean" and "make uninstall" preliminaries that you need for safety under autotools won't be necessary.
+
==  Install / Uninstall ==
 
+
Become superuser, so that you have permission to install or uninstall.
===Building with autotools===
 
'''NOTE:''' Support for autotools has been removed in the release 1.9.4 and won't be included any longer. If you want to build a version >=1.9.4 please use either [[SCons]] or [[CMake]].
 
 
 
 
 
 
 
If you have an older installation, first uninstall that by changing into its source directory (i.e. the directory where you unpacked the older package) and by typing:
 
$ make uninstall
 
(It's very likely that you'll need root privileges to uninstall.
 
To do this, check the Installing section.)
 
 
 
Change directory by typing
 
$ cd ..
 
You may want to delete the older unpacked package. You can do that now (or later) by typing:
 
$ rm -r wesnoth-1.x
 
(If you do it later be sure that you don't erase the new unpacked package.)
 
 
 
Untar the new package:
 
$ tar xfjv wesnoth-1.x.tar.bz2
 
then change directory:
 
$ cd wesnoth-1.x
 
 
 
Once you have unpacked the source and uninstalled the old version,
 
$ ./autogen.sh
 
 
 
Then run configure
 
$ ./configure
 
 
 
Finally, compile with
 
$ make
 
 
 
'''Note: If you compile SVN sources and have a problem after a tree update, try ''make clean''. Sometimes, for example when we start to use a new library, it may be needed to rerun ''autogen.sh'' and ''configure'' before ''make'' '''
 
 
 
- You can pass certain options to configure by the way, see the following example. It will install the whole game to ''/opt/games/wesnoth-1.8'' and create a binary for the server, later on called ''wesnothd''.
 
 
 
$ ./configure --prefix=/opt/games/wesnoth-1.8 --enable-server
 
 
 
- You also can specify compiler options using environment variables. For example, if you want to build a version using optimization you would run the following before running ./configure. (Post 1.1.8 note: the default optimization is now -O2)
 
 
 
$ CXXFLAGS="-O2" ; export CXXFLAGS
 
 
 
- If you would like to keep a version separated from other versions and attach a version suffix you could do this. In your users dir you will have the dir .wesnoth-1.8 for your preferences. The program itself will be called wesnoth-1.8 and the datadir will be the in the default path but named wesnoth-1.8. Remember that the path to the preferences dir is always relative. Absolute paths are not supported.
 
 
 
  $ ./configure --with-preferences-dir=.wesnoth-1.8 --program-suffix=-1.8 --with-datadir-name=wesnoth-1.8
 
 
 
Some more configure options are shown when running ./configure --help.
 
 
 
==  Installing ==
 
Become superuser, so that you have permission to install.
 
 
  $ su
 
  $ su
 
   Password: /*doesn't show*/
 
   Password: /*doesn't show*/
Now that you have permission, install it.
+
Now that you have permission, proceed
  
=== Installing using SCons ===
+
=== Using SCons ===
If you are using SCons:
+
If you are using SCons, install with:
 
  # scons install
 
  # scons install
  
=== Installing using CMake ===
+
And uninstall with:
 +
# scons uninstall
 +
 
 +
=== Using CMake ===
 
If you are using [[CMake]], installing basically happens the same way as when using autotools. When authorized as admin (see above), just type this:
 
If you are using [[CMake]], installing basically happens the same way as when using autotools. When authorized as admin (see above), just type this:
 
  # make install
 
  # make install
 
=== Installing using autotools ===
 
If you are using autotools:
 
# make install
 
or for smaller binaries,
 
# make install-strip
 
  
 
== Running the game without installing==
 
== Running the game without installing==
After compiling it is also possible to just run the game without installing it. All you have to do is execute the compiled binary and provide the path to the data location as argument. This looks eg like this:
+
After compiling it is also possible to just run the game without installing it. All you have to do is execute the compiled binary and provide the path to the data location as argument. This looks e.g. like this:
  $ ./wesnoth .
+
  $ ./wesnoth
or, if you compiled outside the place where you have your svn checkout or the extracted tarball (lets assume this content lies in ''../wesnoth-1.8''):
+
or, if you compiled outside the place where you have your repository checkout or the extracted tarball (lets assume this content lies in ''../wesnoth-1.14''):
  $ ./wesnoth ../wesnoth-1.8/
+
  $ ./wesnoth ../wesnoth-1.14/
  
 
==  See also  ==
 
==  See also  ==
  
* [[UsingAutotools]]
 
 
* [[UsingSourceinstall]]
 
* [[UsingSourceinstall]]
  
 
[[Category:Building and Installing]]
 
[[Category:Building and Installing]]

Latest revision as of 14:41, 8 September 2019

[edit]Compiling Wesnoth

Platforms
Tools

Compiling Wesnoth

This page covers compilation on a Unix-like system, using the scons and cmake build systems.

See also:

Forcemstr has cross compiled for Windows using the free mingw32 tools, running under Linux.ref ?

For detailed instructions and full prerequisites, please consult the current INSTALL file in the source code.

Prerequisites

You need a C++ compiler (such as gcc).

You must have the following libraries installed on your system to build Wesnoth 1.14. Many Linux distributions split development packages from libraries. If so, you need to have the development packages to build Wesnoth (the -dev packages include the header files which are required to build packages from source). You will also need the runtime packages to actually run Wesnoth.

The following libraries are optional.

Dev Version Additional Requirements

For Wesnoth 1.15, the following are additionally required:

  • C++14 capable compiler (GCC 5.0/Clang 3.8 or above)
  • libboost >= 1.56.0
  • sdl-ttf is no longer required

Build Tool

To be able to build things, you will need a build tool, either

Or

Linux Tips to Easily Gather Dependencies

On all Linux distributions that are based on Debian (like e.g. Ubuntu, Linux Mint) it may be enough to use these commands if your distribution ships a recent version of Wesnoth. (However dependencies might be outdated for building the Development version or building Stable versions newer than are shipped with your distribution. In those case you will need to install the additional dependencies by hand after running the following commands):

sudo apt build-dep wesnoth-1.12
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libboost-all-dev libvorbis-dev libcairo2-dev libpango1.0-dev libssl-dev libreadline-dev cmake make scons pkgconf

For testing purposes wesnoth uses Docker images, you can also have a look at which packages are installed by them here. (Though note that your system may use different version numbers.)

The following command will install the prerequisites for Wesnoth 1.14 in openSuSE. All dependencies are in the standard OSS repository.

sudo zypper install libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel boost-devel libopenssl-devel libbz2-devel zlib-devel libvorbis-devel pango-devel cairo-devel fontconfig-devel dbus-1-devel readline-devel fribidi-devel gettext-runtime cmake make scons pkg-config

The following command will install the prerequisites for Wesnoth 1.14 in CentOS, RedHat or Fedora. All dependencies are in the standard OSS repository. You may use yum instead of dnf

sudo dnf install SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel boost-devel openssl-devel bzip2-devel zlib-devel libvorbis-devel pango-devel cairo-devel fontconfig-devel dbus-devel readline-devel fribidi-devel gettext cmake make scons pkgconf-pkg-config

This command installs the prerequisites for Wesnoth 1.14 in Arch Linux.

sudo pacman -S sdl2 sdl2_image sdl2_mixer sdl2_ttf boost-libs openssl bzip2 zlib libvorbis pango cairo fontconfig dbus readline fribidi boost gettext cmake make scons pkgconf

Source Code

You can get it here:

Compiling

Our future choice of build system is not yet final -- SCons and CMake are both in contention -- but for the moment both build systems (SCons and CMake) should in general work.

scons is a better choice for beginners, because it requires less configuration and it is more widely used and tested. cmake is used primarily for making certain releases, and is not as well tested.

If any config checks fail, look in the respective log files (eg in build/config.log when using scons) for details. When using scons, a check can spuriously fail due to caching. If this happens, please use --config=force to force its rerun.

Because both SCons and CMake checks for out-of-dateness with MD5 checksums of a target's ancestors and its build environment (including compiler and linker flags), the "make clean" and "make uninstall" preliminaries that you need for safety under autotools won't be necessary.

Building with SCons

To build using SCons, simply type

$ scons 

in the Wesnoth top-level directory. This will perform the equivalent of "configure --enable-editor --enable-tools; make" under autotools, buiding all client-side tools. To find out more about build options, type

$ scons --help

Equivalents of many configure options will be available, and you can easily build individual targets such as wesnothd.


Tips

Good options to use with scons are

  • ctool=clang
This uses clang instead of gcc, which is empirically significantly faster (about 2x)
  • ccache=true
Enables ccache.
If you have ccache available on your system, and you are using git, then this is highly recommended, it can enable you to switch branches and rebuild in minutes.
  • build=release vs. build=debug
Determines whether you build with -O3 optimizations, or -O0 with debugging symbols.
Keep in mind this preference, like the others mentioned, are "sticky" and will be remembered in the future.
  • -j 2, or --jobs 4, etc.
Build parallelism: This tells scons to run multiple compilation steps in parallel. The number of jobs you tell it to run at once should not be larger than the number of cores that you have.

Building with CMake

CMake supports so called "out of tree" builds. That is you compile in a place completely different from the folder where your checkout is in. To do so, simply create a folder to compile in and call cmake with the path to your checkout. Of course you can also just call cmake from the checkout folder with a plain cmake ., but this is boring, isn't it?

To have cmake build wesnoth in a new dir called cmake_build_dir, just use these commands (PATH/TO/WESNOTH/TOPLEVEL-DIR means the base of your repository checkout or the folder where you extracted the tarball to, not src/ in there!):

$ mkdir cmake_build_dir
$ cd cmake_build_dir
$ cmake PATH/TO/WESNOTH/TOPLEVEL-DIR

This will perform the equivalent of "configure --enable-editor --enable-server" under autotools. To get an interface for editing settings, just type

$ ccmake .

in the cmake_build_dir. When done with your changes hit 'c' to configure and 'g' to generate the files and exit. In general you can either add commands to your cmake PATH/TO/WESNOTH/TOPLEVEL-DIR call, or change the parameters later on via ccmake or a cmake gui. Equivalents of many configure options are be available.

In the 2nd step you just have to build the game. This is done as with autotools using

$ make

This by default builds all the targets you activated. If you want to you can also just build specific targets like wesnothd.

Install / Uninstall

Become superuser, so that you have permission to install or uninstall.

$ su
  Password: /*doesn't show*/

Now that you have permission, proceed

Using SCons

If you are using SCons, install with:

# scons install

And uninstall with:

# scons uninstall

Using CMake

If you are using CMake, installing basically happens the same way as when using autotools. When authorized as admin (see above), just type this:

# make install

Running the game without installing

After compiling it is also possible to just run the game without installing it. All you have to do is execute the compiled binary and provide the path to the data location as argument. This looks e.g. like this:

$ ./wesnoth

or, if you compiled outside the place where you have your repository checkout or the extracted tarball (lets assume this content lies in ../wesnoth-1.14):

$ ./wesnoth ../wesnoth-1.14/

See also

This page was last edited on 8 September 2019, at 14:41.