Commit Graph

457 Commits

Author SHA1 Message Date
Andreas Lauser
51cb4f2cb8 Add exception handlers to all tutorials and examples 2013-09-05 12:28:04 +02:00
Andreas Lauser
a26483b51d Replace the ASSERT and ASSERT2 macros by assert 2013-09-03 15:27:08 +02:00
Bård Skaflestad
db1299cf0c Merge pull request #28 from rolk/028_eigen
Improve detection of the Eigen3 library
2013-09-02 01:53:51 -07:00
Roland Kaufmann
5b954096fd Search after new Eigen3 versions in sibling dirs
If we have checked out a newer Eigen3 directory in a sibling directory
to ours, assume that this is because the system version is obsolete and
that we want to use this one instead.
2013-09-02 10:08:32 +02:00
Roland Kaufmann
3c678f06e4 If given build tree as Eigen3 root, find source
Eigen3 is a template-library, so we must compile the source code
directly together with ours instead of linking to a library.

If the build script gives us the location of a "built" Eigen3,
meaning a directory in which CMake has been run, locate the true
source directory from the cache entries.
2013-09-02 09:47:53 +02:00
Roland Kaufmann
ae7dcf690a Merge pull request #23 from rolk/023_cmake
CMake rollup in anticipation of the 2013.09 release
2013-08-28 11:55:49 -07:00
Roland Kaufmann
f43d6e0019 Print version number in log together with location 2013-08-28 13:21:27 +02:00
Roland Kaufmann
84cc9f5f98 Always search for dune.module in no-arch lib-dir
The previous version may have ended up in lib64/ instead of lib/;
now we remove the arch-specific suffix from the path, and always
use the no-arch version.
2013-08-28 13:21:26 +02:00
Roland Kaufmann
a066aa519c Noarch lib-dir was only used in one wrong place
dune.module does not contain any paths to architecture-specific
binaries. It is therefore always installed in no-arch lib/ directory.
Thus, there is no need to have a variable for this, and there was
no other users of this variable either.
2013-08-28 13:21:26 +02:00
Roland Kaufmann
eb1086a2b8 Mimic Autotools way to specify non-standard Boost
If Boost is installed in say /usr/include/boost141 and
/usr/lib64/boost141, then there is no root you can specify to pick
them both up. However, whereas Autotools uses --with-boost and
--with-boost-libdir, FindBoost in CMake changes to using two different
variables: BOOST_INCLUDEDIR and BOOST_LIBRARYDIR. Using the header
directory for BOOST_ROOT will not work (in particularily not with
old CMake versions).
2013-08-28 13:21:25 +02:00
Roland Kaufmann
779e366f73 Special handling for some recognized env. vars.
CMake does not like that you specify the compiler with the environment
variables, instead preferring that you set them as cache variables.
This layer translate between the names of the the two.
2013-08-28 13:21:24 +02:00
Roland Kaufmann
82410bda3e Test ERT for a newer API level
We use an ERT version which needs to know whether at least this
function signature exists. The earlier implementation covers too
many versions.
2013-08-28 13:21:24 +02:00
Roland Kaufmann
ab8a507e49 Allow spec of not commonly rooted incl and lib dir
Header and library directory may be specified separately by using the
variables e.g. OPM_CORE_INCLUDE_DIR and OPM_CORE_LIB_DIR. These override
even the OPM_CORE_ROOT. This allows us to use a backported version which
uses versioned directory names.
2013-08-27 09:24:36 +02:00
Roland Kaufmann
8c71f4d75b Support installation in a versioned directory
If the option USE_VERSIONED_DIR is set to ON (default is OFF), then
most files are installed in a ${suite}-${label}/ subdirectory
(e.g. header files go in "/usr/include/opm-2013.03/"). This enables
us to easily install backports of newer versions on systems which
have a system package for an older one, without getting conflicts.
2013-08-27 09:24:35 +02:00
Roland Kaufmann
433d33e008 Remove bash4-isms from configuration script
Getting uppercase of a string can be done in a way that is compatible
with Bash 3.2. This creates a dependency on the `tr` utility, but I
reckon it will/can be available everywhere Bash 3.2 is.
2013-08-27 09:24:34 +02:00
Roland Kaufmann
5cc1f0a34c Use libc++ runtime if necessary for C++11 compliance
If we are using the Apple toolchain on MacOS X, we must use the
newer runtime and not the old GCC 4.2 fork, in order to get the
C++11 library features (such as std::shared_ptr).
2013-08-27 09:24:34 +02:00
Roland Kaufmann
e5d2b5994e Remove linker command from compiler command-line
There is no SuiteSparse headers or libraries in
/System/Library/Frameworks/Accelerate.framework on MacOS X, so adding
this directive won't contribute anything other than compiler warnings.
2013-08-27 09:24:33 +02:00
Roland Kaufmann
dcc917c2c4 Always keep debug bundle near executable on Mac OS X
There isn't a /usr/lib/debug directory as on Linux.
2013-08-27 09:24:32 +02:00
Roland Kaufmann
d43ff3c003 Strip debug symbols to separate file on MacOS X
The standard Xcode toolchain on MacOS X uses strip and dsymutil, not
objcopy as the GNU toolchain does.
2013-08-27 09:24:32 +02:00
Roland Kaufmann
fc040a44ed Refactor code to separate extensions from filename
The earlier code assumed that the version information always follows
the full file path; this code splits the path up into various parts
so that this may be changed.
2013-08-27 09:24:31 +02:00
Roland Kaufmann
cd771b7d3e Only install debug symbols if they are in separate file
If the strip utility is not present, debug symbols won't be in a
separate file and subsequently cannot be installed.
2013-08-27 09:24:30 +02:00
Roland Kaufmann
751296cf5f Report version of Mac OS X in configuration log
If we are building on Mac OS X, use the official operating system
version (e.g. 10.8) instead of the kernel version (e.g. 12.4).
2013-08-27 09:24:30 +02:00
Andreas Lauser
217db0dd31 avoid to make ALUGRID_PARALLEL_FOUND a list
because -- at least on one of my systems -- a list evaluates to false,
even if all entries are true...
2013-08-27 09:24:29 +02:00
Roland Kaufmann
3dbcb66a21 opm-autodiff needs filesystem component of Boost
Also, it really should be the same as the rest to make sure that we
pick up the right components when we look for the Boost library.
2013-08-27 09:24:28 +02:00
Roland Kaufmann
1002b55a2f Remove dependency on Boost::Signals
The functionality has been replaced with equivalents from C++11.
2013-08-27 09:24:28 +02:00
Andreas Lauser
a9b287f472 cmake: fix the SuperLU test
for me, it was completely broken. (it worked fine if you did not want
to use it, though.) Now it (hopefully) follows the standard OPM
variable naming conventions, allows to use the internal SuperLU BLAS
library, and works fine if superLU is not installed on a system-wide
basis.

v2: cache the POST_2005 variable to make writing it to config.h more
    reliable (on my kubuntu 13.04 system it did not work without it)
v3: re-add a proper "post 2005" check from newer versions of the dune tests
2013-08-27 09:24:27 +02:00
Andreas Lauser
2a92529ff2 fix the test for the quadmath library
Seems like I forgot to include the "CheckCSourceCompiles" macro before
using it. Since it worked for me before, I'm wondering what made this
happen. Anyway, it should now work correctly in all cases.
2013-08-27 09:24:26 +02:00
Roland Kaufmann
972f8cdf0a Allow build tree of SuiteSparse to be used as root
With this changeset, the build tree of SuiteSparse can be used as the
root; the package does not have to be installed.
2013-08-27 09:24:26 +02:00
Andreas Lauser
ed5f17a471 add opm-material to the eWoms prerequisites
this is needed by the imminent switch of eWoms to the OPM build
system.
2013-08-27 09:24:25 +02:00
Roland Kaufmann
5d5e18c2ce Mark known feature variables as used
Some features, such as the Fortran wrappers, are enabled by options,
and it may be usable to have those set in a common definition file.

However, as these features are included conditionally based on use,
their option variables may not exist in other projects, giving a CMake
warning for them.

Here we list such variables too. Reading them at the end corresponds
to the Autotools convention of ignoring unknown --enable-xxx options.
2013-08-27 09:24:24 +02:00
Andreas Lauser
fd781af125 cmake: do not quote variables for config.h anymore
v2: incorporate Roland's nitpicks (I hope)
v3: It was decided that it's better to change the default behavior
v4: make sure the CMake syntax is correct even if the value of the
    variable contains spaces (if it contains double quotes it's a
    different matter, but that's pretty much a corner case, IMHO)
v5: properly escape backslash and double quote characters in the cmake
    syntax
2013-08-27 09:24:23 +02:00
Roland Kaufmann
a64118cb81 Simplify creation of Fortran function wrappers
The old version invoked a Fortran compiler to figure out the bindings
necessary to link to a Fortran function. This creates a dependency on
having a Fortran compiler, even though the project may not have any
Fortran source it needs to compile!

Also, the Fortran compiler that is installed on the system may not be
the same as was used to compile the library anyway, so we are not even
sure that this is correct!

Furthermore, FindLAPACK operates on the assumption that names in that
library is suffixed with a single underscore, so if that is not correct,
we won't find any of the functions in that library anyway!

Thus, this patch enables us to assume that appending an underscore is
the right thing to do without using the compiler. This option is off by
default, but can be activated with USE_UNDERSCORING=ON (named after the
GFortran option).
2013-08-27 09:24:22 +02:00
Roland Kaufmann
9d19b116d7 Issue a CMake warning if client project is incompatible
This puts a test into the ${project}-config.cmake file which warns
if the client project is built with a variable which is incompatible
with the build of opm-core.

Consider this minimal project:

    cmake_minimum_required (VERSION 2.8)
    set (HAVE_MPI 1)
    find_package (opm-core)

If linked with `-Dopm-core_DIR=` path to an opm-core tree which is
build *without* MPI-support, this will issue a warning when building
the client project.

This doesn't catch all cases (if a variable isn't defined, we cannot
know if it is an omission or if it has intentionally been left blank),
but at least it catches some.
2013-08-21 22:16:31 +02:00
Roland Kaufmann
aa07341edb Only require METIS if ALUGrid is built for parallel
If we have a parallel ALUGrid, then we must also link with METIS. If
METIS is not available, then parallel ALUGrid should be disabled. If
we have a serial-only ALUGrid, then METIS is not required.
2013-08-21 22:16:11 +02:00
Roland Kaufmann
92ea4c55a2 Don't search for disabled packages
Setting CMAKE_DISABLE_FIND_PACKAGE_xxx flag should make find_package
not doing anything, but this does not seem to work with older versions
of CMake. Anyway, we can test this flag and make sure that we don't
call find_package in that case.

Also includes a check for both upper- and same-case versions of found
flag, as some modules, most notably Boost, does not set the upper-case
version of their _FOUND flag; this tests for both.
2013-08-21 22:16:06 +02:00
Roland Kaufmann
fab7284717 Add support for Eigen3 in Autotools compatibility layer 2013-08-20 20:48:24 +02:00
Roland Kaufmann
dec561bb44 Allow found-variable to be named as package
Boost does not set the BOOST_FOUND variable to indicate that the
package is found (as it would if it had used the usual routine
find_package_handle_standard_args), but rather Boost_FOUND. This
patch tests for that condition, and print some more helpful debug
messages if a prerequisite is missing.
2013-08-19 21:36:59 +02:00
Roland Kaufmann
3ff19f011a Propagate REQUIRED and QUIET according to parent level
If an optional package require further packages, those packages should
not be marked as REQUIRED because CMake will then terminate the
configuration if it is not found (although it is transitively optional).

Conversely, we should be able to specify REQUIRED prerequisites for
REQUIRED packages and have a failure cascade up to termination.

This changeset allows us to specify REQUIRED or not in the list of
prerequisites, and have OpmPackage sort of whether it should be honored
or not.
2013-08-19 20:01:25 +02:00
Roland Kaufmann
ae727487f5 Only search for a package again if not found
If it is already found, most packages sets a flag that makes it exit
immediately anyway. We usually cannot rerun find_package to get another
combinations of modules. Here we check the flag before we start looking
for the package to avoid the endless stream of messages.
2013-08-19 20:01:25 +02:00
Roland Kaufmann
b3947b0ff3 OPM-Material module must have DUNE Common and DUNE ISTL 2013-08-19 20:01:24 +02:00
Roland Kaufmann
c3249a256a Set standard variables for package after probing
Standard variables must be set in order for the package to be picked
up with the OpmFind/OpmPackage dance.
2013-08-19 20:01:23 +02:00
Roland Kaufmann
1b953dce5f Trim unnecessarily required config vars
The modules declare which configuration variables they need to have
present in config.h, not only their own but also defined in projects
using them.

However, a lot of these variables are not actually used in the headers!

This changeset removes all HAVE_XXX variables which is not present in
any opm/*.h* file in these projects, and thus there is no need for the
client to specify.

Note that only the variables used by the module *itself* should be
listed; the build system will setup the complete list from the
prerequisites.
2013-08-19 20:01:23 +02:00
Roland Kaufmann
fa32d2a03e Put HAVE_DYNAMIC_BOOST_TEST in config.h for tests only
This define is used by the unit tests; there is no reason why it should
be on the list that must be provided by other projects that use our
headers (the other projects don't use our tests).
2013-08-19 20:01:22 +02:00
Roland Kaufmann
6537f63307 Require the newer 3.1 version of Eigen 2013-08-17 00:04:05 +02:00
Roland Kaufmann
09d2f435f8 Add a small bootstrapper to locate build system
Currently this bootstrapper only finds the macros that are located
in the cmake/ tree in this project. Projects that don't carry their
own build system can specify search locations here.
2013-08-16 23:55:45 +02:00
Roland Kaufmann
c34a5700eb Search for directory containing build scripts
Currently only the source tree is "searched", but the template could
be expanded to look in another/more locations (or be specified
explicitly on the command-line with a --with-opm-macros= option)
2013-08-16 23:55:44 +02:00
Roland Kaufmann
dcc972f128 Allow source location to be overridden
By default the configure script assumes that the source is located
relative to the script itself. By allowing this to be overridden, the
script can be shared by other projects, each passing their own location
as an extra parameter.
2013-08-16 23:55:44 +02:00
Roland Kaufmann
e4a345a648 Use OPM_MACROS_ROOT to locate build scripts
By using a separate variable for this we can easily grep for where
the build system depends on its own location, and also change the
policy regarding this later.

Note that there is no opm-macros module; this is a "psuedo"-module
which links to an additional one (currently, the one we're in)
2013-08-16 23:55:43 +02:00
Roland Kaufmann
0f841e1bdf Allow adding project-specific install targets
If a project needs to install something that is very specific and not
in the general build, it can use this hook to setup additional targets.
2013-08-16 23:55:42 +02:00
Andreas Lauser
15631d2ab1 FindALUGrid.cmake: incorperate Roland's comments to PR 317 2013-08-16 23:55:42 +02:00