Building Spring on MacOSX
Development < Building Spring < Building Spring on MacOSX
This is a guide to the requirements for building the Spring RTS engine on MacOS. If you want only to play a spring game, follow the Spring_on_MacOSX Tutorial.
Building Spring on MacOS
This guide is for x86/Intel based MacOS installs
Even though it will not run, Spring should successfully compile on Mac for both 104.0 and the latest develop version.
NOTE: Only official spring versions 99.0-103.1 will compile and run on MacOS. 104+ will compile, but uses an incompatible OpenGL version. When 105.0 is released, a MacOS - compatible OpenGL version will be used, however at this point in time there are other blocking issues.
Questions about this process should be asked here.
Requirements
Command Line Tools
Install the Xcode developers package (this requires a free membership to apple's ADC website).
Package Manager
Either Homebrew or MacPorts may be used to fetch dependencies. The MacOS Buildbot (run by Turboss) uses Homebrew. The writer uses Macports.
Compiler
Compiler: GCC must be used, and dependencies must be compiled with GCC
For MacPorts:
port install sudo port select --set gcc mp-gcc8 hash -r # Reload the terminal
To check for installed gcc:
port select --list gcc
Dependencies
Necessary dependencies for the develop branch are below (as called by Macports):
port install sudo port install cmake libsdl2 p7zip libdevil libvorbis minizip openal-soft glew freetype binutils libXcursor +gcc8
(This list has not been tested for errors; please message MasterBel if they do not work for you.)
Compiling Spring 104.0 (current master) or older will also require Boost. Retreive source and compile with gcc. TODO: Instructions?
Obtaining Source
git clone --recursive git://github.com/spring/spring.git -b <branch>
The “master” branch is the latest stable release. “develop” branch is the latest development release. (Note: The recursive argument is important for submodules.)
Update with: git pull --rebase
Compiling Source
cmake . -DCMAKE_CXX_COMPILER=/path/to/bin/g++-mp-8 -DCMAKE_C_COMPILER=/path/to/bin/gcc-mp-8 make spring
Other common Cmake flags are:
-DGLEW_INCLUDE_DIR=/path/to/include -DGLEW_LIBRARIES=/path/to/lib/libGLEW.a -DOPENAL_INCLUDE_DIR=/path/to/include/AL -DCMAKE_INSTALL_PREFIX:PATH=/path/to/output/directory -DCMAKE_PREFIX_PATH=/path/
If boost is used:
-DBoost_Root=/path/to/boost
Number of simultaneous jobs may be specified by: make spring -j<n> Where n is number of jobs. It is common for n to be number of cores + 1
Other targets may be made also/instead, e.g.
make prdownloader -j<n> make install-spring -j<n>
Additional Notes
Using Macports
As hint: set "buildmakejobs" to cpu-core count + 1 in /opt/local/etc/macports/macports.conf. For example:
buildmakejobs 5
Using Homebrew
Hombrew can install boost, but it must be recompiled with gcc <version>:
brew install boost --build-from-source --cc=gcc<version>
These flags were recommended by a previous editor:
cmake . -DAPPLE=1 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc48/4.8.3/bin/g++-4.8 \ -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc48/4.8.3/bin/gcc-4.8 \ -DIL_INCLUDE_DIR=/usr/local/include \ -DGLEW_INCLUDE_DIR=/usr/local/include \ -DOPENAL_DIR=/usr/local/include/AL \ -DNO_SOUND=1