Changes in Building_Widelands_on_macOS
Editor Comment
Added Issues around icu4c
Revision Differences of Revision 50
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 Clang (recommended) ¶
¶
If you want to use Clang, which comes bundled with Xcode, we only need to install the dependencies. ¶
¶
$ brew install boost git cmake doxygen gettext glew graphviz icu4c jpeg libogg libpng libvorbis ninja python sdl2 sdl2_image sdl2_mixer sdl2_ttf zlib ¶
¶
Installing [ccache](http://ccache.samba.org/) is also strongly suggested. So that incremental builds do not take ages. ¶
¶
$ brew install ccache ¶
¶
### Building with GCC ¶
¶
First we need to install GCC. ¶
¶
$ brew install gcc@7 ¶
¶
Installing ccache is also strongly suggested. ¶
¶
$ brew install ccache ¶
¶
Then install all the dependencies of Widelands: ¶
¶
$ brew install git cmake doxygen gettext glew graphviz icu4c jpeg libogg libpng libvorbis ninja python sdl2 sdl2_image sdl2_mixer sdl2_ttf zlib ¶
$ brew install --cc=gcc-7 boost ¶
¶
## Quirks ¶
¶
For newer version of macOS (Monterey 12.01) Cmake has issues locating the icu4c tools. To fix this you need to ¶
¶
brewprefix="`brew --prefix`" ¶
export CMAKE_PREFIX_PATH="${brewprefix}/opt/icu4c" ¶
¶
¶
## Building Widelands ¶
¶
Now that the compiler and dependencies are installed, we need to check out the source code. An in depth explanation can be [[GitPrimer | found here]]. ¶
¶
You may want to use [build_app.sh](https://github.com/widelands/widelands/blob/master/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 ¶
$ cp widelands/utils/macos/build_app.sh build_wl/ ¶
$ cd build_wl/ ¶
¶
Now we are ready to compile Widelands. ¶
¶
* for Clang ¶
¶
$ ./build_app.sh clang release ../widelands/ ¶
¶
* for GCC ¶
¶
$ ./build_app.sh gcc release ../widelands/ ¶
¶
If you wish to build the Debug version run either of these commands: ¶
¶
* for Clang ¶
¶
$ ./build_app.sh clang debug ../widelands/ ¶
¶
* for GCC ¶
¶
$ ./build_app.sh gcc debug ../widelands/ ¶
¶
## 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. ¶
¶
### Clang to GCC ¶
¶
$ brew uninstall boost && brew install --cc=gcc-7 boost ¶
¶
### GCC to Clang ¶
¶
$ brew uninstall boost && brew install boost ¶
¶
## Known Bugs ¶
¶
* It is currently not possible to compile a debug build with GCC and [ASan](https://clang.llvm.org/docs/AddressSanitizer.html) enabled.