Editing MG/Mac Compiling

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
This page explains how to compile [[MegaGlest]] on a Mac computer.
+
''Pre-requisite'' : you must have [http://developer.apple.com/technologies/xcode.html XCode] , subversion and [http://www.cmake.org/cmake/resources/software.html CMake] on your computer.
 
+
*Retrieve the 3rd libraries from here : and extract the contact of the archive in your library directory ~/Library/Frameworks
 
+
'''''Remark''''': if you already have done this step, you don't need to update them
==Prerequisites==
+
*Get the source from svn (trunk should be ok):
* XCode (from App store)
+
  svn co https://megaglest.svn.sourceforge.net/svnroot/megaglest/trunk megaglest
* Various 3rd party build dependencies, also GCC compiler (all from MacPorts)
+
or the source tarball from version 3.3.7_beta3 or above.
 
+
*Generate the XCode project
 
+
  cd megaglest
=== Dependencies ===
+
  cmake -GXcode
 
+
*Build everything
Dependencies can be installed in two ways:
+
  xcodebuild
 
+
or you can also open the project and build everything in XCode :
* Install them using a 3rd party package manager like [https://www.macports.org/ MacPorts] or [http://www.finkproject.org/ Fink].
+
open MegaGlest.xcodeproj
 
+
*Generate the installer
In this example you'll see how to install the packages with MacPorts which will handle the install of dependencies. (Full dependency lists are available in [[MG/Linux Compiling|Linux Compiling]] section if something is missing and you would like to install them manually.)
+
  cpack -C CPack CPackConfig.cmake
 
+
''Et voila ! ''You should have a megaglest-{version}.dmg file in your current directory. install it and play !!!
  sudo port install git pkgconfig cmake libsdl2 lua jpeg libpng freetype ftgl libogg glew libvorbis cppunit fribidi miniupnpc
 
 
 
  sudo port install curl wxWidgets-3.0
 
If you have few possibilities, then always install latest stable version (or even older) of the package (not beta or devel).
 
 
 
Choosing correct [http://www.xquartz.org/releases/index.html X11 for Mac OS] is a bit tricky especially if you have some version already installed, but if you haven't just do:
 
  sudo port install xorg-server
 
 
 
Don't try compile with VLC unless you really have to (long list of nasty "dynamic" dependencies).
 
 
 
 
 
or (alternative way):
 
----
 
 
 
* Retrieve the build dependencies / 3rd party libraries and extract the contents of the archive in your library directory ~/Library/Frameworks
 
 
 
=== Configuring Environment ===
 
Once wxwidgets is installed you will need to ensure '''wx-config''' is in your path (same situation with gcc).
 
 
 
MacPorts have even nice way to do this:
 
 
 
example for wxwidgets:
 
port select --list wxwidgets
 
sudo port select --set wxwidgets wxWidgets-3.0
 
 
 
example for gcc:
 
port select --list gcc
 
sudo port select --set gcc gcc49
 
 
 
 
 
or (alternative way):
 
----
 
As an alternative you can add the following fragment to ''~/.profile'' or the configuration file appropriate to your shell.
 
  # Add wx-config to path for cmake
 
export PATH=$PATH:/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/bin/
 
 
 
Once that has been added you will need to source the configuration file again to pick up the new settings
 
source ~/.profile
 
 
 
== Preparing to compile ==
 
 
 
Before compilation you will need to use [[MG/Getting_The_Code|''Git to check out'']] the MegaGlest source code ready for building.
 
 
 
 
 
==Compiling==
 
This can be done in two ways: Using an XCode project or GNU Make, but because MG should be compiled by gcc then classic cmake>make is best for this task and we have script for this job.
 
 
 
(''Recommended scripted way'')
 
  cd mk/macosx
 
  ./build-mg.sh
 
 
 
== Running the game ==
 
  ./megaglest
 
 
 
 
 
== Packaging ==
 
When game is compiled you can choose to run it directly from repository (see the previous section) or package it for yourself (and also for others).
 
cd mk/macosx
 
  ./make-release-archives.sh
 
 
 
This script ^ produces 2 type of packages '.zip' and '.dmg'.
 
 
 
Dmg image is more preferred but remember one important and simple thing, this package is (and will be probably always) produced by "unidentified developer" and you will see security warning about this. It is normal and you usually need a root password to be able to launch such package (if you need more details search "in the google" for something like: mac how open from unidentified developer). If this is a serious problem for you then just .zip package is better for you.
 
 
 
Zip archive is a bit less common (old standard) but on this case you will not see any security warnings. From archive you can easily launch game because OS know this type of archive, but installation is just a bit more difficult because you have to 'manually' find the "/Applications" folder and simply drag an "MegaGlest.app" there.
 
 
 
 
 
==  Packaging binary archive ==
 
 
 
For releases but also for development snapshots you should make also binary archive.
 
cd mk/macosx
 
./make-binary-archive.sh
 
 
 
This package is helpful for games based on MG engine (binary for release) and for tests how game works on the Mac.
 
 
 
 
 
----
 
 
 
 
 
For CI you should consider sequence like
 
cd mk/macosx
 
./build-mg.sh && ./make-binary-archive.sh
 
 
 
because this will produce more verbose and helpful output.
 
 
 
==See Also==
 
*[[MegaGlest]]
 
*[[MG/Linux Compiling|Linux Compiling]]
 
*[[MG/Windows Compiling|Windows Compiling]]
 
*[[MG/FreeBSD Compiling|FreeBSD Compiling]]
 
 
 
 
 
[[Category:MG]]
 
[[Category:Development]]
 

Please note that all contributions to MegaGlest are considered to be released under the Creative Commons Attribution Share Alike (see MegaGlest:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)