This page describes how to install Generic Mapping Tools (GMT) on Cygwin. 


Reference:http://gmt.soest.hawaii.edu/projects/gmt/wiki/BuildingGMT#Cygwin
Reference:http://trac.osgeo.org/gdal/wiki/BuildingOnUnix
Reference: 'http://gmt.soest.hawaii.edu/projects/gmt/wiki/BuildingGMT#Building-GMT-from-source'

Step-by-step guide


Install the following packages using the cygwin installer. 

cmake, fftw, fftw-devel, gcc, g++, ghostscript, gv, libnetcdf7, libnetcdf-devel, 
libpcre, libpcre-devel, make, openssh, subversion, xinit, zlib, zlib-devel


Set the environmental variable HDF5_DISABLE_VERSION_CHECK=2 by adding the following line to the '.bashrc' file in the cygwin home folder (Omitting this step will cause an error):

export HDF5_DISABLE_VERSION_CHECK=2


Download the latest stable 'gdal' source code from 'http://download.osgeo.org/gdal', and extract it to a temporary folder (e.g. '$HOME/builds/'), and run the following commands:

cd $HOME/builds/gdal-<version>
./configure --prefix=$HOME/opt/gdal-<version>
make
make install
Replace <version> with the version of 'gdal'


Download the latest stable GMT source code from 'http://gmt.soest.hawaii.edu/projects/gmt/wiki/Download', along with 'gshhg-gmt' and 'dcw-gmt', and extract the source codes into a temporary build folder (e.g. '$HOME/builds/').


In the GMT source folder, copy cmake/ConfigUserTemplate.cmake to cmake/ConfigUser.cmake and edit the file. For example:

set (CMAKE_INSTALL_PREFIX "/home/<username>/opt/gmt5")
set (GSHHG_ROOT "/home/<username>/builds/gshhg-gmt-2.3.4")
set (COPY_GSHHG TRUE)
set (DCW_ROOT "/home/<username>/builds/dcw-gmt-1.1.2")
set (COPY_DCW TRUE)
set (GDAL_ROOT "/home/<username>/opt/gdal-2.0.1")
Replace <username> with your actual username.

 

 Build and install GMT:

cd <path to GMT>
mkdir build
cd build
cmake ..
make
make install

 

Set up the PATH environmental variables for GMT and GDAL by adding the following line in '.bashrc' file in the cygwin home folder:

export PATH=$PATH:$HOME/opt/gmt5/bin:$HOME/opt/gdal-2.0.1/bin