Commit Graph

65 Commits

Author SHA1 Message Date
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