...
CMake is a cross-platform free software program for managing the build process of software using a compiler-independent method.
Generating the Makefiles with CMake
One nice and highly recommended feature of CMake is the ability to do out of source builds. In this way you can make all your ".o" files, various temporary depend files, and even the binary executables without cluttering up your source tree. To use out of source builds, first create a build directory, then change into your build directory and run cmake pointing it to the source directory and using your own options.
The command gives feedback on what requirements are fulfilled and what software is still required. The following table gives an overview of the different options. The default (without any options) will compile a shared library only and install it in /usr/local/.
CMAKE_INSTALL_PREFIX | where you want to install your ODB API | /usr/local |
CMAKE_BUILD_TYPE | to select the type of compilation: - Debug
- RelWithDebInfo
- Release
- Production
| RelWithDebInfo |
BUILD_SHARED_LIBS | Select the type of library built:- ON (Build shared libraries only)
- OFF (Build static libraries only)
- BOTH (Build both shared and static libraries)
| ON |
CMAKE_CXX_COMPILER | C++ compiler | |
CMAKE_CXX_FLAGS | Flags for the C++ compiler | |
CMAKE_C_COMPILER | C |
Compilercompiler | |
CMAKE_C_FLAGS | Flags for the C |
Compilercompiler | |
CMAKE_Fortran_COMPILER | Fortran |
Compilercompiler | |
CMAKE_Fortran_FLAGS | Flags for the Fortran |
CompilerFor the grib_to_netcdf convert Build odb2netcdf tool | AUTO |
ENABLE_ |
JPGEnable JPEG2000 support. This option should look for Jasper or OpenJPG | AUTO | PYTHON | Build Python interface for ODB API |
ENABLE_PNG | Enable PNG support for decoding/encoding | OFF |
ENABLE_PYTHON | Offers the Python interface to the packageOffers the to the packageECCODES_THREADSEnable POSIX threads | OFF | ENABLE_ECCODES_OMP_THREADS | Enable OpenMP threads | OFF |
ENABLE_MEMFS | See Memory based access to definition/sample files | MIGRATOR | Build odb_migrator tool for importing legacy ODB databases | |
ODB_SOURCE | Directory with source of the legacy ODB software | |
ODB_PATH | Path to legacy ODB installation | |
OFF
Note: The compilers can also be overridden by setting the environment variables CC and FC.
Note: To see the full output from the compilation, you can use: make
Code Block |
---|
language | bash |
---|
title | Build in verbose mode |
---|
|
$ make VERBOSE= |
1Quick installation guide
Here is an example of a list of commands are example commands that you could use to install ODB API. It is assumed “>” is the Dollar sign ($) is a typical shell prompt.
Code Block |
---|
language | bash |
---|
title | Basic installation procedure |
---|
|
$> tar -xzf ODB_API-x.y.z-Source.tar.gz
>$ mkdir build ; cd build
>$ cmake -DCMAKE_INSTALL_PREFIX=/path/to/where/you/install/odb_api ../ODB_API-x.y.z-Source
...
>$ make
>$ ctest
>$ make install |
It is recommended that you always build in a clean directory and also install into a clean directory.
...