Building Spring on MacOSX: Difference between revisions
m Fix formating |
|||
| Line 33: | Line 33: | ||
For MacPorts: | For MacPorts: | ||
<pre> | |||
port install | port install | ||
sudo port select --set gcc mp-gcc8 | sudo port select --set gcc mp-gcc8 | ||
hash -r # Reload the terminal | hash -r # Reload the terminal | ||
</pre | </pre> | ||
To check for installed gcc: | To check for installed gcc: | ||
<code | <code> | ||
port select --list gcc | port select --list gcc | ||
</code> | |||
| Line 49: | Line 49: | ||
Necessary dependencies for the develop branch are below (as called by Macports): | Necessary dependencies for the develop branch are below (as called by Macports): | ||
<pre> | |||
port install sudo port install cmake libsdl2 p7zip libdevil libvorbis minizip openal-soft glew freetype binutils libXcursor +gcc8 | port install sudo port install cmake libsdl2 p7zip libdevil libvorbis minizip openal-soft glew freetype binutils libXcursor +gcc8 | ||
</pre | </pre> | ||
(This list has not been tested for errors; please message MasterBel if they do not work for you.) | (This list has not been tested for errors; please message MasterBel if they do not work for you.) | ||
| Line 60: | Line 60: | ||
==Obtaining Source== | ==Obtaining Source== | ||
<code> | |||
git clone --recursive git://github.com/spring/spring.git -b <branch> | git clone --recursive git://github.com/spring/spring.git -b <branch> | ||
</code> | |||
The “master” branch is the latest stable release. “develop” branch is the latest development release. (Note: The recursive argument is important for submodules.) | |||
The “master” branch is the latest stable release. “develop” branch is the latest development release | Update with: <code>git pull --rebase</code> | ||
The recursive argument is important for submodules. Update with: | |||
<code> | |||
git pull --rebase | |||
| Line 76: | Line 71: | ||
=Compiling Source= | =Compiling Source= | ||
<pre> | |||
cmake . -DCMAKE_CXX_COMPILER=/path/to/bin/g++-mp-8 -DCMAKE_C_COMPILER=/path/to/bin/gcc-mp-8 | cmake . -DCMAKE_CXX_COMPILER=/path/to/bin/g++-mp-8 -DCMAKE_C_COMPILER=/path/to/bin/gcc-mp-8 | ||
make spring | make spring | ||
</pre | </pre> | ||
Other common Cmake flags are: | Other common Cmake flags are: | ||
<pre> | |||
-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/ | -DGLEW_INCLUDE_DIR=/path/to/include | ||
</pre | -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/ | |||
</pre> | |||
If boost is used: | If boost is used: | ||
<code | <code> | ||
-DBoost_Root=/path/to/boost | -DBoost_Root=/path/to/boost | ||
</code> | |||
Number of simultaneous jobs may be specified by: | Number of simultaneous jobs may be specified by: | ||
<code | <code> | ||
make spring -j<n> | make spring -j<n> | ||
</code> | |||
Where n is number of jobs. It is common for n to be number of cores + 1 | 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. | Other targets may be made also/instead, e.g. | ||
<pre> | |||
make prdownloader -j<n> | make prdownloader -j<n> | ||
make install-spring -j<n> | make install-spring -j<n> | ||
</pre | </pre> | ||
=Additional Notes= | =Additional Notes= | ||
| Line 109: | Line 108: | ||
==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: | ||
<code | <code> | ||
buildmakejobs 5 | buildmakejobs 5 | ||
</code> | |||
| Line 117: | Line 116: | ||
Hombrew can install boost, but it must be recompiled with gcc <version>: | Hombrew can install boost, but it must be recompiled with gcc <version>: | ||
<code | <code> | ||
brew install boost --build-from-source --cc=gcc<version> | brew install boost --build-from-source --cc=gcc<version> | ||
</code> | |||
These flags were recommended by a previous editor: | These flags were recommended by a previous editor: | ||
<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 \ | ||
-DCMAKE_C_COMPILER=/usr/local/Cellar/gcc48/4.8.3/bin/gcc-4.8 \ | -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc48/4.8.3/bin/gcc-4.8 \ | ||
| Line 129: | Line 128: | ||
-DOPENAL_DIR=/usr/local/include/AL \ | -DOPENAL_DIR=/usr/local/include/AL \ | ||
-DNO_SOUND=1 | -DNO_SOUND=1 | ||
</pre | </pre> | ||
[[Category:Compiling]] | [[Category:Compiling]] | ||
Revision as of 16:13, 30 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
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