In order to build DUNE you need at least the following software:
- a standard compliant C++ compiler, tested are g++ and Clang; we try to stay compatibe with ICC
The following software is recommend but optional:
- MPI (either OpenMPI, lam, or mpich suffice)
This will provide you with the core DUNE features.
Some DUNE modules might support further software. Using this software is optional. The dune-grid module for example supports different external grid managers like Alberta or UG; these have to be downloaded separately. For a list of supported contrib software packages and their installation see the notes on Installation External Libraries.
Installing the core DUNE modules
First you need to download the DUNE core modules to your computer in one common directory. You can either download tarballs of the last releases of the core modules or download directly from our git repositories. Note: If you download the modules directly from git make sure to checkout a release branch if you don’t want to work with the current developement version.
To compile the modules DUNE has to check several components of your system and whether prerequisites within the modules are met. For the ease of users we have designed a custom build system on top of CMake. Run
to commence those tests and build all modules you have downloaded. Don’t worry about messages telling you that libraries are missing: they are only needed for grid-self-checks we need for developing or for additional features.
By default, an individual build directory is created inside each module. You can modify this behaviour by adding the ‘–builddir
You can customize the build to your specific needs by using an options file (see below)
If you want to have a system wide installation of DUNE you can call
./dune-common/bin/dunecontrol make install
You may need root-permissions for the install part depending on the prefix set. It is also possible to use DUNE without installing it.
The CMake documentation provides additional helpful informations.
Installing other DUNE modules
Besides the core modules you can find lots of other dune modules:
If you want to use one of those modules make sure to download the module and all dependencies in one common directory. If you want to work on a release branch (and not the current developement branch) you have to make sure to checkout the right branch of your modules if you cloned via git. Building your modules is done in the same way as building the core modules.
Building a Specific DUNE Module (and its dependent modules)
You can instruct dunecontrol to build only a certain dune module, using the
--only=<module_name> switch. Runnning dunecontrol script
./dune-common/bin/dunecontrol --only=<module_name> all
<module_name> is the name of that particular module given in the dune.module file, will build only the module
If you want to build a module and the modules it depends on, you must run:
./dune-common/bin/dunecontrol --module=<module_name> all
Passing Options to the Build Process
Using the dunecontrol script the following atomic commands can be executed:
- configure: runs the CMake configure tests for each module
- exec: executes a command in each module directory
- bexec: executes a command in each module’s build directory
- make: runs make (or any other build tool that was configured) for each module
- update: pull the latest version from the Git repository
The composite command
all simply runs
autogen, configure and
make for each module.
As it is often not convenient to specify the desired options after the duncontroll call, one can pass the options via file specified by the
--opts=<file> option. Specify the options via the variable
An example of an options file is
# use a special compiler (g++ version 9.0), # install to a custom# directory, default is /usr/local/bin, # disable the external library SuperLU, # and use Ninja-build instead of make as the build-tool CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_INSTALL_PREFIX='/tmp/HuHu' -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=true -GNinja"
On some platforms special care might have to be taken to make things compile, e.g. this is the case for IBM’s Blue Gene System P. If you want to run DUNE there please read the instructions of Markus and save yourself a lot of time.
Creating Your Own DUNE Project Module
You can create your own dune project module by using the duneproject script available in
dune-common/bin directory. Running the script will create a directory with supporting files (CMakeLists.txt etc.) and a sample .cc file. After creating the module you can build this as explained above under “Building a specific DUNE module”.
The DUNE Build System Documentation will also give you an excellent introduction to the build system and how to create new modules/projects your own.