Building Spring on MacOSX: Difference between revisions

From Spring
Jump to navigationJump to search
m Fix formating
Line 33: Line 33:


For MacPorts:
For MacPorts:
<code><pre>
<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></code>
</pre>


To check for installed gcc:
To check for installed gcc:
<code><pre>
<code>
port select --list gcc
port select --list gcc
</pre></code>
</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):


<code><pre>
<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></code>
</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>


<code><pre>
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>
</pre></code>
 
The recursive argument is important for submodules. Update with:
 
<code><pre>
git pull --rebase
</pre></code>




Line 76: Line 71:
=Compiling Source=
=Compiling Source=


<code><pre>
<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></code>
</pre>


Other common Cmake flags are:
Other common Cmake flags are:
<code><pre>
<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></code>
-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><pre>
<code>
-DBoost_Root=/path/to/boost
-DBoost_Root=/path/to/boost
</pre></code>
</code>


Number of simultaneous jobs may be specified by:
Number of simultaneous jobs may be specified by:
<code><pre>
<code>
make spring -j<n>
make spring -j<n>
</pre></code>
</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.


<code><pre>
<pre>
make prdownloader -j<n>
make prdownloader -j<n>
make install-spring -j<n>
make install-spring -j<n>
</pre></code>
</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><pre>
<code>
buildmakejobs 5
buildmakejobs 5
</pre></code>
</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><pre>
<code>
brew install boost --build-from-source --cc=gcc<version>
brew install boost --build-from-source --cc=gcc<version>
</pre></code>
</code>


These flags were recommended by a previous editor:
These flags were recommended by a previous editor:
<code><pre>
<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></code>
</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