Difference between revisions of "MG/Mac Compiling"
(reference to running the game removed as its not meant to be in this section) |
(Swapped around packaging and running the game as testing before distribution is a desirable thing. another reason would be packaging is currently broken so should take a backseat) |
||
Line 52: | Line 52: | ||
Build using gnumake | Build using gnumake | ||
gnumake | gnumake | ||
+ | |||
+ | == Running the game == | ||
+ | Before running make sure you move the megaglest binaries to mk/macosx and copy glest-dev.ini in to the same directory as the binaries. When moving the binaries they wil end up in different locations depending on how they were built - gnumake will put them in data/glest_game while Xcode will put them under a Release or Debug directory depending on the build style selected. | ||
+ | mv data/glest_game/megaglest* mk/macosx/ | ||
+ | cp mk/linux/*.ini mk/macosx/ | ||
+ | |||
+ | Run it with | ||
+ | open -F ./mk/macosx/megaglest | ||
== Packaging == | == Packaging == | ||
Line 60: | Line 68: | ||
This command will generate the installer | This command will generate the installer | ||
cpack -C CPackConfig.cmake | cpack -C CPackConfig.cmake | ||
− | |||
You should have a megaglest-#.dmg file in your current directory. You can install this and play it. | You should have a megaglest-#.dmg file in your current directory. You can install this and play it. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==See Also== | ==See Also== |
Revision as of 23:52, 13 February 2015
This page explains how to compile MegaGlest on a Mac computer.
Prerequisites
- XCode
- CMake
- Various 3rd party build dependencies
- GCC (Optional, but may be needed to achieve stable network compatibility for multiplayer games)
Dependencies
Dependencies can be installed in two ways:
- Retrieve the build dependencies / 3rd party libraries and extract the contents of the archive in your library directory ~/Library/Frameworks
or
In this example I show how to install the packages with MacPorts which will handle the install of dependencies, and there is a lot of them. Full dependency lists are available on Linux Compiling or FreeBSD Compiling if you would like to install them manually.
sudo port install git cmake VLC-devel fribidi ftgl glew wxWidgets-2.8 wxgtk-2.8
Configuring Environment
Once wxwidgets is installed you will need to ensure wx-config is in your path. 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
However you choose to compile you will need to use 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
If you change between methods (and if you want to be extra sure your changes are being made between runs) this command will remove previous run/s ouput.
rm -rf Makefile CMakeCache.txt MegaGlest.xcodeproj/
XCode project
Generate the XCode project
cmake -GXcode -DWANT_DEV_OUTPATH=ON
Build everything for Release or Debug (This is case sensitive).
xcodebuild -configuration Release
GNU Make
Generate the Makefile
cmake -G"Unix Makefiles" -DWANT_DEV_OUTPATH=ON
Build using gnumake
gnumake
Running the game
Before running make sure you move the megaglest binaries to mk/macosx and copy glest-dev.ini in to the same directory as the binaries. When moving the binaries they wil end up in different locations depending on how they were built - gnumake will put them in data/glest_game while Xcode will put them under a Release or Debug directory depending on the build style selected.
mv data/glest_game/megaglest* mk/macosx/ cp mk/linux/*.ini mk/macosx/
Run it with
open -F ./mk/macosx/megaglest
Packaging
Once all the compilation is done you can choose to run the game directly (see next section) or package it for others.
CURRENTLY BROKEN! Making this function is a work in progress!
This command will generate the installer
cpack -C CPackConfig.cmake
You should have a megaglest-#.dmg file in your current directory. You can install this and play it.