Configuration and installation of a mmx package with cmake

To run the configuration of a mmx package (say pkg), the tool cmake should be installed in order to produce the Makefiles for the construction step.

If the packages depends on external libraries or tools, they will be checked during the configuration step. The installation instructions of each package describe what should be installed.

1.Configuration

A mathemagix package (say pkg) can be configured out-of-source in a directory build as follows. The directory of the sources of pkg is called hereafter <pkg_dir>; it can be for instance ../mmx/pkg if this package is one of the packages of mmx:

cd <path_to_build>
cmake <pkg_dir>  
make

Before starting, here some warnings on the configuration steps with cmake: it uses a cache file CMakeCache.txt to store the values of the configuration variables. Thus if you need to redo the configuration step from scratch, you have to clean this file:

rm CMakeCache.txt; cmake <pkg_dir>

A convenient and safe way is to do it systematically and to use the following alias:

alias CMake='rm -f CMakeCache.txt; cmake'

That is what we will do in the following.

If on the contrary, you want to keep or edit the configuration variables, you can use ccmake interface and have access to the stored value of these configuration variables and change them:

ccmake .

1.1.Building the libraries

By default, each package provides a library of the same name. The option which controls the construction of libraries is LIBS. The default value is LIBS=ON. If it is turned OFF, then the other options TEST, GLUE, APP, BENCH will also be turned OFF. Here is how it can be turned OFF:

CMake <pkg_dir> -DLIBS=OFF

1.2.Running the tests

The option which controls the test is TEST. To build these tests, you have to assign TEST=ON. The default value is TEST=OFF. Here is how it can be set:

CMake <pkg_dir> -DTEST=ON
make test

This will create in the executable tests in ./test.

1.3.Building the applications

The option which controls the construction of the applications from the folder app is APP. The default value is APP=ON. Here is how it can be turned off:

CMake <pkg_dir> -DAPP=OFF
make

If the application executables are built, they are put in the folder ./bin.

1.4.Building the glue with the mmx interpreter

The option which controls the construction of a module for the mmx interpreter, is GLUE. To construct the glue, you have to assign GLUE=ON, if it is not done by default. In this case, the dependency with other packages might be checked, depending on the list pkg.glue defined in the file specif/pkg-cmake.mmx. Here is how you can set it:

CMake <pkg_dir> -DGLUE=ON
make

This will create a module in the folder ./lib.

1.5.Building the plugins for axel

The option which controls the construction of modules for Axel available in the folder axl is AXEL. To construct these modules, you have to assign AXEL=ON. In this case, the dependency with other packages might be checked, depending on the list pkg.axel defined in the file specif/pkg-cmake.mmx. Here is how you can set it:

CMake <pkg_dir> -DAXEL=ON
make

This will create plugins which will put in the folder plugins of the application axel.

1.6.Building the documentation

To construct the documentation, you need also to have texmacs and doxygen installed. The variable which control the generation of the documentation is DOC. You can use the commands:

CMake <pkg_dir> -DDOC=ON
make

This will create a folder ./html/pkg which contain the html documentation.

1.7.Selecting subpackages

When the package contains subpackages, if the option for a subpackage say pkg1 is ON, then all the other subpackages on which pkg1 depends are turned ON. If the option for the subpackage pkg1 is OFF, then all the other subpackages which depend on pkg1 are turned OFF. If the mode DEV is turned ON, there is no default subpackage selection. In this case, to use a subpackage, the corresponding option has to be turned ON explicitely:

CMake <pkg_dir> -DDEV=ON -DNUMERIX=ON 

1.8.External packages

Some of the packages on which the libraries depend may be external to the distribution. To know which are the external packages, see the file mmxtools/mmx/download_table.mmx. These external packages are usually installed globally in the environment but in some cases it is necessary to configure and compile them directly. Such external libraries will be downloaded, configured and built if the option EXTERNAL passed to cmake is ON:

CMake -DEXTERNAL=ON ../pkg 

The corresponding libraries and headers will be installed in the folder include, lib where cmake is used.

In the case of numerix, it depends on two external libraries: gmp for integer and rational numbers, mpfr for floating point numbers. If they are not installed globally, theey will be downloaeded and built if the option EXTERNAL is turned ON.

2.Construction

Once cmake is run, the command make can be used:

make 

To see more details on the command that are run to build files, one can use the option VERBOSE:

make VERBOSE=1

To see the available targets of the make command, use

make help

3.Installation

To specify the place where you install the package, use CMAKE_INSTALL_PREFIX:

CMake <pkg_dir> -DCMAKE_INSTALL_PREFIX=$HOME/local
make && make install

If the variable CMAKE_INSTALL_PREFIX is not specified, the package will be installed with the prefix /urs/local (if you don't have the permission to write in this directory, you can use sudo make install).

4.Other targets

To see the other available targets, you can use:

make help

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License. If you don't have this file, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.