INSTALL.CMake 2.33 KB
Newer Older
1
Be sure that you have at least CMake 2.6 (cmake --version)
2

3 4 5
Create a new directory where the objects and executables 
will be built, e.g.
$ mkdir build; cd !$
6

7 8
Then run cmake pointing it to the root directory of gdl:
$ cmake ..
9

10 11
You can optionally specify a custom install prefix, e.g.:
$ cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../install
12

13 14 15 16
The default build mode is "Release" which enables compiler
optimisations and disables storing debugging symbols in 
the GDL binary. To use the "Debug" mode type:
$ cmake .. -DCMAKE_BUILD_TYPE=Debug
17

18 19
To use a non-default C++ compiler, one needs to call e.g.:
$ cmake .. -DCMAKE_CXX_COMPILER=clang++
20

21 22
Numerous features of GDL rely on external libraries. These
features can be enabled or disabled using CMake options.
23

24 25 26 27 28 29 30 31 32
Most of the optional features have a flag that controls
enabling/disabling the feature (e.g. EIGEN3, FFTW, HDF5, 
MAGICK, PSLIB, GRAPHICSMAGICK, GRIB, GSHHS, HDF, ...) 
and a flag that allows to specify a custom location of a
given package (e.g. EIGEN3DIR, FFTWDIR, HDF5DIR, ...). 
Both the on/off and the path-spec options are passed 
to CMake as command=line options prefixed with "-D", e.g.:
$ cmake .. -DREADLINE=OFF'         # to disable readline
$ cmake .. -DFFTWDIR=/opt/local/   # alternative FFTW path
33

34 35 36 37 38 39 40 41
Other options include:
- PYTHONVERSION to chose a particular Python version if 
  multiple are installed on the system,
- OLDPLPLOT to switch off features requiring newer plplot
  versions,
- GDL_DATA_DIR (default: /share/gnudatalanguage) to specify
  a custom installation location for GDL files 
  (a subdirectory of the main installation prefix)
42

43 44 45
The list of all GDL-related options accepted by CMake along
with their default values can be obtained by calling:
$ cmake .. -LAH | grep -A1 "// GDL: "
46

47 48 49
Results are cached. So if you need to specify a new 
libraries that have already been found you have to 
delete CMakeCache.txt and rerun cmake.
50

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
If you are on a Unix system, you can run `make' to begin
compilation (optionally with the number of concurrent
processes specified using the -j option):
$ make -j 3

For other systems, a native project file will be produced.

To launch the tests, run:
$ make check

To install, type:
$ make install

Other useful commands include `make help' to view a list
of targets and `make edit_cache' to edit cache results 
(variables defined in advanced mode shouldn't be edited).