...
Traditionally Unix builds are finished with a call of 'make install' which copies all relevant files from the built project you need for your everyday use to a clean place. Basically it separates all necessary files from the "garbage" which is output in the build directory. The location of the install directory is governed by the CMake cache variable CMAKE_INSTALL_PREFIX. Of course, installation is entirely optional and only takes place if you build the install target.
Generating the Makefiles with
...
CMake
After changing into the unpacked build Magics directory, the user then user has to run the configure scriptCMake with his own options. The script command gives the user feedback on what requirements are fulfilled and what software is still required. Table 1 gives an overview of the different options of configure. More options of the script are available and can be listed by typing ./configure --help in the console. The default (without any options) will compile a shared share library only and install it in /usr/local/.
...
Option
...
Explanation
...
Default
...
--help
...
Outputs all options of configure.
...
...
--prefix=/your/path/
...
Directory in which Magics will be installed.
...
/usr/local
...
--enable-metview
...
Required if Magics is build to be used for Metview 4.
...
no
...
--enable-raster
...
Enables raster image output (GIF, GD_PNG, JPEG).
...
yes
...
--enable-cairo
...
Enables the Cairo output driver (PNG, EPS, PDF)
...
yes
...
--enable-bufr
...
Enables BUFR support (Emoslib is required)
...
no
...
--enable-grib
...
Enables GRIB 1/2 support
...
yes
...
--with-grib-api=<path>
...
Gives the location where GribAPI is installed
...
/usr/local
...
--enable-netcdf
--with-netcdf=<path>
...
Enables netCDF support
Set location of NetCDF libs
...
yes
/usr/local
...
--enable-static
--disable-shared
...
Compiles static library instead of shared one.
...
no
yes
...
--enable-python
--with-python-include-dir
--with-python-lib-dir
--with-numpy
...
Enables Python interface.
...
no
...
--libdir=<path>
...
Directory where libs are installed (on some 64bit it needs to be $prefix/lib64)
...
$prefix/lib
Even if a feature is enabled by the installer it might be still disabled by the configure script if the necessary dependent software can not be detected. Installers should check carefully the output of the configure script.
...
title | If the wrong libraries are picked up ... |
---|
cmake options | doc | default | ECMWF |
---|---|---|---|
BOOST_ROOT | where to find boost ( if non-standard installation | /usr/local/apps/boost/1.50.0 ( for the worksation) | |
PROJ4_PATH | where to find proj4 ( if non-standard installation | /usr/local/apps/proj4/4.8.0/LP64 | |
WITH_GRIB | enable grib support | on | on |
GRIB_API_PATH | where to find grib-api | /usr/local/lib/metaps/lib/grib_api/1.11.0 | |
WITH_NETCDF | enable netcdf support | on | on |
NETCDF_PATH | where to find netcdf | ||
WITH_ODB | enable odb support | off | off |
ODB_API_PATH | where to find odb | /usr/local/apps/odb_api/0.9.28 | |
WITH_FORTRAN | enable fortran support | on | on |
WITH_METVIEW | enable metview support(and Qt support) | off | off |
WITH_BUFR | enable bufr support | off | off (but if on we have to set PGI_PATH to /usr/local/apps/pgi/pgi-10.8/linux86-64/10.8/libso) |
WITH_CAIRO | enable cairo support | on | on |
CMAKE_BUILD_TYPE | to select the type of compilation:
| ? | Debug |
...
The C, C++ and Fortran compilers are chosen by configureCMake. (This can be overwritten by setting the variables CC, CXX and F77, on the configure command line, to the preferred compiler). Further the variable CXXFLAGS variable CMAKE_CXX_FLAGS can be used to set compiler flags for optimisation or debugging. For example, it is recommended to use CXXFLAGSCMAKE_CXX_FLAGS="-O2 -mtune=native" or any other optimisation to compile Magics.
The most important option is --prefix. Setting the prefix defines where your Magics library and executables will be installed. This path is later important for the user setup.The options to enable/disable output formats allow you to customise your installation. For example, if you have problems on your system with support libraries (see previous section), you might want to try to disable the raster output. The GD and Cairo libraries are responsible for most third-party dependencies.
Be aware when using Portland Fortran compilers and g++: The PGF90 compiler cannot handle C++ exceptions from the GNU compiler in static libraries. In this case we suggest to first build only the static library, using
./configure --disable-exceptions --disable-shared --enable-static F77=pgf90
plus any other configure option you want, and compile afterward the shared version of the library. By setting the variable F77 the user can hard code the Fortran compiler chosen by configure (in this case pgf90 ).
Compiling the code
After the configure script CMake command has run successfully, the user can compile the library by typing make in the same directory.
...
The output of the tests should verified before the library is installed. This setup does not check if the user setup is correct, but the code in test can be used to do so. More examples of source code and MagML files can be found on the Magics web page.gallery
Installing the library
Once the build and tests have been successfully completed, the command make install copies the library into the correct location on the system. Administrator permission might be required, depending on the installation directory. You might want to run make -n install first, which will show you what will be installed where, without performing any changes to your system.
...