Polls

Best Build 21 Screenshot

Log in to vote!

Latest Posts

Changes in WidelandsGoingCMake

Revision Differences of Revision 12

# Widelands going CMake ¶

Widelands project plans to move from the current build system SCons to CMake. ¶

This page is to track progress and collect important information in the transition process. ¶

## Table of Contents: ¶
[TOC] ¶



## Important Links ¶

* [SCons](http://www.scons.org) ¶
* [CMake](http://www.cmake.org) ¶
* [CMake Tutorial \(PDF\]](http://www-flc.desy.de/ldcoptimization/documents/talks/CMake_Tutorial.pdf) ¶

## Identified Tasks ¶
### Changes to do Build ¶
* *make install* does not exclude SVN directories ¶
* add "PATTERN "\*.svn\*" EXCLUDE" to global CMakeLists.txt file *INSTALL* directive ¶
* SOLVED in SVN ¶
* *make install* includes the *doc* directory which is not necessary for release, but maybe interesting for debug ¶
### Transition tasks ¶
* CMake's "make install" installs in /usr/local - needs root. Just "make" creates the executables but does not lay out a usable installation of widelands. The "make" should create a runnable widelands installation in a subdirectory of the build directory, since we don't need root to run widelands. Then "make install" could just copy the files to /usr/local. Discuss? ¶
* SOLVED. It should be kept the way it is, this is standard. The executable binary works nevertheless. ¶
* CMake currently always creates a Debug build (at least it seems so). It should be possible to build a Release. ¶
* Identify SCons tasks and targets used by widelands, replace using cmake & make ¶
* CMake
12.6 should be used. Do we need CMake 12.8? ¶
###Issues ¶
* Running widelands writes to console: "WARNING: either we can not detect your home directory or you do not have one! Please contact the developers. Instead of your home directory, '.' will be used. Set home directory: ./.widelands". There's something missing. ¶
* Changing language doesn't work. English only. ¶

## Build systems for testing ¶
### System1 ¶
* Intel Core2 Duo, Gentoo Linux 32bit ¶
* gcc 4.3.4, cmake
12.6, libsdl 1.2.13, lua 5.1.4, boost 1.35 ¶

## Important notes ¶
### Things to know about the transition ¶
* Transition uses a SVN branch called "cmake-transition", not "trunk" ¶

### Starting with CMake in the transition (this is for Linux; Windows will differ) ¶
#### 1. Preparation ¶
* $ cd ~ ¶
* $ svn co https://widelands.svn.sourceforge.net/svnroot/widelands/branches/cmake-migration widelands-cmake ¶
* $ mkdir widelands-cmake/build-cmake ¶

#### 2. Using CMake ¶
* $ cd ~/widelands-cmake/build-cmake ¶
* go to the build directory ¶
* $ cmake .. ¶
* let CMake create the Makefiles in the current directory, regarding the CMakeLists.txt files in the parent (widelands-cmake) directory (this is out-of-source)
* $ cmake -DCMAKE_INSTALL_PREFIX=~/widelands-cmake-install .. ¶
* if you want to have a different install directory for "make install" instead of /usr/local ¶

#### 3. Using make ¶
* $ cd ~/widelands-cmake/build-cmake ¶
* go to the build directory ¶
* $ make -j3 && cd .. && ./build-cmake/src/widelands ¶
* this compiles the sources and then runs Wideland in the source directory using the freshly built binaries ¶
* -j3 tells make to run 3 concurrent tasks, which is recommended for DualCore CPUs. Basic rule is -j(number of cores + 1) as recommendation, but beware, gcc takes lots of RAM. ¶
* $ make install -j3 ¶
* this compiles the sources and then installs in either /usr/local (which you need root privileges for), or in the directory mentioned in 2. with -DCMAKE_INSTALL_PREFIX ¶
* -j3 tells make to run 3 concurrent tasks, which is recommended for DualCore CPUs. Basic rule is -j(number of cores + 1) as recommendation, but beware, gcc takes lots of RAM. ¶
* make install includes make, so "make install" is basically the same like "make && make install"