Latest Posts

Changes in Building_Widelands_on_macOS

Editor Comment

removed sdl2_net


Revision Differences of Revision 38

# Building Widelands on macOS ¶

You will need to install [Xcode](https://developer.apple.com/xcode/) which is available from the [App Store](https://geo.itunes.apple.com/us/app/xcode/id497799835?mt=12). ¶

In this guide we use [Homebrew](http://brew.sh/). If you haven't already, please install it according to the instructions on their website. ¶

## Preliminaries ¶

The first step is to choose a compiler. Widelands can be build with [GCC](https://gcc.gnu.org/) or [Clang](https://clang.llvm.org/). You have to choose either. ¶

### Building with
GCClang

FirstIf you we aneedt to inustall GCC. ¶

$ br
ew instaCll gcc@7 ¶

Inst
alling, [ccacwhe](http://ccaiche.samba.org/) is alsco mestrongly sbuggestndled. So withat inXcrodem, we ontal builds doy not take ages. ¶

$ brew
d install ccache ¶

Then
o install all the dependencies of Widelands:.

$ brew install python sdl2 libjpeg libpng libogg libvorbis sdl2_mixer sdl2_
net sdl2_image sdl2_ttf glew bzrtools cmake boost doxygen graphviz gettext ninja icu4c zlib ¶
$ brew
link --force gettext ¶

In
stalling --[ccache](http://cc=ache.samba.org/) is also strongcly suggested. So that inc-7remental builds do nost take ages. ¶

$ brew
linkstall --force gcachettext

### Building with
GCClang

If youFirst wae nteed to uinsetall GClang,C. which

comes$ bundlred w insthall Xgccode, you wi@7 ¶

Insta
lling bccache able tso use [ASAN](http://clarong.llvm.ory sugg/docs/AddressSanitizerd.html).

This has proven an$ valuablre toolw in detecsting memoryall issuccaches.

WThe need to install all the dependencies. of ThWis takdes less time, since we don't aneed to compile boost.:

$ brew install python sdl2 libjpeg libpng libogg libvorbis sdl2_mixer sdl2_
net sdl2_image sdl2_ttf glew bzrtools cmake boost doxygen graphviz gettext ninja icu4c zlib ¶
$ brew
link --force gettext ¶

In
stalling --cca=gche isc-7 alsboo suggested for Clang: ¶

$ brew
linstallk --forccache gettext

## Building Widelands ¶

Now that the compiler and dependencies are installed, we need to check out the source code. An in depth explanation can be [[BzrPrimer | found here]]. If you only want to build Widelands without changing much you can try: ¶

$ bzr checkout --lightweight lp:widelands wl_bzr ¶

You may want to use [build_app.sh](http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/utils/macos/build_app.sh). This script is used to make the daily builds for Widelands. It contains all steps that are needed to build Widelands from scratch, make a Widelands.app bundle and package it into a .dmg. ¶

$ mkdir build_wl ¶
$ cd build_wl/ ¶
$ cp wl_bzr/utils/macos/build_app.sh . ¶

Now we are ready to compile Widelands. ¶

* for GCC ¶

$ ./build_app.sh gcc release ../wl_bzr/ ¶

* for Clang ¶

$ ./build_app.sh clang release ../wl_bzr/ ¶

* for GCC ¶

$ ./build_app.sh gcc release ../wl_bzr/ ¶

If you wish to build the Debug version run either of these commands:

* for GCC ¶

$ ./build_app.sh gcc debug ../wl_bzr/


* for Clang ¶

$ ./build_app.sh clang debug ../wl_bzr/ ¶

* for GCC ¶

$ ./build_app.sh gcc debug ../wl_bzr/ ¶

## Changing the compiler ¶

If you should decide to switch your compiler later on, you need to uninstall and install __boost__ again. Otherwise building will fail. ¶

###
GCClang to GClangC

$ brew uninstall boost ¶
$ brew install
--cc=gcc-7 boost ¶

###
GClangC to GCClang

$ brew uninstall boost ¶
$ brew install
--cc=gcc-7 boost