Building on Mac
These are instructions for compiling GMAT on Mac OS X as a 32-bit application, using command-line tools. Please note that GMAT is not rigorously tested on this platform. If you find bugs, please submit them to JIRA!
There is a known issue with building wxMac 2.8.12 with Xcode 4.4 due to the lack of the Snow Leopard (OSX 10.6) SDK. One workaround is to install a previous version of Xcode, or to manually copy MacOSX10.6.sdk
from a previous version of Xcode to your system. Previous versions of Xcode can be downloaded from Apple. See this report for additional details.
Get the code
Follow the instructions on the Downloads page to check out a copy of the GMAT source code from SourceForge.
We'll refer to the SourceForge checkout as sf
.
Get the prerequisites
Toolchain
You'll need the standard GNU toolchain, including GCC and make. The easiest way to do this on Mac is to install XCode (4.3 or earlier) from the Mac App Store.
wxWidgets
GMAT needs a version of wxWidgets with OpenGL enabled and Unicode disabled. This usually means building a custom wxMac library:
- Download wxMac 2.8.12 from http://wxwidgets.org.
- Unzip and untar the downloaded file.
- In a Terminal, run the following commands from the new
wxMac-2.8.12
directory (replacing/path/to/wxMac-2.8.12
with the absolute path to yourwxMac-2.8.12
directory):mkdir build-gmat
cd build-gmat
arch_flags="-arch i386"
../configure CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" --prefix=/path/to/wxMac-2.8.12/build-gmat --with-opengl - Run
make
to compile the wxMac libraries:make
- Run
make install
to install the libraries and correctly set install paths. Â (This may not be required in the near future.)make install
SPICE
- Download
ftp://naif.jpl.nasa.gov/pub/naif/toolkit//C/MacIntel_OSX_AppleC_32bit/packages/cspice.tar.Z
. - Uncompress and untar
cspice.tar.Z
to result in acspice
directory.
f2c
- Download
from internal repository
(internal users only) - Unzip and move the
f2c32
directory to your preferred location.
PCRE
- Download PCRE from
http://www.pcre.org
- Unzip and untar the downloaded file
- Run the following commands from the extracted
pcre-#.##
folder:./configure
make
Configure GMAT
- Set the following environment variable:
PLATFORM=mac
- Copy
sf/trunk/build/macosx/BuildEnv.mk
tosf/src
- Edit
BuildEnv.mk
to set the following variables:TOP_DIR
: path to thesf
directoryWX_INSTALLED
: path to the directory containingwx-config
; usually this is thewxMac-2.8.12/build-gmat
directoryWX_LIB_LOC
: path to the directory containing the compiled wx libraries; usually this is thewxMac-2.8.12/build-gmat/lib
directorySPICE_DIR
: path to the directory containing thecspice
directoryF2C_LOC
: path to the directory containing thef2c32
directoryPCRE_LIB_LOC
: path to the PCRE library location; usuallypcre-#.##/.libs
Configure the bundled plugins
The public GMAT repository (on SourceForge) includes several plugins that can be compiled along with the main application.
MatlabInterfacePlugin (not currently available)
The MatlabInterfacePlugin is available on OS X Leopard (10.5) and Snow Leopard (10.6) only.
- Copy
sf/plugins/MatlabInterfacePlugin/build/mac_snowleopard/MatlabInterfaceEnv.mk
(ormac_leopard
) tosf/plugins/MatlabInterfacePlugin/src
. - Edit the new
sf/plugins/MatlabInterfacePlugin/src/MatlabInterfaceEnv.mk
file:WX_INSTALLED
: path to the directory containingwx-config
; usually this is thewxMac-2.8.12
directoryMATLAB_DIR
: path to a MATLAB app (such as/Applications/MATLAB_R2012a.app
)
Plugin configuration: To use the MATLAB interface plugin, you must have the following environment variable configured:
MATLABFORGMAT=/path/to/MATLAB_ver.app
You can do this system-wide by putting the variable and its value into the file ~/.MacOSX/environment.plist
using the OS X Property List Editor. See Apple QA1067 for details. You'll need to log off and log back on before the setting will take effect. (this does not work in later versions of OS X)
CInterfacePlugin (alpha)
Copy sf/plugins/CInterfacePlugin/build/macosx/CInterfaceEnv.mk
to sf/plugins/CInterfacePlugin/src
. No extra configuration of this file is necessary.
EphemPropagatorPlugin (alpha)
- Copy
sf/plugins/EphemPropagatorPlugin/build/macosx/EphemPropEnv.mk
tosf/plugins/EphemPropagatorPlugin/src
. - Edit the new
sf/plugins/EphemPropagatorPlugin/src/EphemPropEnv.mk
file:SPICE_DIR
: path to the directory containingcspice
EstimationPlugin (alpha)
Copy sf/plugins/EstimationPlugin/build/macosx/OdEnv.mk
to sf/plugins/EstimationPlugin/src
. No extra configuration of this file is necessary.
EventLocatorPlugin (alpha)
Copy sf/plugins/EventLocatorPlugin/build/macosx/EventLocatorEnv.mk
to sf/plugins/EventLocatorPlugin/src
. No extra configuration of this file is necessary.
ExtraPropagatorsPlugin (alpha)
- Copy
sf/plugins/ExtraPropagatorsPlugin/build/macosx/ExtraPropagatorEnv.mk
tosf/plugins/ExtraPropagatorsPlugin/src
. - Edit the new
sf/plugins/ExtraPropagatorsPlugin/src/ExtraPropagatorEnv.mk
file:GMAT_CODE_LOCATION
: path tosf/src
GMAT_BIN_LOCATION
: path tosf/application/bin
FminconOptimizerPlugin
The FminconOptimizerPlugin is not available on Mac OS X.
Build GMAT
- Change to the top-level
sf
directory - Run
make
Configure and build the internal plugins
available internally only