Commit Graph

2651 Commits

Author SHA1 Message Date
Roland Kaufmann
60ea52ade1 Provide distclean target to remove CMake artifacts
If you are building in-tree (which is commonly done by dunecontrol),
it can be advantageous to have a target which is capable of cleaning
out all the files that CMake left without having to erase the entire
folder.
2013-02-11 22:37:57 +01:00
Roland Kaufmann
10f8dfa390 Allow DUNE paths to be specified in configure
Path to DUNE libraries are specified with the ROOT prefix, but with the
stem with the same name as the module -- in lowercase (otherwise; does
the hyphen uppercase to underscore?). This deviates somewhat from the
usual CMake convention of using uppercase all over the place.
2013-02-11 22:37:57 +01:00
Roland Kaufmann
d9f984ecc5 Ignore version output
When creating CMake files for config mode, a separate version file is
generated; this should be on the ignore list as well if we are going
to build in-tree.
2013-02-11 22:37:57 +01:00
Roland Kaufmann
8b7990a8ea Remove tabs in shell script
Indentation by tab will cause a file listing for the current directory
before the command is executed, and that what not intended here.
2013-02-11 22:37:57 +01:00
Roland Kaufmann
773e645ac0 Keep build dir tidy by relocating Fortran modules
If we are building in-source, we don't want to have a bunch of output
files in the root directory; instead we put them in CMakeFiles/ where
all the rest of the object files go.
2013-02-11 22:37:57 +01:00
Roland Kaufmann
8c808e7262 Explain why globs can be used to enumerate source code
The documentation argues against it, but I believe it uses flawed
reasoning.
2013-02-11 22:37:57 +01:00
Roland Kaufmann
8ce114df89 Make documentation installable
If `make install` is run, the document is included if and only if
it has already been built. If `make install-html` is run, then the
documentation is always generated first, before installation. To
build the documentation separately from installation use `make doc`
2013-02-11 22:37:57 +01:00
Roland Kaufmann
22dee20c9f Don't expect human interaction in build
If the build fails, we want the error logged to a file, not that the
build hangs on a terminal (which may even not exist!)
2013-02-11 22:37:57 +01:00
Roland Kaufmann
bc327eed1e Disable tons of warnings in building documentation
The volume of warnings generated for the documentation completely drowns
out anything else useful. Until we have fixed more of the comments, this
should be disabled as to focus on problems with the code instead.
2013-02-11 22:37:56 +01:00
Roland Kaufmann
ffe00180a6 Generate documentation in a custom target
The targets are named after the similar targets when using Autotools.
2013-02-11 22:37:56 +01:00
Roland Kaufmann
8b3b753662 Use paths from build-spec. instead of relative paths 2013-02-11 22:37:56 +01:00
Roland Kaufmann
1cb8f4b0e7 Generate customized Doxyfile for each build 2013-02-11 22:37:56 +01:00
Roland Kaufmann
34702606ca Make building libraries static or shared selectable
Default is still to make a shared object because this is the most
versatile target (it can be included in other shared objects as well
as executables).

Note that due to limitations in CMake, either a shared or a static
library can be built, but not both. (This is due to the fact that on
Windows, an import library has the same name as a static library).
2013-02-11 22:37:56 +01:00
Roland Kaufmann
f4f78bf163 Don't strip debug symbols from libraries
Infer the type of library from the target and only activate debug symbol
stripping if it is an executable format. Note that this changes the
signature of the strip_debug_symbols macro.
2013-02-11 22:37:56 +01:00
Roland Kaufmann
06b17b9b21 Use full path to packages specified
CMake will change to the source directory when processing the
CMakeLists.txt file which causes relative paths to be based on this
instead of at the build directory which is probably assumed by the
user.
2013-02-11 22:37:56 +01:00
Roland Kaufmann
bce2199661 Allow to disable the inclusion of some libraries
Setting these options will cause these libraries to be dropped, even if
they can be found with automatic probes.
2013-02-11 22:37:56 +01:00
Roland Kaufmann
ed91d5be49 Dependencies' directories can be spec. on cmd. line
Instead of having to run `ccmake` or looking up which variables that
must be set, the configure driver is now enhanced to recognize options
that sets the installation directories for some of the dependencies.
2013-02-11 22:37:56 +01:00
Roland Kaufmann
79553333da Search for ERT and include in build if found
If the OpenMP flag is added to the build, this should probably be
propagated to the user programs as well.
2013-02-11 22:37:56 +01:00
Roland Kaufmann
2e7e07e17d Find module for Ensemble-based Reservoir Tools (ERT)
Although ERT is built with CMake, it does not yet provide a config-mode
module in its build directory. This also means that the find module must
be pointed to an installation, not a build directory.
2013-02-11 22:37:56 +01:00
Roland Kaufmann
23c98fd592 Allow package dir. to be specified with _ROOT suffix
If one sets the variable foo_DIR it will cause CMake to look for a
configuration file in that directory. In case we want to set the root
directory to an installation which doesn't have a config-mode CMake
module, and use the find module provided by ourself, we need a separate
variable that can hold the location of this directory and the most
common suffix for this seems to be _ROOT (an alternative is _PREFIX)
2013-02-11 22:37:56 +01:00
Roland Kaufmann
0dcde1f92e Ignore QtCreator project settings
QtCreator stores a file containing amongst other things the path to where
your build tree is and what parameters you used for the configuration
process. These data is user-specific and should not be stored in version
control.

If you open the project in QtCreator again after having made changes
to CMakeLists.txt outside of it, it may create a new user file which
should be ignored just like the original.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
c28aa9b9c3 Provide user-friendly front-end for efficient builds
We call the Make utility passing the right number of cores to do
efficient parallel compilation. The command to do this is simple,
but laborious to type every time. Add one to the number of nodes
to keep the CPU busy while one is waiting for I/O.

Put the entire compilation at a lower priority, both CPU and I/O-
wise. This way we don't kill the computer and the user can continue
working with other interactive tasks. If there are no other jobs,
then it will complete as before.

By having a front-end for the compilation, we can later switch to
the Ninja generator without disturbing the workflow.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
02a9e13d75 Compile and link Algebraic Multigrid, if available
If the path to Notay's AGMG library is provided through the cache
variable AGMG_ROOT, then include this in the build and enable the
test.

It would have been desirable to use the variable name AGMG_DIR for
consistency with the other modules, but unfortunately this name
will alter the functionality of CMake's find_package.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
590a963e43 Provide FC_FUNC macro like AC_FC_WRAPPERS in Autotools
CMake has a similar set of macros to FC_FUNC, but they of course use
another name. It also blatantly writes these macros to its own file,
overwriting anything else there (!).

This wrapper provides the same FC_FUNC interface as Autotools would
do, thus requiring no source changes.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
c387e04069 Don't expand variables for test
Use only expansion when comparing the variable against a literal, not
when comparing for logical true or if defined.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
7976b95983 Use native instruction set on build system
CMake files are in general not portable between systems anyway, so we
may as well take full advantage of the native instruction set.

There must be a companion option to switch this off in case anyone
wants to build a package for distribution.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
31fae50628 Probe for optimization flags before using them 2013-02-11 22:37:55 +01:00
Roland Kaufmann
9bd3f186d2 Do list cleanup in find routine
Although this amounts to some double work, it doesn't make the
configuration noticeably slower, and it ensures that the lists are
always cleaned up (in a proper way).
2013-02-11 22:37:55 +01:00
Roland Kaufmann
2fc5a6349e Probe for C99 standard available
Similar to the -std=c++0x flag for C++ code, we probe for, and add if
available, -std=c99 for C code, since the compiler may generate
different initialization code for this variant.

The reporting from the bundled CMake modules is not as polished as for
probing for C++ flags, but not bad enough to warrant rewriting the code
from scratch just to fix the output.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
0e88d99c50 Write version file so user can specify lower bound
With the version file present, a user program can depend on a certain
version of the library.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
9942dcc8d9 Install config mode CMake module at installation
find_package only searches for FindXxx-modules in the path specified by
CMAKE_MODULE_PATH; other paths are supposed to contain config-mode
modules (much like pkgconfig).

Generate the config-mode module in the installation directory using the
same template as is used for the one in the build directory, only
selectively swapping some directories in the relevant variables.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
e7d9abcd8e Allow directory to be set for config mode CMake files
If you run CMake with -Dfoo_DIR= pointing to a build tree, it should
now pick up the correct config mode module from there.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
944eaf43cc C++11 is only recommended, not required
If we don't have a C++11 compiler, we won't be able to build DUNE, but
opm-core is still usable with for instance UMFPACK. However, if it *is*
available, it should be used to improve the ABI compatibility with other
parts of the suite.
2013-02-11 22:37:55 +01:00
Roland Kaufmann
fc3941d982 Add compiler options that may make the builds faster
Sometimes compiler options can help doing faster builds; for GCC the
pipe option will help interleave the various stages of the build.
2013-02-11 22:37:54 +01:00
Roland Kaufmann
0b4a244a44 Compatibility script for Autotools addicts
This script enables the use of `configure && make && make install` for
those users who have this combination ingrained in their fingers or are
too busy to read the manual.
2013-02-11 22:37:54 +01:00
Roland Kaufmann
34138223e8 Install the library and headers
Enables running `make && make install` on a target system. Documentation
is not yet built or installed.
2013-02-11 22:37:54 +01:00
Roland Kaufmann
a4ea84cd89 Sources are named after library, not project
All targets in the project uses variables defined on a "project" basis
whereas only a specific target uses variables named after it.
2013-02-11 22:37:54 +01:00
Roland Kaufmann
d79c2d2fed Rename version variables 2013-02-11 22:37:54 +01:00
Roland Kaufmann
8cf610e53a Remove superfluous definitions 2013-02-11 22:37:54 +01:00
Roland Kaufmann
2d3ed1cc27 Write snapshot of probes to config-mode module
Put everything the user needs to link to the opm-core library into the
config-mode file, including result of probes. If this conflicts with
other packages, that is a configuration issue that must be resolved
anyway.

The advantage of doing it like this is that the user can build against
the library without knowing how it was configured; the only thing that
must be provided is the path to the config-mode module!
2013-02-11 22:37:54 +01:00
Roland Kaufmann
8234959abe Write config variables in either C++ or CMake syntax
We need the list of variables to put in config.h for the CMake config-
mode module; reuse the code that writes the list to config.h in the
first place to also write CMake-compatible lines.
2013-02-11 22:37:54 +01:00
Roland Kaufmann
8fddb7a879 Allow even empty lists of config vars
Modules that does not use the concept of _CONFIG_VARS will not have
exported anything, so we may end up with an empty list.
2013-02-11 22:37:54 +01:00
Roland Kaufmann
e62f4a1b69 Separate defines for this library from those of deps
This makes it easier to write this list to the config-mode module and
let it merge with those from dependencies in the user's program
(although that implies that we no longer pretend that inconsistencies
are not possible).

The convention that singular form contains values for this project
alone whereas plural form contains values for both this project and
dependencies, is used.
2013-02-11 22:37:54 +01:00
Roland Kaufmann
10d033698d Get linker flags from pkg-config if specified 2013-02-11 22:37:54 +01:00
Roland Kaufmann
3045092436 Specify dependencies as one list, including args
Allow arguments to be used on the list of dependencies, this facilitates
searching for things like e.g. Boost, and there is now only need for one
list since REQUIRED can be one of the arguments.
2013-02-11 22:37:54 +01:00
Roland Kaufmann
ccb85102e8 Use declarative list of dependencies instead of functions 2013-02-11 22:37:54 +01:00
Roland Kaufmann
00b3f9431d Provide functions to find packages in batch
Dependencies can now be declared as a list and passed amongst modules
since CMake does not (easily) support passing anonymous functions.
2013-02-11 22:37:53 +01:00
Roland Kaufmann
0deeef0127 Rename macro modules
Modules that starts with the prefix "Use" alters the build to enable
something by default, whereas modules that only provide functionality
is not common to start with that prefix.
2013-02-11 22:37:53 +01:00
Roland Kaufmann
88d635524c Search in Autotools variant of library directories too 2013-02-11 22:37:53 +01:00
Roland Kaufmann
275097ae34 Only add found libraries to test compilations
If the library is not found, we will now get a message that the test
program failed to link because of a missing symbol, instead of an error
message from CMake that we tried to add -NOTFOUND libraries.
2013-02-11 22:37:53 +01:00