Difference between revisions of "MG/Mac Compiling"

From MegaGlest
Jump to navigation Jump to search
(move some text in to brackets)
(move running the game in to its own section and split gnu make section in to multiple lines)
Line 41: Line 41:
 
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.
  
Alternatively you can choose to run directly without installing the DMG (eg when built with Debug).
+
Alternatively you can choose to run directly without installing , see 'Running the game' below.
  open -F ./mk/macosx/megaglest
 
  
 
=== GNU Make ===
 
=== GNU Make ===
Configure without map editor and produce a binary able to be executed for testing then build with gnumake
+
Generate the Makefile, disabling map editor and turn on binary generation.
   cmake -G"Unix Makefiles" -DBUILD_MEGAGLEST_MAP_EDITOR=OFF -DWANT_DEV_OUTPATH=ON && gnumake
+
   cmake -G"Unix Makefiles" -DBUILD_MEGAGLEST_MAP_EDITOR=OFF -DWANT_DEV_OUTPATH=ON
  
 +
Build using gnumake
 +
gnumake
 +
 +
== Running the game ==
 
Before running make sure you move the megaglest binaries to mk/macosx and move glest-dev.ini in to the same directory as the binaries.
 
Before running make sure you move the megaglest binaries to mk/macosx and move glest-dev.ini in to the same directory as the binaries.
 
   mv data/glest_game/megaglest* mk/macosx/
 
   mv data/glest_game/megaglest* mk/macosx/

Revision as of 03:11, 8 December 2014

This page explains how to compile MegaGlest on a Mac computer.

Prerequisites

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

  • Install them using a 3rd party package manager like MacPorts or Fink.

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

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


XCode project

Remove previous run/s

 rm -rf Makefile CMakeCache.txt MegaGlest.xcodeproj/

Generate the XCode project (At the moment disabling Map Editor is required for the build to succeed.)

cmake -GXcode -DBUILD_MEGAGLEST_MAP_EDITOR=OFF -DWANT_DEV_OUTPATH=ON 

Build everything for Release or Debug (This is case sensitive). Depending on the options chosen above you may need to choose a different option here. EG, doing a debug build without DBUILD_MEGAGLEST_MAP_EDITOR=OFF will fail.

xcodebuild -configuration Release

Generate the installer (This is currently broken!)

cpack -C CPackConfig.cmake

You should have a megaglest-#.dmg file in your current directory. You can install this and play it.

Alternatively you can choose to run directly without installing , see 'Running the game' below.

GNU Make

Generate the Makefile, disabling map editor and turn on binary generation.

 cmake -G"Unix Makefiles" -DBUILD_MEGAGLEST_MAP_EDITOR=OFF -DWANT_DEV_OUTPATH=ON

Build using gnumake

gnumake

Running the game

Before running make sure you move the megaglest binaries to mk/macosx and move glest-dev.ini in to the same directory as the binaries.

 mv data/glest_game/megaglest* mk/macosx/
 mv mk/linux/*.ini mk/macosx/

Run it with

 open -F ./mk/macosx/megaglest

Shared Problems building

wxWidgets

If you encounter problems with wxWidgets executable being undiscoverable you may need to set the path in CMakeLists.txt yourself

# Define path to wxWidgets_CONFIG_EXECUTABLE
SET(wxWidgets_CONFIG_EXECUTABLE "/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/bin/wx-config" CACHE STRING "FULL path to wx-widgets config binary")

See Also