Commit Graph

85 Commits

Author SHA1 Message Date
Roland Kaufmann
79f64d2c16 Be more flexible about version number quoting
Some versions of libtool write quotes around the version number, some
do not; we must handle both cases.
2013-02-11 23:08:28 +01:00
Roland Kaufmann
ae6e5314e3 Remove hardcoded project names and directories
Everything is now set through variables, which means that we can
change the name of the project by just altering the header.
2013-02-11 23:08:28 +01:00
Roland Kaufmann
99f2a6e55f Output the name of the libtool archive generated
Enables us to take of this file in a custom clean rule.
2013-02-11 23:08:27 +01:00
Roland Kaufmann
d6b245f549 Explicitly specify language for precompiled headers
This will hopefully guide some (buggy) compiler variants to not start
interpreting the header as a full program, or at least give a more
sensible error message.
2013-02-11 23:08:27 +01:00
Roland Kaufmann
097068f9c1 Move now generic templates into cmake/ directory
Templates can now be reused across projects. The output files are still
put in the root of the output tree because that is where the client
programs will look for them.
2013-02-11 23:06:39 +01:00
Roland Kaufmann
f883d52f0f Make template instantiatable for multiple projects
The name "opm-project" is replaced by the real name of the project.
2013-02-11 23:06:39 +01:00
Roland Kaufmann
2f20314ffb Pick up description from one place 2013-02-11 23:06:39 +01:00
Roland Kaufmann
66772d4819 Move template to designated cmake/ directory 2013-02-11 23:06:38 +01:00
Roland Kaufmann
45e00d88d7 Check the current commit of the project source code
Knowing which commit is being built and if there is any local
modifications to it can be of great help to pinpoint build problems.
2013-02-11 23:06:38 +01:00
Roland Kaufmann
33f3bc29e7 Allow in-source builds of ERT in sibling directory
The source code of ERT is located in a devel/ subdirectory, but it is
not usual (?) to have this structure in a separate build directory as
well. If you however build everything in the same directory as the
source code, then this sub-directory needs to be accounted for.
2013-02-11 23:06:38 +01:00
Roland Kaufmann
c28950c0f8 Link to core function to get more realistic test
Using umfpack_dl_solve as a test function increases the chance that the
probe will not be able to link successfully if it has not found all
libraries necessary (to link other than trivial test programs).
2013-02-11 23:06:38 +01:00
Roland Kaufmann
2b7e3f8759 Generate libtool archive (.la) files
These files are text files which specify which platform specific
libraries we should be looking for. We need libtool installed to
use them, but they can be generated pretty inexpensively from the
CMake script itself.
2013-02-11 23:06:38 +01:00
Roland Kaufmann
6f3a7baccd Add standard variables/location hints
There is a convention that one can do `pkg-config --variable=includedir`
and have it return the path to the source files (even if that should
have been taken care of by options in --cflags).
2013-02-11 23:06:38 +01:00
Roland Kaufmann
ae14059a15 Only write source path line once
If more than one match is written, then DUNE_CHECK_MODULES will return
several matches, which becomes a syntax error on the resulting command-
line. Thus, check if there is a match before writing anything.
2013-02-11 23:06:38 +01:00
Roland Kaufmann
46975fc130 Enable building as a link in dunecontrol chain
Dunecontrol scans the module directory for certain files and phrases
which must be present if the project can be used as a dependency for
other DUNE modules.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
fdff36fcbf Use full set of dependencies when test compiling
The old implementation erraneously used only the first argument that was
passed to the testing procedure due to the way lists are passed in CMake
when unquoted. Thus, the test failed for SuiteSparse >= 4.0 which needs
more than one dependency.

Also add dependency to BLAS and LAPACK which was hidden because the
caller already included these itself.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
718fce9e2a Add realtime library on Linux, if SuiteSparse >= 4.0
Functions in the helper library is dependent on librt
2013-02-11 23:06:37 +01:00
Roland Kaufmann
4dbefc603a Look for packages from underneath a single root
Previous implementation had a separate search path for headers and for
the library, which in the case of "RedHat-multiarch" made it miss the
library (it was looking for /usr/lib/lib64 instead of /usr/lib64); the
new version starts looking from /usr.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
5772f7a5c2 Explicitly specified paths should replace predefined ones
We don't want a typo in any of those to accidentially make the
configuration pick up the system libraries instead.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
668cf14059 Add config library new to SuiteSparse 4.0
SuiteSparse 4.0 implements many of its internals in a separate helper
directory which must also be linked if this is present.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
f89ad15fe9 Include CMakePushCheckState on our own
Functions in this library was made available by other unrelated
modules, making this file unusable on its own.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
f8d047d4db Try to do without unnecessary dependencies
UMFPACK is by default dependent on CHOLMOD, but on some systems it is
compiled with -DNCHOLMOD; in those cases we should not try to link in
the library -- it may not be available and in any cases it is not used,
so it is just a superfluous dependency.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
172e9b3e33 Bail out if none of the required components are found
The way the test was written earlier, it would accept if it found
components that were transitively pulled in even if the originally
requested component was not!
2013-02-11 23:06:37 +01:00
Roland Kaufmann
ceeba95ba7 Assume that UMFPACK requires CHOLMOD by default
At this time no probe is added to check if an UMFPACK without dependency
to CHOLMOD is installed; thus if you need/want UMFPACK, you'll have to
go for the entire SparseSuite.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
39758ab13b Revert clever setting of version number in dune.module
dunecontrol will read the dune.module file first, before calling any
configuration files; thus it cannot be initialized from the script
but the version numbers must be hardcoded here and updated manually.
2013-02-11 23:06:37 +01:00
Roland Kaufmann
ad4e9064f7 Write pkgconfig files as well as CMake
Note that using pkg-config is NOT recommended because of:

1. It doesn't know which language you are using, so language-specific
   options such as -std=c++11 or -std=c99 cannot be passed along. Yet,
   the build will corrupt if you don't get these correct.

2. It has no means of communicating which defines that should be set
   in config.h, effectively disabling them all, possibly leading to
   inconsistencies between the library and the executable.
2013-02-11 23:06:27 +01:00
Roland Kaufmann
7c1568311e Multi-arch support in writing config mode file 2013-02-11 22:38:02 +01:00
Roland Kaufmann
5ed1aa37f0 Move writing of config module to library routine 2013-02-11 22:38:02 +01:00
Roland Kaufmann
5aa7def08d Search in sibling directories if no other version found
Thus, if you checkout projects in a common directory, they will find
eachother.
2013-02-11 22:38:02 +01:00
Roland Kaufmann
61cdf5c1d6 Search for libraries on multi-arch distributions 2013-02-11 22:38:02 +01:00
Roland Kaufmann
2e1f2f3ffb Search for ERT library in updated locations
ERT project has recently changed the output locations due to packaging
efforts.
2013-02-11 22:38:02 +01:00
Roland Kaufmann
a0e0535512 Module to prune unnecessary libraries from link
On Linux all libraries that are specified on the command-line will be
referred to in the resulting binary. There may be find modules which
just adds everything to satisfy every possible dependency; we want to
discard those unnecessary libraries.
2013-02-11 22:38:01 +01:00
Roland Kaufmann
dc92805d9a Safe-guard against empty directories
CMake will raise an error if you try to remove something from an
unset variable (whereas removing something from an empty list "" is
fine). If the user doesn't have the appropriate library, the search
will turn out empty, and the configuration will fail with a syntax
error instead of a message that the library is not found.
2013-02-11 22:38:01 +01:00
Roland Kaufmann
e0e1a24edd Module to precompile headers
This CMake module will set up a target for compiling a set of headers
which can then be added to compilation modules to speed up compilation.

A separate target is created because the function doesn't know all the
sources of a target, and to reuse the precompiled header across several
targets that share the same characteristics (such as unit tests).
2013-02-11 22:38:00 +01:00
Roland Kaufmann
8b4a5969c0 Return name of debug files that has been stripped
These files can then be installed on the system, too.
2013-02-11 22:38:00 +01:00
Roland Kaufmann
e46d950739 Provide backward-compatibility modules for older CMakes
BLAS module originally required Fortran to be enabled, newer module
doesn't; LAPACK module had some spelling errors that prevented it
from working; and cmake_push_check_state() is not available before
2.8.6.
2013-02-11 22:38:00 +01:00
Roland Kaufmann
6d62476eaa Make without generator expressions
These are only supported from CMake >= 2.8.4; however, we can replicate
the functionality be smartly query target properties.
2013-02-11 22:37:59 +01:00
Roland Kaufmann
c0c42ec453 Find module for TinyXML
This reuses most of the OPM infrastructure, even if it isn't an OPM
project. Thus it probably have little value outside the OPM family.
2013-02-11 22:37:59 +01:00
Roland Kaufmann
107019d22b Only clean up config variables if there actually is any 2013-02-11 22:37:59 +01:00
Roland Kaufmann
7227bbf801 Better error messages on missing items
The old version only said that _req_vars was not found; now you get to
see the actual variables that are missing.
2013-02-11 22:37:59 +01:00
Roland Kaufmann
c3f2dad1c6 Transitively make dune-common optional if dune-istl is
CMake fails if a package that was required is not found, even if the
one module finding that package was optional itself.
2013-02-11 22:37:59 +01:00
Roland Kaufmann
2c31bee5dd Support arch.-indep. libraries files for 64-bit sys.
Fedora uses lib64/ for architecture-independent files on 64-bit systems,
whereas Debian (which is multi-arch for binaries) uses lib/
2013-02-11 22:37:59 +01:00
Roland Kaufmann
aae0d2b0ad Supplement GNUInstallDirs to support multi-arch
Debian object code libraries are in directories which include the
platform name to allow several of these to co-exist. Other distros
such as Fedora uses a simpler naming scheme (e.g. "lib64/") which
is more backward-compatible.
2013-02-11 22:37:58 +01:00
Roland Kaufmann
5a14e481fb Let SuiteSparse path be specified without config mode
Use the _ROOT suffix to direct the CMake module to use a particular path
to the SuiteSparse installation without also triggering config mode (by
convention CMake uses Foo_DIR as the name of the variable which
specifies where to look for another *project*).
2013-02-11 22:37:58 +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
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
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
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