Generating automatically the configuration files
for |
The tool mmxmake allows to generate automatically the cmake configuration files. So for the following, you need to have cmake installed.
The process can be decomposed into 3 steps:
Initialisation and generation of the configuration, using the command mmxmake;
Configuration using the command cmake;
Construction using the command make.
The generation of the configuration files for cmake is based on a specification file. A default specification file can be generated in the package directory pkg, with the command
mmxmake -init
If the current directory name is pkg, a directory specif and a file specif/pkg-cmake.mmx are created or udpated if it exists. This file contains the information to generate the cmake configuration files. In our case, it looks like the following:
pkg: Package := package ("pkg", "0.1");
//List of files to be generated automaticaly
pkg.automatic := ["CMakeLists.txt",
"doc/tools",
"cmake/FindPkg.cmake.in" ];
create_package (pkg);
This file can be edited to tune the generated cmake files as wanted. This specification of a package can also be displayed with mmxmake -info. It gives
Package : pkg 0.1
Automatics :
["CMakeLists.txt","doc/tools","cmake/FindPkg.cmake.in"]
This specification step can be run from another directory with the option -dir:
mmxmake ../pkg -init
In this example, the specification files are generated in the folder ../pkg.
To add dependencies whith other packages for the libraries or the glue, one can use the command such as:
mmxmake -init +l basix +l gmp +g numerix +v 0.1.2
The file specif/pkg-cmake.mmx then contains
pkg: Package := package ("pkg", "0.1.2");
//List of files to be generated automaticaly
pkg.automatic := ["CMakeLists.txt"
,"doc/texmacs/index.en.tm"
,"cmake/FindPkg.cmake.in" ];
//List of packages on which the lib of the package depends
pkg.libs := ["basix", "gmp"];
//List of packages on which the glue lib of the package depends
pkg.glue := ["numerix"];
create_package (pkg);
Here the package pkg depends on basix and gmp for the construction of the library libpkg and numerix for the construction of the glue libmmxpkg.
Now the command mmxmake -info yields:
Package : pkg 0.1.2
Automatics : ["CMakeLists.txt","doc/texmacs/index.en.tm",
"cmake/FindPkg.cmake.in"]
Libs : ["basix", "gmp"]
Glue : ["numerix"]
Default options can be passed to the CMakeLists.txt file using a command of the form:
mmxmake -init +o glue -o test
In this exemple, the glue part will be built by default but not the test part.
If the option -init is not used, the indicated options will be updated:
mmxmake -o glue
This command turns the glue default OFF by default but keep the other options as they are.
To assembled in a same package several mathemagix subpackages, the following can be used:
mmxmake -init +p basix +p numerix +p mmxlight
The following line will be added in the specification file:
pkg.subpackages := ["basix", "numerix", "mmxlight"];
If the packages basix, numerix, mmxlight are not available, they will be downloaded from its svn server (using an anonymous svn checkout). If you want to create a new package and add it to as a subfolder, you need first to configure this package. The corresponding subdirectories will be added in the build tree of the package pkg.
Subpackages can be included but not used by default as follows:
mmxmake -init +p basix +p numerix +p mmxlight -o numerix
The configuration is initialized if the option -init is used and updated otherwise. The following instruction will be added in the specification file:
pkg.subpackages := ["basix", "numerix", "mmxlight"];
set_option ("numerix", false);
In this case, when cmake is run, the package numerix will not be configured. To turn on the corresponding option for cmake, use cmake -DNUMERIX=ON ../pkg (see below).
The option -p can be used to remove a package from the list of subpackages:
mmxmake -p mmxlight
The configuration files are updated accordingly (but the corresponding
folder mmxlight will not be removed). A list of
Notice that the package numerix depends on two external libraries:
If they are not installed globally, the option EXTERNAL can be turned ON to download and build them:
cmake ../pkg -DEXTERNAL=ON
The new libraries can now be built:
make
A list of
The list of libraries on which a package depends can be updated with the options -l +l. Here is an example:
mmxmake ../pkg -l gmp +l numerix
This will remove gmp from the list pkg.libs and add numerix to it.
The list of libraries for building the glue with the
mmxmake ../pkg -g numerix +g algebramix
This will remove numerix from the list pkg.glue and add to it algebramix.
Similarly, the dependencies for building the plugins for
mmxmake ../pkg +a shape
This will add shape to the list pkg.axel.
Also the list of subpackages of the package can be updated +p -p:
mmxmake ../pkg +p shape
This will add shape to the list of subpackages of pkg.
Once these files have been generated, they can used independently of mmxmake, with cmake in the usual way. The configuration can be done out-of-source, for instance in a folder build:
mkdir build; cd build;
The configuration process is performed with:
cmake ../pkg
For more details on the different options, see here.
Once cmake is run, the command make can be used:
make
For more details, see here.