From: maier
+ This page provides details about deal.II CMake build system.
+
+ Details on the deal.II CMake build system
+
+
+
+
+ Table of contents
+
+
+
+
+ To keep things clean, only the following variables should be
+ appended in the platform checks and feature configuration (beside
+ setting a lot of DEAL_II_*
definitions...):
+
_DEBUG
or
+ _RELEASE
: Used for all targets
+ <...>_DEBUG
: additionally used for debug targets
+ <...>_RELEASE
: additionally used for release targets
+ CMAKE_SHARED_LINKER_FLAGS
+ DEAL_II_SHARED_LINKER_FLAGS_DEBUG
+ DEAL_II_SHARED_LINKER_FLAGS_RELEASE
+ -std=c++11
(if available):
+ CMAKE_CXX_FLAGS
+ DEAL_II_CXX_FLAGS_DEBUG
+ DEAL_II_CXX_FLAGS_RELEASE
+ INCLUDE_DIRECTORIES(...)
+ -D<...>
) for the compilation of the
+ deal.II library:
+ DEAL_II_DEFINITIONS
+ DEAL_II_DEFINITIONS_DEBUG
+ DEAL_II_DEFINITIONS_RELEASE
+ DEAL_II_EXTERNAL_LIBRARIES
+ DEAL_II_EXTERNAL_LIBRARIES_DEBUG
+ DEAL_II_EXTERNAL_LIBRARIES_RELEASE
+ DEAL_II_USER_DEFINITIONS
+ DEAL_II_USER_DEFINITIONS_DEBUG
+ DEAL_II_USER_DEFINITIONS_RELEASE
+ DEAL_II_USER_INCLUDE_DIRS
+
+ Platform checks reside under cmake/checks
. We currently have
+
+ + cmake/check/check_for_compiler_bugs.cmake + cmake/check/check_for_compiler_features.cmake + cmake/check/check_for_cxx_features.cmake ++ +
+ Some Notes: +
+ + CHECK_CXX_SOURCE_COMPILES(source variable) + - Checks whether it is possible to compile _and_ link the code snipet + <source>. If succesful, variable is set to 1. + + CHECK_CXX_SOURCE_RUNS(source variable) + - variable is set to 1 if <source> coulde be succesfully compiled and + linked and the resulting program ran and exited without error. + + CHECK_CXX_COMPILER_BUG(source variable) + - Inverts the logic of CHECK_CXX_SOURCE_COMPILES(), i.e. variable is + set to 1 if it was not possible to compile and link <source>. + + CHECK_INCLUDE_FILE_CXX(header variable) + - Check whether it is possible to compile and link a dummy program + including <header>. + + CHECK_FUNCTION_EXISTS(function variable) + - Check for the existence of a function prototype with name + <function>. (Don't forget to specify the link libraries, see + below.) + + CHECK_CXX_COMPILER_FLAG(flag variable) + - Sets the variable to 1 if the compiler understands the flag. ++ +
CMAKE_REQUIRED_FLAGS
. There are two small macros
+ that do this job nicely:
+ + + PUSH_TEST_FLAG("-Werror") + CHECK_CXX_SOURCE_COMPILES(...) + POP_TEST_FLAG() ++ +
CMAKE_REQUIRED_LIBRARIES
. It is best two hard set
+ this variable to a specific value and later on cleaning it,
+ instead of appending/removing:
+ + + SET(CMAKE_REQUIRED_LIBRARIES <a list of libraries> + CHECK_CXX_SOURCE_COMPILES(...) + SET(CMAKE_REQUIRED_LIBRARIES) ++
+ General notes: +
include/deal.II/base/config.h.in
should have a
+ prominent comment explaining it and should be grouped by file
+ exporting the definition
+ + TODO: This section is a bit outdated, update it! +
+
+ For a feature <feature>
the following
+ the following toggles, variables and macros can be defined
+ defined (Note: <FEATURE>
means all caps,
+ <feature>
means all lowercase):
+
cmake/configure/configure_<feature>.cmake
+ defining how to configure <feature>
:
+ + FEATURE_${feature}_DEPENDS (a variable) + - a variable which contains an optional list of other features + this feature depends on (and which have to be enbled for this feature + to work.) The features must be given with the full option toggle: + DEAL_II_WITH_[...] + + FEATURE_<FEATURE>_FIND_EXTERNAL(var) (a macro) + - which should set var to TRUE if all dependencies for the feature are + fulfilled. In this case all necessary variables for + FEATURE_<FEATURE>_CONFIGURE_EXTERNAL must be set. Otherwise + var should remain unset. + If not defined, FIND_PACKAGE(${feature}) is called. + + FEATURE_<FEATURE>_CONFIGURE_EXTERNAL() (a macro) + - which should setup all necessary configuration for the feature with + external dependencies. If something goes wrong this macro must + issue a FATAL_ERROR. + + FEATURE_<FEATURE>_CONFIGURE_BUNDLED() (a macro) + - which should setup all necessary configuration for the feature with + bundled source dependencies. If something goes wrong this macro must + issue a FATAL_ERROR. + + FEATURE_<FEATURE>_ERROR_MESSAGE() (macro, optional) + - which should print a meaningful error message (with FATAL_ERROR) for + the case that no external library was found (and bundled is not + allowed to be used.) If not defined, a suitable default error message + will be printed. ++ +
bundled/CMakeLists.txt
:
+ + + DEAL_II_FORCE_BUNDLED_<FEATURE> (a boolean) + - If <feature> can be set up by bundled libraries, this + configuration option must be present to force use of bundled + dependencies + + FEATURE_<FEATURE>_HAVE_BUNDLED (a variable) + - which should either be set to TRUE if all necessary libraries of the + features comes bundled with deal.II and hence can be supported + without external dependencies, or unset. ++ + Setup of compilation and installation if +
FEATURE_<FEATURE>_BUNDLED_CONFIGURED
is set.
+ + + $ cmake -C Config.sample <...> ++ can be found here. + This sample configuration covers all options mentioned in this + documentation as well as some advanced aspects in feature + configuration. + +
make install
will still want to have both
libraries up to date and will therefore invoke make all
automatically. To restrict builds in such a way that only one library
- will be installed, see this section.
+ will be installed, see this section.
-
- The various configuration options of the deal.II library are organized in three - categories: feature, - component, and build/install + categories: feature, + component, and build/install configuration.
- +@@ -250,10 +246,8 @@
DEAL_II_WITH_BOOST
is always ON
since BOOST is a mandatory build time dependency.
- DEAL_II_WITH_THREADS
decides whether to use
- threads and if set to ON
also decides whether
- we interface to the Threading Building Blocks (TBB) library
- which we need in that case.
+ DEAL_II_WITH_THREADS
enables threading support
+ with the help of the Threading Building Blocks (TBB) library.
@@ -303,7 +297,7 @@
-
+
@@ -338,7 +332,7 @@
- +@@ -393,7 +387,7 @@
- The system default locations for libraries and includes. + The default system locations for libraries and includes.
@@ -401,10 +395,8 @@
Alternatively, cached variables set by the
Find<Module>
mechanism may be set,
- hinted or overwritten directly. These variables are usually
- called <library>_INCLUDE_DIR(|S)
and
- <library>_(LIBRARY|LIBRARIES)
(highly dependend
- of the actual library). You can get a list via
+ hinted or overwritten directly (variable names are highly
+ dependend on the actual library). You can get a list via
make edit_cache @@ -414,8 +406,27 @@-NOTFOUND
and may be set by hand. + +Manual override
+ It is possible to override the CMake find mechanism for external + libraries manually. This is e.g. useful if a non standard lapack/blas + installation should be used (and cannot be found by the +FindLapack.cmake
module shipped with CMake) + In this case you can by hand +- + cmake -DLAPACK_FOUND=true \ + -DLAPACK_LIBRARIES="library;and;complete;link;interface" \ + -DLAPACK_LINKER_FLAGS="" <...> ++ You can set these values on the command line, with ccmake or by + providing an initial cache file, see + advanced setup section. + Possible manual overrides are explained in detail in the + in the Config.sample file. + + +Component selection
@@ -474,36 +485,32 @@
- +Build configuration
- As explained in this section above, one can - limit
make
to building only a subset of the usual - libraries. However, this does not restrict the set of things that need - to be built so thatmake install
can install them. Rather, - thecmake
variable -CMAKE_BUILD_TYPE
controls the type of build. - We support theDebug
,Release
- andDebugRelease
build targets. Default is the -DebugRelease
target. + Thecmake
variableCMAKE_BUILD_TYPE
+ controls the type of build. We supportDebug
, +Release
andDebugRelease
mode. Default + isDebugRelease
.
cmake
the
flag -DCMAKE_BUILD_TYPE=Debug
will produce makefiles
- that require only compiling and installing the debug library
- libdeal_II.g.so
+ that compile and install only the debug library
+ libdeal_II.g.so
.
cmake
the
flag -DCMAKE_BUILD_TYPE=Release
result in only
- compiling and installing libdeal_II.so
.
+ compiling and installing the optimized library libdeal_II.so
.
cmake
the
flag -DCMAKE_BUILD_TYPE=DebugRelease
will build and
install both libraries.
@@ -519,7 +526,7 @@ may still pull in necessary compiler flags.
@@ -530,7 +537,7 @@ The content of the cached variables will be preserved and added to the end of the default compiler flags, - hence providing the possibility for overwriting a flag. E.g.: + hence providing the possibility for overriding a flag. E.g.:-Wsign-compare
, set by the build system, can be overwritten by specifying:@@ -561,7 +568,7 @@ - +Installation
@@ -850,237 +857,8 @@
- -Developing the deal.II CMake system
- -- To keep things clean, only the following variables should be - appended in the platform checks and feature configuration (beside - setting a lot of
DEAL_II_*
definitions...): -
_DEBUG
or
- _RELEASE
: Used for all targets
- <...>_DEBUG
: additionally used for debug targets
- <...>_RELEASE
: additionally used for release targets
- CMAKE_SHARED_LINKER_FLAGS
- DEAL_II_SHARED_LINKER_FLAGS_DEBUG
- DEAL_II_SHARED_LINKER_FLAGS_RELEASE
- -std=c++11
(if available):
- CMAKE_CXX_FLAGS
- DEAL_II_CXX_FLAGS_DEBUG
- DEAL_II_CXX_FLAGS_RELEASE
- INCLUDE_DIRECTORIES(...)
- -D<...>
) for the compilation of the
- deal.II library:
- DEAL_II_DEFINITIONS
- DEAL_II_DEFINITIONS_DEBUG
- DEAL_II_DEFINITIONS_RELEASE
- DEAL_II_EXTERNAL_LIBRARIES
- DEAL_II_EXTERNAL_LIBRARIES_DEBUG
- DEAL_II_EXTERNAL_LIBRARIES_RELEASE
- DEAL_II_USER_DEFINITIONS
- DEAL_II_USER_DEFINITIONS_DEBUG
- DEAL_II_USER_DEFINITIONS_RELEASE
- DEAL_II_USER_INCLUDE_DIRS
-
- Platform checks reside under cmake/checks
. We currently have
-
- - cmake/check/check_for_compiler_bugs.cmake - cmake/check/check_for_compiler_features.cmake - cmake/check/check_for_cxx_features.cmake -- -
- Some Notes: -
- - CHECK_CXX_SOURCE_COMPILES(source variable) - - Checks whether it is possible to compile _and_ link the code snipet - <source>. If succesful, variable is set to 1. - - CHECK_CXX_SOURCE_RUNS(source variable) - - variable is set to 1 if <source> coulde be succesfully compiled and - linked and the resulting program ran and exited without error. - - CHECK_CXX_COMPILER_BUG(source variable) - - Inverts the logic of CHECK_CXX_SOURCE_COMPILES(), i.e. variable is - set to 1 if it was not possible to compile and link <source>. - - CHECK_INCLUDE_FILE_CXX(header variable) - - Check whether it is possible to compile and link a dummy program - including <header>. - - CHECK_FUNCTION_EXISTS(function variable) - - Check for the existence of a function prototype with name - <function>. (Don't forget to specify the link libraries, see - below.) - - CHECK_CXX_COMPILER_FLAG(flag variable) - - Sets the variable to 1 if the compiler understands the flag. -- -
CMAKE_REQUIRED_FLAGS
. There are two small macros
- that do this job nicely:
- - - PUSH_TEST_FLAG("-Werror") - CHECK_CXX_SOURCE_COMPILES(...) - POP_TEST_FLAG() -- -
CMAKE_REQUIRED_LIBRARIES
. It is best two hard set
- this variable to a specific value and later on cleaning it,
- instead of appending/removing:
- - - SET(CMAKE_REQUIRED_LIBRARIES <a list of libraries> - CHECK_CXX_SOURCE_COMPILES(...) - SET(CMAKE_REQUIRED_LIBRARIES) --
- General notes: -
include/deal.II/base/config.h.in
should have a
- prominent comment explaining it and should be grouped by file
- exporting the definition
- - TODO: This section is a bit outdated, update it! -
-
- For a feature <feature>
the following
- the following toggles, variables and macros can be defined
- defined (Note: <FEATURE>
means all caps,
- <feature>
means all lowercase):
-
cmake/configure/configure_<feature>.cmake
- defining how to configure <feature>
:
- - FEATURE_${feature}_DEPENDS (a variable) - - a variable which contains an optional list of other features - this feature depends on (and which have to be enbled for this feature - to work.) The features must be given with the full option toggle: - DEAL_II_WITH_[...] - - FEATURE_<FEATURE>_FIND_EXTERNAL(var) (a macro) - - which should set var to TRUE if all dependencies for the feature are - fulfilled. In this case all necessary variables for - FEATURE_<FEATURE>_CONFIGURE_EXTERNAL must be set. Otherwise - var should remain unset. - If not defined, FIND_PACKAGE(${feature}) is called. - - FEATURE_<FEATURE>_CONFIGURE_EXTERNAL() (a macro) - - which should setup all necessary configuration for the feature with - external dependencies. If something goes wrong this macro must - issue a FATAL_ERROR. - - FEATURE_<FEATURE>_CONFIGURE_BUNDLED() (a macro) - - which should setup all necessary configuration for the feature with - bundled source dependencies. If something goes wrong this macro must - issue a FATAL_ERROR. - - FEATURE_<FEATURE>_ERROR_MESSAGE() (macro, optional) - - which should print a meaningful error message (with FATAL_ERROR) for - the case that no external library was found (and bundled is not - allowed to be used.) If not defined, a suitable default error message - will be printed. -- -
bundled/CMakeLists.txt
:
- - - DEAL_II_FORCE_BUNDLED_<FEATURE> (a boolean) - - If <feature> can be set up by bundled libraries, this - configuration option must be present to force use of bundled - dependencies - - FEATURE_<FEATURE>_HAVE_BUNDLED (a variable) - - which should either be set to TRUE if all necessary libraries of the - features comes bundled with deal.II and hence can be supported - without external dependencies, or unset. -- - Setup of compilation and installation if -
FEATURE_<FEATURE>_BUNDLED_CONFIGURED
is set.
- diff --git a/deal.II/doc/development/toc.html b/deal.II/doc/development/toc.html index 99b2656d20..1e3de347b8 100644 --- a/deal.II/doc/development/toc.html +++ b/deal.II/doc/development/toc.html @@ -38,8 +38,8 @@
deal.II CMake documentation: - This page provides extensive information about usage and - development of the deal.II CMake build system. + This page provides extensive information about usage + of the deal.II CMake build system.
Example CMakeLists.txt:
An overview of how to write the CMakeLists.txt
input
@@ -48,6 +48,11 @@
the deal.II library.
+ deal.II CMake internals: + This page provides details about deal.II CMake + build system. +
Writing documentation: To document the library and our application programs, we use