Building on macOS
Also known as OS X or Mac OS X.
Note: These instructions were run on OS X 10.11 and backwards compiled for OS X 10.8 (Aug 2019). Newer versions will likely work but may require some adaptation.
Required Build Dependencies
Homebrew (https://brew.sh/) can be used to gather many of these dependencies, but is not required. All can be found as installers, frameworks, or built manually without Homebrew.
Unless otherwise specified, latest versions of the following dependencies can be used.
Compilers and Environment
- Xcode command-line tools
- CMake 3.9 or later
- fpc 2.6.x OR fpc 3.1.1+ (nothing in between, due a crashing bug)
Libraries can be dynamically linked libraries (
) or Apple frameworks (
). All must be on the system library or framework paths for CMake to find them. Frameworks can be put in your home directory at
- Qt 5.9.x or later (unified installer works)
- SDL2_image (2.0.4 works, 2.0.5 might be buggy)
- libpng 1.6.x
- physfs 3.0.x
- Other dependencies are linked with the SDL2 libraries, but not specifically used in Hedgewars. They may include:
Good places to find required frameworks are found in the development packages for the various SDL2 libraries. They are found in the
subdirectory within the .framework itself. Example:
Another good place for the frameworks/libraries are in the
of a previous version (E.g. Hedgewars 1.0.0 Beta 2)
By default, the following optional features are turned on in the build system, and require the following dependencies:
- Video recording
- ffmpeg 4.2 (later versions are untested)
- Automatic updates
Steps to get the Haskell environment set up for compiling hedgewars-server:
- Install ghc, cabal with instructions at https://www.haskell.org/ghcup/
- Load ghc environment:
- Install cabal-uninstall:
cabal install cabal-uninstall
- Install haskell packages:
cabal install vector bytestring 'network < 2.7' time mtl sandi 'hslogger < 1.3' process utf8-string SHA entropy zlib random regex-tdfa deepseq
is for when you accidentally install newer package versions that don't work with hedgewars-server (e.g. hslogger-18.104.22.168)
- Set macOS version to target for Xcode tools. The earlier, the better:
- (Optional) Load haskell environment:
- Create (
subdirectory in the Hedgewars source code
CMake is used to manage the build process, and is run with different flags depending on which optional dependencies you have elected to install.
Take note of where Qt is installed; it is a required build flag (see below).
Steps to build:
cmake .. -DCMAKE_PREFIX_PATH=/Users/user/Qt/5.9.8/clang_64/ -DCMAKE_BUILD_TYPE=Release
file will be created in the same folder you ran CMake.
To build the DMG, also run:
- To build a debug build, use the flag
instead of the
- To build a minimum-features build, use the additional flags of
, for disabling of hedgewars-server, video recording, and Sparkle autoupdating, respectively.
- The build uses CMake BundleUtilities which automatically deploys all libraries and dependencies into the
, and repairs the
of each library and binary as needed. If there is a missing dependency, the
portion of the build will fail. The fix is usually to find the correct
and put in on library path, then run