Before starting, make sure that you have cloned GMAT from the GSFC-internal repository. For public developers, you can obtain the source code from SourceForge ( The Git command is: "git clone ssh://YOURUSERNAME@git.code.sf.net/p/gmat/git gmat-git")
These instructions refer to
<GMAT> as the top-level GMAT repository folder.
Figure 1. The
<GMAT> repository layout
The GMAT build process can be broken down into four main steps:
The first two steps are generally "one-time" processes that are performed immediately after downloading the GMAT repository. They result in a build system (e.g. Visual Studio solution or makefiles) that will intelligently rebuild GMAT components as needed when source or configuration files are changed.
Table 1 describes all software dependencies for GMAT. The
<GMAT>/depends folder contains scripts to automatically download and configure the core GMAT dependencies.
Table 1. GMAT Dependencies
|Name||Version||Used in GMAT||Download|
|CSPICE||N0065||Core Dependency||Configure Script|
|Xerces||3.1.4||Core Dependency||Configure Script|
|Python||3.4, 3.5||PythonInterface Plugin||Mac, Windows|
Linux (Package Manager)
<GMAT>/depends folder layout after dependency configuration
configure.bat(Windows) script to set up core GMAT dependencies.
<GMAT>/dependsfolder structure should look like Figure 2.
→ Download optional GMAT dependencies.
Requirements (in addition to Step 1 requirements):
Launch Matlab, run the command:
Tip: Select the "Grouped" option in the CMake GUI (Figure 3) to sort CMake variables and make them easier to find.
Tip: Select the "Advanced" option in the CMake GUI (Figure 3) to display variables, such as PYTHON_LIBRARY, that are normally hidden.
Tip: All CMake commands can also be performed on the command-line instead of using the GUI. See below for instructions.
Figure 3. Components of the CMake GUI
<GMAT>cloned repository on your computer
<GMAT>/build/<OS>-cmakebuildfor this value.
Figure 4. Choosing a generator in CMake
4b) will be populated:
Figure 5. Output of CMake Configure
Use the Configure results output box (Figure 3 section
4a) to change variables in the CMake variable list (Figure 3 section
4b) as follows:
In addition to errors, there are several CMake variables that allow you to control how the build system configures GMAT:
|CMake Variable (Group)||Description||Associated CMake Error|
|Path to CSPICE root directory|
|CSPICE NOT FOUND (make sure to run depends script from Step 1)|
|Path to F2C root directory|
Note: this should generally be
|F2C NOT FOUND (make sure to run depends|
script from Step 1)
|On makefile systems, this specifies the desired build type |
On VisualStudio/XCode systems, this specifies all possible build types
Note: On makefile systems, you should create a separate out-of-source build folder for each desired build type (Figure 3 box
|Location to install GMAT when doing |
or building the VisualStudio->
Full path to the top-level GMAT Proprietary Plugins
(folder that contains CMakeLists.txt) This will be automatically found if you name it
|Path to MATLAB root directory |
(on Mac, this is the path to MATLAB_R20xxx.app)
|Matlab NOT FOUND (make sure MATLAB |
|Whether to build a particular GMAT Plugin |
Note: the proprietary plugins only show up here if
|Mac/Linux: Path to wxWidgets |
(usually this is the wxWidgets
Windows: Path to wxWidgets
|wxWidgets NOT FOUND (make sure to run depends script from Step 1)|
|PYTHON_LIBRARY (PYTHON) (Advanced Variable)||Use a specific installation of Python for GMAT's PythonInterface plugin. If this variable is blank, the latest version of Python that can be found in default locations will be used. Set this to the FULL PATH to pythonXX.lib (e.g. C:/path/to/python35.lib) if you installed Python to a custom location.||Python NOT FOUND (make sure Python is installed, and variable is set properly)|
|Xerces library and include folder locations.||Failed to find XercesC (make sure to run depends script from Step 1)|
When all CMake errors are handled and you have specified all desired GMAT options, click "Generate".
CMake will create the build system in the chosen out-of-source build folder (Figure 3 box 2).
CMake is fully scriptable and can be called from the command line instead of using the GUI. This is especially useful on operating systems (e.g. Red Hat Linux 7) where the GUI is unavailable.
cd <GMAT>/build; mkdir macosx-cmake; cd macosx-cmake
<GMAT>folder and specify options
cmake [options] ../..
-DPLUGIN_CINTERFACE=OFF. Multiple such options can be specified.
GMAT.slnVisual Studio solution. After loading, you should see the following projects:
Figure 5. CMake-generated VisualStudio2013 Solution
ALL_BUILD: The default startup project. Ensures that all other projects are up-to-date, then builds them.
ZERO_CHECK: Performs the work to ensure all other projects are up-to-date. It is automatically built along with all other projects.
INSTALL: Creates a standalone GMAT folder containing all executables, plugins, data files, samples, and documentation.
GmatGUI, Plugins: The various GMAT components. You can build these individually if desired.
ALL_BUILDproject. Depending on your system speed and number of selected GMAT components, this may take a while!
INSTALLproject if you want a fully standalone and relocatable version of GMAT.
Makefiles are run through the command line, which on Mac and Linux can be accessed via the Terminal application.
In these instructions,
<CMake_build_path> is the path to the build system folder that you chose in Step 2 (Figure 3 box 2).
$is your command prompt):
$ cd <CMake_build_path>
make -jN" to significantly speed up the compile time
make install" if you want a fully standalone and distributable version of GMAT.
See the following table in case there are build errors when compiling or installing GMAT.
Unresolved External Symbol *_Py_* referenced in function ...
|Python Interface||32/64-bit Python found by CMake is different than architecture of compiler (VisualStudio, gcc, ...)||Make sure to install the correct 32- or 64-bit version of Python and specify it via the PYTHON_LIBRARY CMake variable.|
|CInterface Matlab thunk files not produced during INSTALL step||C Interface||There is a known incompatibility between Matlab R2015a/b and XCode 7 that prevents the CInterface thunk files from being built.||Perform the Matlab initialization instructions.|
After building, you have several options for how to run GMAT:
CMAKE_INSTALL_PREFIXfolder that you chose in Step 2. The GMAT executables will be in the
<GMAT>/applicationdirectory. You can run GMAT from the
debug/) subfolders without having to perform the optional INSTALL step. This allows for a more rapid edit-build-test development cycle. On Windows, you can also run the
GmatGUIprojects directly from within VisualStudio. This allows for in-program debugging with breakpoints.
Right-click on the
GmatGUI project, and select "Set as Startup Project"
Select menu item Debug -> Start Debugging (or Start Without Debugging for Release configurations)
wxWidgets v3.0.2 has a known bug (documented here) on Mac OSX 10.10+ that causes a build error. As of R2016a, the GMAT dependency configuration script (
configure.sh) implements this fix internally, so GMAT users do not need to take any additional action for wxWidgets to build on Mac.