GeographicLib
1.21
|
GeographicLib has been developed under Linux with the g++ compiler (versions 4.0 and later) and under Windows with Visual Studio 2005, 2008, and 2010. Earlier versions were tested also under Darwin and Solaris. It should compile on a wide range of other systems. First download either GeographicLib-1.21.tar.gz or GeographicLib-1.21.zip (or GeographicLib-1.21-win32.exe or GeographicLib-1.21-win64.exe for binary installation under Windows). Then pick one of the first five options below:
This section documents only how to install the software. If you wish to use GeographicLib to evaluate geoid heights or the earth's gravitational or magnetic fields, then you must also install the relevant data files. See Installing the geoid datasets, Installing the gravity models, and Installing the magnetic field models for instructions.
The first two installation methods use two important techniques which make software maintanence simpler
This is the recommended method of installation; however it requires that cmake be installed on your system. This permits GeographicLib to be built either as a shared or a static library on a wide variety of systems. cmake can also determine the capabilities of your system and adjust the compilation of the libraries and examples appropriately.
cmake is available for most computer platforms. On Linux systems cmake will typically one of the standard packages and can be installed by a command like
yum install cmake
(executed as root). On other systems, download a binary installer from http://www.cmake.org click on download, and save and run the appropriate installer. Run the cmake command with no arguments to get help. Other useful tools are ccmake and cmake-gui which offer curses and graphical interfaces to cmake. Building under cmake depends on whether it is targeting an IDE (interactive development environment) or generating Unix-style makefiles. The instructions below have been tested with makefiles and g++ on Linux and with the Visual Studio IDE on Windows.
Here are the steps to compile and install GeographicLib:
tar xfpz GeographicLib-1.21.tar.gz unzip -q GeographicLib-1.21.zip
cd GeographicLib-1.21
mkdir BUILD cd BUILD
cmake ..
cmake -G "Visual Studio 10" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10/GeographicLib .. cmake -G "Visual Studio 9 2008" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc9/GeographicLib .. cmake -G "Visual Studio 8 2005" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc8/GeographicLib ..
cmake -G "Visual Studio 10" -D CMAKE_PREFIX_PATH=C:/pkg-vc10 ..
cmake .
-D
(see the next step).cmake -D CMAKE_INSTALL_PREFIX=/tmp/geographic .
CMAKE_INSTALL_PREFIX
(default: /usr/local on non-Windows systems, C:/Program Files/GeographicLib on Windows systems) specifies where the library will be installed. For windows systems, it is recommended to use a prefix which includes the compiler version, as shown above (and also, possibly, whether this is a 64-bit build, e.g., cmake -G "Visual Studio 10 Win64" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10-x64/GeographicLib ..
) If you just want to try the library to see if it suits your needs, pick CMAKE_INSTALL_PREFIX
=/tmp/geographic, for example, and set GEOGRAPHIC_SHARED_LIB
=OFF.GEOGRAPHICLIB_DATA
(default: /usr/local/share/GeographicLib for non-Windows systems, C:/Documents and Settings/All Users/Application Data/GeographicLib for Windows systems) specifies the default location for the various datasets for use by GeographicLib::Geoid, GeographicLib::GravityModel, and GeographicLib::MagneticModel. See Installing the geoid datasets, Installing the gravity models, and Installing the magnetic field models for more information.GEOGRAPHIC_SHARED_LIB
(default: ON for non-Windows systems, OFF for Windows systems) determines whether a shared or static library is built. The default is OFF for Windows because there's no standard place to install the dlls.CMAKE_BUILD_TYPE
(default: Release). This flags only affects non-IDE compile environments (like make + g++). The default is actually blank, but this is treated as Release. Choose one of Debug Release RelWithDebInfo MinSizeRel
MATLAB_COMPILER
(default: OFF). Set this to either "mex" (for Matlab) or "mkoctfile" (for Octave) to specify the compiler to use for the Matlab/Octave interface. See Matlab and Octave interfaces for more information.MAINTAINER
(default: ON for non-Windows environments provided doxygen, pod2man, and pod2html are found). This affects whether the targets for creating source packages are activated. See Maintainer tasks for details.GEOGRAPHICLIB_EXAMPLES
(default: ON for the maintainer and OFF otherwise). If set to ON, then the short example programs in the examples
directory are built.make # compile the library and the examples make test # run some tests make install # as root, if CMAKE_INSTALL_PREFIX is a system directory
CMAKE_INSTALL_PREFIX
. (dll dynamic libraries are installed in bin.) The Matlab/Octave interface is installed in libexec/GeographicLib/matlab. For documentation, open share/doc/GeographicLib/html/index.html in a web browser.The method works on most Unix-like systems including Linux and Mac OS X. Here are the steps to compile and install GeographicLib:
tar xfpz GeographicLib-1.21.tar.gz
cd GeographicLib-1.21
mkdir BUILD cd BUILD
../configure
../configure --prefix=/tmp/geographic
make make install
prefix
. This installation method does not compile the Matlab/Octave interface; however the source for the interface is installed in libexec/GeographicLib/matlab, see Matlab and Octave interfaces of instructions on compiling the interface. For documentation, open share/doc/GeographicLib/html/index.html in a web browser.This method requires the standard GNU suite of tools, in particular make and g++. This builds a static library and the examples.
Here are the steps to compile and install GeographicLib:
tar xfpz GeographicLib-1.21.tar.gz
cd GeographicLib-1.21
include/GeographicLib/Config.h
#undef HAVE_LONG_DOUBLE
#define WORDS_BIGENDIAN 1
make # compile the library and the examples make install # as root
make PREFIX=/tmp/geographic install
PREFIX
. This installation method does not compile the Matlab/Octave interface; however the source for the interface is installed in libexec/GeographicLib/matlab, see Matlab and Octave interfaces of instructions on compiling the interface. For documentation, open share/doc/GeographicLib/html/index.html in a web browser.This method requires Visual Studio 2005, 2008, or 2010. This builds a static library and the utilities. If you only have Visual Studio 2003, use cmake to create the necessary solution file, see Installation with cmake. (cmake is needed to build the Matlab interface and to run the tests.)
unzip -q GeographicLib-1.21.zip
Use this method if you only need to use the GeographicLib utilities. The header files and static library are provided, but can only be used by Visual Studio 2010 in release mode. However, if you plan to use the library, it is advisable to build it with the compiler you are using for your own code using either Installation with cmake or Installation on Windows.
Download and run GeographicLib-1.21-win32.exe or GeographicLib-1.21-win64.exe:
(Note that the default installation folder adheres the the convention given in Installation with cmake.) The start menu will now include links to the documentation for the library and for the utilities (and a link for uninstalling the library). If you ask for your PATH to be modified, it will include C:/pkg-vc10/GeographicLib-1.21/bin where the utilities are installed. The headers and library are installed in the include/GeographicLib and lib folders. With the 64-bit installer, the Matlab interface is installed in the libexec/GeographicLib/matlab folder. Add this to your path in Matlab to access this interface. The binaries were built using Visual Studio 10 (2010) in Release mode. The Matlab interface was compiled with Matlab R2010b 64-bit, however it may work with some other 64-bit versions of Matlab.
If Qt is using a standard compiler, then build GeographicLib with that same compiler (and optimization flags) as Qt.
If you are using the mingw compiler on Windows for Qt, then you need to build GeographicLib with mingw. You can accomplish this with cmake under cygwin with, for example,
export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH" mkdir BUILD cd BUILD cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX=C:/pkg-mingw/GeographicLib .. mingw32-make mingw32-make install
If cmake complains that sh mustn't be in your path, invoke cmake with
env PATH="$( echo $PATH | tr : '\n' | while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done | sed 's/:$//' )" cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX=C:/pkg-mingw/GeographicLib ..
If cmake is not available, there is a simple project file that compiles the GeographicLib library only with the Qt compiler:
cd src qmake Geographic.pro # configure the project make # build the library
The library will be in the src directory (or the src/release or src/debug directory under Windows). The headers are in include/GeographicLib.
Check the code out of git with
git clone git://geographiclib.git.sf.net/gitroot/geographiclib/geographiclib
The autoconf configuration script, the html version of the documentation, and the formatted man pages not checked into git. In order to create the autoconf configuration script, run
sh autogen.sh
in the top level directory. Provided you are running on a system with doxygen, pod2man, and pod2html installed, then you can create the documentation and the man pages by building the system using cmake (the MAINTAINER
configuration variable set to ON, if the necessary tools are found) or configure.
In the case of cmake, you then run
make dist
which will copy the documentation and man pages from the build directory back into the source tree and package the resulting source tree for distribution as
GeographicLib-1.21.tar.gz GeographicLib-1.21.zip
Finally,
make package
or building PACKAGE in Visual Studio will create a binary installer for GeographicLib. For Windows, this requires in the installation of NSIS.
With configure, run
make dist-gzip
which will create the additional files and packages the results ready for distribution as
geographiclib-1.21.tar.gz