Latest Posts

Changes in Building Widelands

Old Title

BuildingWidelands


Editor Comment

remove "experimental" from cmake


Revision Differences of Revision 57

## Building widelands ¶

This page is about building widelands for various OSes. If you managed to build widelands under you OS and you can't find informations about it here, please add them for the other who will come after you and try it. ¶

[TOC] ¶




### Libraries ¶

Widelands depends currently on the following libraries, make sure they all are installed and in the search path of your compiler. The suggested compiler to build widelands is gcc 3, but it might work with other compilers too. ¶

* [libSDL](http://www.libsdl.org/) >=1.2.11 ¶
* [libSDL_gfx](http://www.ferzkopp.net/joomla/content/view/19/14/) ¶
* [libSDL_image](http://www.libsdl.org/projects/SDL_image) ¶
* [libSDL_net](http://www.libsdl.org/projects/SDL_net) ¶
* [libSDL_mixer](http://www.libsdl.org/projects/SDL_mixer) >= 1.2.6 ¶
* [libSDL_ttf](http://www.libsdl.org/projects/SDL_ttf) >= 2.0.0 ¶
* [gettext](http://www.gnu.org/software/gettext/gettext.html) ¶
* libiconv (on same mirrors as gettext) ¶
* [zlib](http://www.zlib.net/) ¶
* [libpng](http://www.libpng.org/pub/png/libpng.html) ¶
* [Boost](http://www.boost.org/) >= 1.35 ¶
* [Python](http://www.python.org) >= 1.5.2 ¶
* [Scons](http://www.scons.org) >= 1.0.1 ¶
* [libexpat](http://www.libexpat.org/) ¶
* [ggz-base-libs](http://www.ggzcommunity.org) >= 0.99.5 ¶
* [lua](http://www.lua.org) >= 5.1 ¶

### Building with CMake
(Experimental)

Beginning with the WiHackTwentyTen meeting of Widelands developers, there have been ongoing efforts to move from the current SCons building system to CMake. It is still experimental and work-in-progress (so it is not ready for production), but you are very welcome to test, file bugs, comment or ask for features or assistance. More information you'll find at the WidelandsGoingCMake page. ¶



#### Build instructions for Ubuntu (all in terminal) ¶

This is a short HOWTO for downloading & compiling an up to date Widelands version from a terminal. ¶

* Install all needed packages: ¶
* $ sudo apt-get install build-essential python libsdl1.2-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-net1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev gettext libiconv-hook-dev zlib1g-dev libpng12-dev libpngwriter0-dev cmake libstdc++6-4.3-dev libgcc1 exuberant-ctags optipng libboost-dev libexpat1 libexpat1-dev libggzmod-dev bzr lua5.1 liblua5.1-0 liblua5.1-dev ¶
* [Download](../DownloadPage) the latest build or obtain the branch: ¶
* $ bzr get lp:widelands ¶
* Change directory: ¶
* $ cd widelands ¶
* Compile and run: ¶
* $ ./build_and_run.sh ¶
* if you like to run Widelands again later on: ¶
* $ ./widelands ¶

To update your version, again change to the widelands directory in a terminal and: ¶

* Update of sources ¶
* $ bzr pull lp:widelands ¶
* Compile the changes and start widelands ¶
* $ ./build_and_run.sh ¶

*Note: To match version requirements you may have to force the version of libboost-dev to 1.35 manually; Ubuntu Intrepid/Jaunty seems to default to 1.34 for libboost-dev. To force the version, install libboost1.35-dev instead of the generic libboost-dev.* If you use Ubuntu Karmic, then there should be no problems. ¶


#### Generating the locales ¶

If you want to have the most up to date translation for your build, you should also generate a current version of the locales. To do that, just do the following after compiling the game: ¶

* Change directory ¶
* cd build/compile ¶
* Execute the command to build the locales ¶
* make lang ¶


### Building under Windows ¶

To access BZR, I suggest [Tortoise BZR](http://wiki.bazaar.canonical.com/TortoiseBzr). ¶

#### Building under !MinGW ¶

Please visit BuildingWidelandsUnderWindows ¶

#### Building under MSVC ¶

Visual Studio 2008 is supported in trunk r5010 through CMake. Getting all the dependencies may be burdensome on windows, so most of the dependencies are provided in a bundle, which is available in lp:~jarih/+junk/widelands-3rdparty. Only need to add boost libraries. And if you want language support, gettext library from gnuwin32 project. Just compiling and running with english does not need gettext to be installed. ¶

* Install required packages: ¶
* [Visual C++ 2008 Express](http://www.microsoft.com/express/Downloads/#2008-Visual-CPP) (VS2005 likely does not work) ¶
* [CMake](http://www.cmake.org/cmake/resources/software.html) 2.6.4 or later ¶
* [Python](http://www.python.org) ¶
* [Boost](http://www.boost.org) libraries, build with cmake if binaries are not around ¶
* [Bazaar](https://launchpad.net/bzr/+download) ¶
* [Gettext](http://sourceforge.net/projects/gnuwin32/files/gettext/) for localization support ¶
* Get source and 3rd party bundle ¶
* bzr get lp:widelands ¶
* bzr get lp:~jarih/+junk/widelands-3rdparty 3rdparty ¶
* Run cmake-gui, select out of source build ¶
* Configuring propably complains about boost include dir and some packages not found ¶
* set WL_3RDPARTY_DIR to point to 3rd party bundle directory ¶
* set boost_INCLUDE_DIR to your boost include directory (this is in advanced view) ¶
* Include gettext binary dir to visual studio paths or system path( needed for localization) ¶
* Open from Visual Studio main menu Tools/Options/ ¶
* Select Projects and Solutions/VC++ Directories on left tree view ¶
* Select 'Executable files' from combobox in top right corner ¶
* Add 'C:\\Program Files\\!GnuWin32\\bin\\' or whatever is your !GnuWin32 installation dir to bottom of the list ¶
* Alternatively you can just add gnuwin32 bin dir to your system path ¶
* Build with vs2008 ¶
* Running: ¶
* Copy dlls from 3rdparty/bin directory to debug/release directory ¶
* Set working dir to root source dir, or add commandline option to set datadir to root source dir ¶

### Building under Mac OS X ¶

#### General ¶

First you need the developer tools from the apple site and !MacPorts for unix-like tools: ¶

* Download and install tools: ¶
* [Xcode](http://developer.apple.com/technologies/) ¶
* [MacPort](http://www.macports.org/) ¶

* \# sudo port install bzr ¶
* cd ~/Public/ ¶
* bzr get lp:widelands ¶

Alternately: ¶
Now you'll need the following command (in Terminal.app) to install everything needed: ¶

* Install libs: ¶
* \# sudo port install gettext libpng zlib jpeg libvorbis freetype libsdl_image \ ¶
libsdl_mixer libsdl libsdl_net libsdl_sound libsdl_ttf boost lua bzr ¶

*Note: The installation of the above is very timeconsuming!* ¶

* Download SDL_gfx and build ¶
* [www.libsdl.org](http://www.libsdl.org) ¶
* Unpack and build with Xcode ¶

#### Building under Xcode 3.2 ¶
Widelands is build using Xcode 3.x under OSX, you therefore need OSX 10.5 or higher. ¶

* Build Widelands with !MacPort libs: ¶
* Add /opt/local/include /opt/local/include/SDL to the header search path ¶
* Add /opt/local/lib to the library path ¶
* Add SDL_gfx framework path to the project ¶
* Build Widelands with precompiled libs: ¶
* bzr branch lp:~wsk/widelands/OSX-libs ¶
* unzip ~/Public/Archive.zip ¶
* Add ~/Public/Archive/wl_header ~/Public/Archive/SDL to the header search path ¶
* Add ~/Public/Archive/wl_libs to the library path ¶

Help is available on the mailing list. ¶

#### Known bugs ¶

libsdl_image (at least 1.2.10) is broken under Mac OS X. ¶
To build it correctly, you need to add --disable-imageio to the configure flags, otherwise the terrain will be displayed wrongly inside of widelands. ¶
*Note: If using !MacPorts the fix above is obsolet.* ¶