Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

titleIf the wrong libraries are picked up ...

cmake optionsdocdefaultECMWF
BOOST_ROOTwhere to find boost ( if non-standard installation (wink) ) /usr/local/apps/boost/1.50.0 ( for the worksation)
PROJ4_PATHwhere to find proj4 ( if non-standard installation (wink) ) /usr/local/apps/proj4/4.8.0/LP64

WITH_GRIB

enable grib supportonon
GRIB_API_PATHwhere to find grib-api /usr/local/lib/metaps/lib/grib_api/1.11.0
WITH_NETCDFenable netcdf supportonon
NETCDF_PATHwhere to find netcdf  
WITH_ODBenable odb supportoffoff
ODB_API_PATHwhere to find odb 

/usr/local/apps/odb_api/0.9.28

WITH_FORTRANenable fortran supportonon
WITH_METVIEWenable metview support(and Qt support)off

off

WITH_BUFRenable bufr supportoffoff (but if on we have to set  PGI_PATH to /usr/local/apps/pgi/pgi-10.8/linux86-64/10.8/libso)
WITH_CAIROenable cairo supportonon
CMAKE_BUILD_TYPE

to select the type of compilation:

    • Production(-O2 -g)
    • Debug (-g)
?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.

...