Currently Online

Latest Posts

Changes in WidelandsGoingCMake

Revision Differences of Revision 23

# 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 ¶
* SOLVED in SVN ¶
* Doxygen integration (make doc) ¶
* change Doxyfile (vars), additionally global CMakeLists.txt ¶
* SOLVED in SVN ¶
* Versioning must be modified ¶
* move build/scons-tools/detect_revision.py to utils (this is no scons tool, just plain python) ¶
* SOLVED in SVN ¶
### 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. ¶
* SOLVED in SVN ¶
* Identify SCons tasks and targets used by widelands, replace using cmake & make ¶
* scons ¶
* make ¶
* scons -c ¶
* make clean ¶
* scons doc ¶
* make doc (no dependency to make) ¶
* make install (no scons target?) ¶
* CMake 2.6 should be used. Do we need CMake 2.8? ¶
* Identify bugs/improvements from bug tracker and mailing list ¶
* Working cmake on win32 http://sourceforge.net/tracker/?func=detail&aid=2929259&group_id=40163&atid=427221 ¶
* Identify additional tasks, build tools etc. ¶
* build/scons-tools/Distribute.py ¶
* Script for packaging a complete binary distribution (Release?) ¶
* Scons and Python tool ¶
* proposal: make dist with new CMake script ¶
* build/scons-tools/CodeCheck.py ¶
* Code-Checker ¶
* Scons and Python tool ¶
###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. ¶
* Found the problem. config.h.cmake is missing #define HAS_GETENV which is done by Scons. Can we set this in any case? How does Windows react to that? ¶
* Changing language doesn't work. English only. ¶
* Found the problem. The locales do not get compiled. Doesn't work on the fly because of out-of-source build (cmake) conflicting with the script which creates the locales (expects to be run from base dir and writes there). Either modify script or find a way to run it out-of-source. ¶
* Finding doxygen works. Test with non-working doxygen and about working doxygen without dot to be done. ¶
* Find some Windows/MinGW system to test. ¶

## Build systems for testing ¶
### System1 ¶
* Intel Core2 Duo, Gentoo Linux 32bit ¶
* gcc 4.3.4, cmake 2.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" ¶
* cmake-transition trunk is not being kept up to date, if you want bleeding edge builds, use svn trunk and scons building ¶

### 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 ¶
* this compiles the sources ¶
* -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" ¶

#### 4. Running freshly built widelands ¶
* if you did just "make" ¶
* From your widelands-cmake directory (e.g. "cd ..") ¶
* ./build-cmake/src/widelands ¶
* if you did "make install" and were root ¶
* $ /usr/local/bin/widelands ¶
* if you were not root, used "make install" and specified "-DCMAKE_INSTALL_PREFIX" as above ¶
* cd ~/widelands-cmake-install/share/widelands && ../../bin/widelands ¶