Commit Graph

237 Commits

Author SHA1 Message Date
Andreas Lauser
eed47decf2 tweak the configure script
we should recognize the --with-{alugrid,metis} options...
2013-08-16 23:55:41 +02:00
Andreas Lauser
044e07be58 make the FindALUGrid module compatible with the OPM build system 2013-08-16 23:55:40 +02:00
Andreas Lauser
00c5fb427c add cmake module to detect ewoms 2013-08-16 23:55:40 +02:00
Andreas Lauser
00344dc20f Add HAVE_CXA_DEMANGE config.h variable to Finddune-common.cmake
This will make Dune::classname usable on Dune master. (the 2.2 release
should be fine even without it.)
2013-08-16 23:55:39 +02:00
Andreas Lauser
b5c27dbe7d Finddune-grid.cmake: test for ALUGrid and METIS
ALUGrid is needed to avoid unresolved symbols if dune-grid was
compiled with it. METIS is used by the parallel version of
ALUGrid. (Although it is not open source...)
2013-08-16 23:55:38 +02:00
Andreas Lauser
9ef6a91bb5 add cmake modules to find ALUGrid and METIS 2013-08-16 23:55:37 +02:00
Andreas Lauser
1ae9e7cb89 CMake: add module for dune-localfunctions 2013-08-16 23:55:37 +02:00
Roland Kaufmann
2789809858 Publicly depend on version of dune-grid
The interface of the class PersistentContainer changed between DUNE
2.2 and DUNE 2.3 in an incompatible way, so we need to present
different versions of the class depending on the version of DUNE linked
with. This changeset adds the version variables for dune-grid to the
list of publicly necessary #defines that must go into using
dune-cornerpoint.

Notice that this will cause the definition of DUNE_GRID_VERSION_XXX
to be added to the flags list of dune-cornerpoint. This can be seen as
either a bug or a feature. If you try to link first dune-cornerpoint to
one version and then to another version of DUNE later, there is a very
good chance that you'll end up with problems anyway.
2013-08-16 23:55:36 +02:00
Roland Kaufmann
8ec655e321 Remove support for AGMG from the build system
AGMG is now under a closed-source license, meaning that results
obtained with this solver is not freely reproducible by others.
Its use is therefore discouraged.

As of version 2.3, the DUNE AMG parts are competitive, so there
is a free and open alternative.
2013-08-16 23:55:35 +02:00
Roland Kaufmann
56b910e2ce Use parallel version if and only if MPI is installed 2013-08-16 23:55:34 +02:00
Roland Kaufmann
7e992a2894 Enable use of parallel version of MUMPS
If we have enabled MPI, then we must call MPI_Init and MPI_Finalize
in the program anyway so we may as well use the parallel version of
MUMPS.
2013-08-16 23:55:34 +02:00
Roland Kaufmann
30a7e953a7 Use system-provided MUMPS library for AGMG
This require us to compile in a small glue module which maps the
name of the internal routine to the system routine.
2013-08-16 23:55:33 +02:00
Roland Kaufmann
ff9da40f32 Make opm-core pick up AGMG through the standard list 2013-08-16 23:55:32 +02:00
Roland Kaufmann
6b5ce2e5a5 Allow packages to add source code to the project
By returning a ${package}_SOURCES variable with the names of the code,
it will be propagated to ${project}_SOURCES and subsequently compiled
into the library.

AGMG (Algebraic Multigrid) uses this functionality.
2013-08-16 23:55:32 +02:00
Andreas Lauser
a2d4a32736 make the build system link to the "quadmath" library if it is supported
Thanks a lot to Roland Kaufmann for the support.
2013-08-16 23:55:31 +02:00
Andreas Lauser
cd6f18ed90 add a cmake check for the abi::__cxa_demangle() function
this was also forgotten. sorry...
2013-08-16 23:55:30 +02:00
Andreas Lauser
9f5ab8e257 add test for <type_traits> to FindCXX11Features.cmake
I fogot this one yesterday...
2013-08-16 23:55:30 +02:00
Andreas Lauser
694fc0c98a add and use CMake modules for valgrind client requests and quadruple precision math 2013-08-16 23:55:29 +02:00
Andreas Lauser
6ff3b56b49 also test for std::unique_ptr 2013-08-16 23:55:29 +02:00
Andreas Lauser
113238badb add a few config.h macros useful for dune-common 2013-08-16 23:55:28 +02:00
Andreas Lauser
999d198181 detect the presence of std::shared_ptr
since GCC 4.4 supports it, make it mandatory as well...
2013-08-16 23:55:27 +02:00
Roland Kaufmann
bddcff89f2 OPM Porsol now depends on OPM Material
In the new build scheme, the prerequisites of each module is declared
in this file as the canonical version, and everything else includes it.
2013-08-14 23:39:06 +02:00
Roland Kaufmann
264f3b0747 Fix bug in determining if directory is found
The parenthesis is to make it less ambiguous how the boolean expression
should be evaluated.
2013-08-14 23:39:06 +02:00
Roland Kaufmann
49801f2edf Make available version numbers for these modules 2013-08-14 23:39:06 +02:00
Roland Kaufmann
821a53bfbb Probe DUNE module version number from installation
Figure out where the closest dune.module is, and parse it for
information. The defines are added to config.h, so that our code
may behave differently for various versions available.

It actually works for opm-core 1.0 as well, but don't tell anyone;
we rather want people to use opm/core/version.h instead.

If a module has been backported and installed to a directory which
also contains the version number, e.g. /usr/include/dune-2.3, to
avoid clashing with an existing version in /usr/include, then this
part is now stripped from the include directory and added back to
the lib directory where we are looking for dune.module
2013-08-14 23:39:06 +02:00
Roland Kaufmann
81699b561a Provide hook to configure getting other's version
This hook together with the bundled convenience macro makes it
possible to add the version of another module to config.h using
code like this:

macro (config_hook)
  opm_need_version_of ("dune-common")
endmacro (config_hook)
2013-08-14 23:39:06 +02:00
Roland Kaufmann
de5d5ec7dc Create a set of config variables for implementation
The config variables in _CONFIG_IMPL_VARS are only written to config.h
and not the .pc or -config.cmake files. They can thus only be used by
the implementation files and not the headers. Use this set to avoid
exposing the variables to other projects, when it is likely that a
probe used by that other project may turn up a different result.
2013-08-14 23:39:06 +02:00
Roland Kaufmann
3d366d9cdf Only configure libtool for libraries that exist 2013-08-14 23:39:06 +02:00
Roland Kaufmann
8d3b0fed71 Only build before library target if there is any 2013-08-14 23:39:06 +02:00
Roland Kaufmann
022eb51c8b Allow PCH option to be on even if there is no library 2013-08-14 23:39:06 +02:00
Roland Kaufmann
becba8e93c Upgrade Findopm-material to use separate prerequisite list
This will now be included both by the find module and by the project
file itself.
2013-08-14 23:39:06 +02:00
Roland Kaufmann
6449b08094 Module mode CMake probe for opm-material 2013-08-14 23:39:06 +02:00
Andreas Lauser
a79fcc063a Build system: make it work for modules which do not need libraries 2013-08-14 23:39:05 +02:00
Roland Kaufmann
2ebfa92f4f Have distclean target keep up with build improvements
If you run `cmake --build . -- distclean` all generated files will
now be gone! This adds the files that have been introduced in later
improvements to the build system.
2013-08-14 23:39:05 +02:00
Roland Kaufmann
52a36f77fa Recognize Clang to be a GCC-compatible compiler
Clang aims to be compatible with GCC when it comes to command-line
parameters. Where we enable functionality based on the presence of
a GCC-compiler, we can use the same functionality with Clang.

This patch introduces a new variable CXX_COMPAT_GCC which is true if
the compiler handles the same options as GCC, and this variable is
subsequently used in tests instead of CMAKE_COMPILER_IS_GNUCXX (which
remains if we need to test if we really have GCC, e.g. for version)
2013-08-14 23:39:05 +02:00
Roland Kaufmann
1951f796af Enable support for Ninja build generator
Use the Ninja build generator if '--enable-ninja' is passed on the
command line to ./configure (or of course if -GNinja is passed
directly to CMake).
2013-08-14 23:39:05 +02:00
Roland Kaufmann
354158207d Provide a define for having OpenMP 2013-08-14 23:39:05 +02:00
Roland Kaufmann
8cb420bb7f Only make target if there is any source files
If there is no source files, we set a blank target to signal to the
other components of the build system that they shouldn't be looking
for a library.
2013-08-14 23:39:05 +02:00
Roland Kaufmann
60eb89eb57 Only include library if there is one 2013-08-14 23:39:05 +02:00
Roland Kaufmann
0b6d2f2607 Don't install debug syms for a library that isn't there 2013-08-14 23:39:05 +02:00
Roland Kaufmann
78118e21e3 Support compiling files that are in the attic
Since these files are not actively maintained, we don't assume that
the project actually has any, nor are they part of the default build.
2013-08-14 23:39:04 +02:00
Roland Kaufmann
522acace31 Use new style of prerequisite declaration
The prerequisites are now declared in their own file, so it can be
included by the main system. There is thus only one canonical place
where the list of prerequisites exist.
2013-08-14 23:39:04 +02:00
Roland Kaufmann
188925f3cd Provide CMake find module to locate opm-verteq 2013-08-14 23:39:04 +02:00
Roland Kaufmann
166033ce1f Further classify source files into languages
Other modules (notably the precompiled header one) may set properties
directly on the source file; we need to separate them into categories
for which language they belong to.
2013-08-14 23:39:04 +02:00
Roland Kaufmann
6e2084cf15 Safe-guard against version mismatch
The version declared for the build system (in dune.module) is checked
against what is in the source (e.g. opm/core/version.h) and if these
don't match, then issue an author warning.

This will help us keep the two version numbers in sync., since it
becomes very obvious when we don't. The benefit for this is to not have
the build system start mucking with the code just to dump some static
information in there.
2013-08-14 23:39:04 +02:00
Roland Kaufmann
7b96599c5b OPM Core uses C++11 features as of commit 562bcf2 2013-08-14 23:39:04 +02:00
Roland Kaufmann
ae53847e52 Use RUNPATH in installed library by default
When checking out from source code, the paths that were used to
configure the project should be carried on to the installed binary,
so the same libraries are used without much effort.

By using RUNPATH instead of (just) RPATH, it can be overridden with
LD_LIBRARY_PATH if the user so desires.
2013-08-14 23:39:04 +02:00
Roland Kaufmann
0bac3406dd Only display an error message if C++11 support is noted as REQUIRED 2013-08-14 23:39:04 +02:00
Roland Kaufmann
046a4e6048 Make project buildable also without Git
If Git is not found, revert to just dumping the label into the code.
(We currently have no way of getting the SHA into the tarball).
2013-08-14 23:39:04 +02:00
Roland Kaufmann
c52e62ce88 Probe again later if ERT isn't found now
If we write a blank value into the cache, we tell CMake that ERT isn't
found and it won't check again. If we delete it from the cache in case
we didn't find the directories, then CMake will run the find module
again the next time we configure. Just probing for directories is cheap
so this is no problem. This allows us to install ERT, do a reconfigure
and it will then be picked up by the build system.

If we find ERT and it doesn't compile properly, a blank value will still
be written, and it won't try again the next time, so you must wipe the
cache if you *upgrade* ERT into a newer and more compatible version.
2013-08-14 23:39:04 +02:00
Roland Kaufmann
51c31938b9 Let the AutoTools script disable tests and samples also 2013-08-14 23:39:04 +02:00
Roland Kaufmann
10bc6cd081 Add a switch for examples similar to the one for tests
Running tests during development at least has a purpose, but compiling
all the samples *every* time is just an annoyance.
2013-08-14 23:39:03 +02:00
Roland Kaufmann
7900b3bbfc Disable testing if BUILD_TESTING is switched off
This is an "official" switch for disable testing; our own code which
adds tests should adhere to it. (It is added by CTest)
2013-08-14 23:39:03 +02:00
Roland Kaufmann
48a0099190 Don't update version info in Debug mode
It gets tiresome to rebuild the project everytime one makes changes to
any of the unit tests. We don't likely publish results based on the
debug code anyway, so tracking the version number there is not such a
pressing issue.
2013-08-14 23:39:03 +02:00
Roland Kaufmann
e8e310dfba Make sure that version info is updated before building code
Otherwise, the library may be declared "done" before the version number
process have had any change to touch files it depends upon. This ensures
that the version number is correct before we start building the library.
2013-08-14 23:39:03 +02:00
Roland Kaufmann
be7b392690 Write version information into header file
Akin to config.h, we write project-version.h whenever the VCS sha hash
of the project changes. This file can then be included to embed this
into the project. Since this changes more frequently, we choose another
file than config.h. Care is also taken to not rewrite the header if the
information doesn't change, but the project is rebuilt.
2013-08-14 23:39:03 +02:00
Roland Kaufmann
d16fbf463e Read the label from project info 2013-08-14 23:39:03 +02:00
Roland Kaufmann
76eaf3fc22 Strings must contain ONLY numbers to be integers
The old pattern matched if there was an integer (digit) in the string;
it would have to be all non-digits to be quoted.
2013-08-14 23:39:03 +02:00
Roland Kaufmann
6fa44b6f23 Make sure CMake is re-run if dune.module changes
Version number in this module is included in the name of the library;
if we make changes to dune.module, it should do a complete reconfigure.
2013-08-14 23:39:03 +02:00
Roland Kaufmann
7953a0cdad Read project properties from dune.module
We cannot generate dune.module because that file is read by dunecontrol
before the build starts. It therefore make sense to let it be the
original and let the build system read it instead of duplicating the

This module is a adaption of Andreas Lauser's OpmParseDuneModule
in opm-material, modified to handle the more sparse info provided by
the other modules as well.
2013-08-14 23:39:03 +02:00
Roland Kaufmann
43b2929825 Eliminate _MODULE_DIR variable
It is only used in one place, where it can easily be replaced by its
expansion. The reason for removing it is that it depends on the name
of the project, and I intend to read this using a routine it the very
directory it is including, hence the need for a different approach.
2013-08-14 23:39:03 +02:00
Roland Kaufmann
f856de9817 Parse RHEL5 linker strings better 2013-08-14 23:39:02 +02:00
Roland Kaufmann
44764454a2 Print linker version to log 2013-08-14 23:39:02 +02:00
Roland Kaufmann
b72ebed8c2 Add function to detect linker version
The linker that is used (ld vs. gold for instance) is often hidden
when using the compiler as a front-end (to include the correct
runtime libraries).

These functions enables us to probe the linker version and reports
its finding in the log.
2013-08-14 23:39:02 +02:00
Markus Blatt
cc0631cd65 Adjusts macro documentation to recent change. 2013-08-14 23:39:02 +02:00
Roland Kaufmann
adb57cdd6c Include file list from top-level instead of module-level
Increase the visibility of the source file name include by no longer
putting it in a module, but rather by including it in CMakeLists.txt
2013-08-14 23:39:02 +02:00
Roland Kaufmann
6dae7cf379 Don't include prerequisites here; do it more explicitly
Developers that are working to familiarize themselves with OPM will
probably start out in CMakeLists.txt to figure out where the project
declare its dependencies, thus the list should be referred to from
there instead of inside one of the sub-modules.
2013-08-14 23:39:02 +02:00
Markus Blatt
b2006496c6 Change marker EXCLUDE_ALL to EXCLUDE_FROM_ALL in opm_compile_satellite
Previously, when passing EXCLUDE_ALL to opm_compile_satellite this
resulted a cmake error:

CMake Error at cmake/Modules/UseDebugSymbols.cmake:71 (get_target_property):
  Cannot find source file:

    EXCLUDE_ALL

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx
Call Stack (most recent call first):
  cmake/Modules/OpmSatellites.cmake:77 (strip_debug_symbols)
  CMakeLists.txt:176 (opm_compile_satellites)
2013-08-14 23:39:02 +02:00
Roland Kaufmann
1196201046 Remove the project parameter for the customization hook
The hooks are meant to be project specific, and should therefore
either know their own name or at least have access to a variable with
that name in it.
2013-08-14 23:39:02 +02:00
Roland Kaufmann
b0c5549e30 Common code for building OPM library modules
Most of the OPM libraries follow the same template; this include file
contains all the common code.
2013-08-14 23:39:02 +02:00
Roland Kaufmann
4b305a0822 Get prerequisites from a separate "header" file
Note that the variable containing the dependencies must be expanded
inside quotes; otherwise the list will spill into the argument list!
2013-08-14 23:39:02 +02:00
Roland Kaufmann
25ae6d5cb7 Notify callbacks when a timestep has completed
Client code can do additional processing for the output of each
timestep.
2013-08-14 23:39:02 +02:00
Roland Kaufmann
e5d5c40875 List prerequisites for modules in a separate file
This file can be included both in the project itself, and also in the
find module for the library, so that the list of dependencies can be
maintained in only one place.
2013-08-14 23:39:01 +02:00
Bård Skaflestad
56db862baf Add CMake backwards compatibility for version < 2.8.3
Add features that aren't available in early versions of the 2.8.x
release series, enabling use of 2.8.0 if needed (e.g. Ubuntu 10.04)
2013-08-14 23:39:01 +02:00
Roland Kaufmann
9ee29561c8 Recognize lib dirs that may be used later
This let you specify a bunch of directory names on the command line
to *all* packages, without getting annoying warnings that they are
defined but not used.
2013-08-14 23:02:40 +02:00
Roland Kaufmann
7bf82f96b2 Disable link-time, whole program optimization
When using LTO, the linker calls back to the compiler to figure out
where a certain symbol is defined. However, in many versions there
is apparently a bug that is triggered if a template in inlined in
both a used library and in the main program, but with different
versions of the compiler. The Boost exception class is particular
prone for this.

Thus, we disable the -lto from the development builds by default;
if anyone wants to test of the behaviour of their own compiler, they
must now explicitly turn on this flag.
2013-08-14 22:59:55 +02:00
Andreas Lauser
bec3d5db2c make the c++-2011 feature set of GCC 4.4 mandatory
we now produce an error even if the module in question does not
actually use some of these features.
2013-07-30 21:12:23 +02:00
Andreas Lauser
e6cf509ea9 check for the C++-2011 'auto' keyword.
It seems like the corresponding FindCXX11Features.cmake file
was not updated for this module.
2013-07-30 21:12:23 +02:00
Andreas Lauser
23088686a6 autodiff: make it compatible with dunecontrol
the 'configure' script was missing...
2013-07-30 21:12:23 +02:00
Roland Kaufmann
6b9d1e2da5 Search common suffixes for include files
This allows us to set e.g. -DEIGEN3_ROOT=/usr/local, and have the
files actually be located in /usr/local/include/eigen3
2013-06-25 14:54:22 +02:00
Roland Kaufmann
eef87e48ad Use standard code to handle not found case
Instead of setting EIGEN3_FOUND ourselves, rely on the standard method
to check arguments and raise an error if not found.
2013-06-25 14:49:11 +02:00
Roland Kaufmann
05e516bb4a Allow mixed case name in variable (as for package)
Since the package is named Eigen3 (in mixed case), we should allow
for the variable to be named this way, too.
2013-06-25 14:49:11 +02:00
Roland Kaufmann
b446ac99e2 Allow user to specify path to Eigen3 library
By setting EIGEN3_ROOT, we can point directly to the path of the
library checkout we want to use. No other searching will then take
place.

Notice that if you have found an Eigen3 installation in a previous
configure, it will not find a new version even if you introduce the
EIGEN3_ROOT variable!
2013-06-25 14:49:11 +02:00
Atgeirr Flø Rasmussen
6a2b21e04b Refine OpmFind according to Roland Kaufmann's suggestions.
This enables us to restore FindEigen3.cmake to its original
state (as copied from Eigen sources).
2013-05-16 14:18:59 +02:00
Atgeirr Flø Rasmussen
d59363d681 Now Eigen is found properly. 2013-05-16 10:49:05 +02:00
Atgeirr Flø Rasmussen
db95420b98 Add FindEigen3 cmake module. Currently unused. 2013-05-16 10:28:25 +02:00
Bård Skaflestad
116f39e8ab Import CMake support from OPM-Core 2013-05-15 10:24:52 +02:00