Building Spring on MacOSX: Difference between revisions

From Spring
Jump to navigationJump to search
Rewrite the guide to (hopefully) be cleaner, and (definitely) be more up-to-date
Rewrite the guide to (hopefully) be cleaner, and (definitely) be more up-to-date
Line 2: Line 2:


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.
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.




Line 19: Line 20:


==Command Line Tools==
==Command Line Tools==
Install the [http://developer.apple.com/TOOLS/Xcode/ Xcode developers package] (this requires a free membership to apple's ADC website).
Install the [http://developer.apple.com/TOOLS/Xcode/ Xcode developers package] (this requires a free membership to apple's ADC website).


==Package Manager==
==Package Manager==
Either  [http://brew.sh Homebrew] or [http://www.macports.org/install.php MacPorts] may be used to fetch dependencies. The MacOS Buildbot (run by Turboss) uses Homebrew. The writer uses Macports.
Either  [http://brew.sh Homebrew] or [http://www.macports.org/install.php MacPorts] may be used to fetch dependencies. The MacOS Buildbot (run by Turboss) uses Homebrew. The writer uses Macports.


== Compiler==
== Compiler==
Line 39: Line 43:
port select --list gcc
port select --list gcc
</pre></code>
</pre></code>


==Dependencies==
==Dependencies==
Line 51: Line 56:


Compiling Spring 104.0 (current master) or older will also require Boost. [https://sourceforge.net/projects/boost/ Retreive source] and compile with gcc. '''TODO: Instructions?'''
Compiling Spring 104.0 (current master) or older will also require Boost. [https://sourceforge.net/projects/boost/ Retreive source] and compile with gcc. '''TODO: Instructions?'''


==Obtaining Source==
==Obtaining Source==
Line 65: Line 71:
git pull --rebase
git pull --rebase
</pre></code>
</pre></code>


=Compiling Source=
=Compiling Source=
Line 81: Line 89:
<code><pre>
<code><pre>
-DBoost_Root=/path/to/boost
-DBoost_Root=/path/to/boost
-DCMAKE_PREFIX_PATH=$MACPORTS  
-DCMAKE_PREFIX_PATH=$MACPORTS
</pre></code>
</pre></code>


Line 96: Line 104:
make install-spring -j<n>
make install-spring -j<n>
</pre></code>
</pre></code>




=Additional Notes=
=Additional Notes=
==Using Macports==
==Using Macports==
As hint: set "buildmakejobs" to cpu-core count + 1 in /opt/local/etc/macports/macports.conf. For example:
As hint: set "buildmakejobs" to cpu-core count + 1 in /opt/local/etc/macports/macports.conf. For example:
Line 104: Line 115:
buildmakejobs 5
buildmakejobs 5
</pre></code>
</pre></code>


==Using Homebrew==
==Using Homebrew==
Line 112: Line 124:
</pre></code>
</pre></code>


Build And Install:
These flags were recommended by a previous editor:
 
==brew-specific instructions:==
<code><pre>
<code><pre>
cmake . -DAPPLE=1 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc48/4.8.3/bin/g++-4.8 \
cmake . -DAPPLE=1 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc48/4.8.3/bin/g++-4.8 \

Revision as of 08:50, 28 December 2018

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

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

The recursive argument is important for submodules. Update with:

git pull --rebase


Compiling Source

cmake . -DCMAKE_CXX_COMPILER=$MACPORTS/bin/g++-mp-8 -DCMAKE_C_COMPILER=$MACPORTS/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

If boost is used:

-DBoost_Root=/path/to/boost
-DCMAKE_PREFIX_PATH=$MACPORTS

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