Latest Posts

Changes in Building Widelands in Visual Studio

Revision Differences of Revision 3

This article explains how to use Microsoft Visual Studio to build and develop Widelands on Windows ¶

## Prerequisites ¶

- Install [python](https://www.python.org) ¶
- Install [Visual Studio](https://visualstudio.microsoft.com) together with the English language pack (required for vcpkg). ¶
- Download and install [vcpkg](https://github.com/microsoft/vcpkg) ¶
+ Run `bootstrap-vcpkg.bat` first. ¶
+ Then run `vcpkg integrate install` to integrate vcpkg with Visual Studio. ¶
+ Install all dependencies (Note the selected static triplet): ¶
`vcpkg install --triplet=x64-windows-static boost gettext libpng icu glbinding sdl2 sdl2-ttf sdl2-mixer[libvorbis,libflac,mpg123] sdl2-image[libjpeg-turbo,tiff] graphite2 harfbuzz opusfile libwebp curl[http2] nghttp2` ¶
+ If you want to save space, you can safely delete the `buildtrees` folder. ¶
- Download the latest static release zip of [gettext](https://github.com/mlocati/gettext-iconv-windows/releases). ¶
+ Extract the contained `bin` folder to `[vcpkg]/installed/x64-windows-static/bin` ¶
- Re
namove the prefix `lib` from libmpg123.lib` libiconv-> `mpg123.lib` libiand `zstld_static.lib` libchar-> `zsetd.lib` in `[vcpkg]/installed/x64-windows-static/lib` and `[vcpkg]/installed/x64-windows-static/debug/lib` (libmpg123.lib -> mpg123.lib)..

## Project configuration ¶

- Copy `utils/win32/CMakeSettings.json` to the top level directory to use with Visual Studio. ¶
- Launch Visual Studio and select the Widelands root as workspace. ¶
+ CMake should automatically start parsing the project and picking up the vcpkg toolchain file. ¶
+ Then start compilation ¶
- Copy `utils/win32/launch.vs.json` to the `.vs/` directory as start-configuration. ¶

## Troubleshooting ¶

- vcpkg fails to build a package

+
(e.mpg123: `vcpkg. f--tripleet=x64-windows-static install ype)asm-tool:x86-windows`
+ remove the package (or its dependency parent
, e.g. sdl-ttf) from the install list and install it separately afterwards (don't forget the `--triplet=x64-windows-static`). vcpkg sometimes has problems resolving dependency chains.
+ search for the package in the [issue list](https://github.com/microsoft/vcpkg/issues) and see, if a recent update broke it.