Compare commits

...

175 Commits

Author SHA1 Message Date
Arne Morten Kvarving
4b1bf13874 bump versions to 2017.10 final 2017-10-30 11:08:22 +01:00
Atgeirr Flø Rasmussen
2ca8c3d785 Remove RT lib dependency. 2017-10-30 11:07:33 +01:00
Atgeirr Flø Rasmussen
597d08b5de Library not needed nor found on macOS. 2017-10-30 11:07:33 +01:00
Atgeirr Flø Rasmussen
e01c0a77c6 Always set include-related CMake variables. 2017-10-30 11:07:16 +01:00
Andreas Lauser
fa71d4062e don't mark UMFpack as required for opm-simulators
before OPM/opm-simulators#1309 it was required, but this was not
enforced by the build system because the SuiteSparse tests are run by
the opm-core build system first and UMFpack is optional there.

thanks to [at]akva2 and [at]blattms for the heads-up.
2017-10-30 11:07:16 +01:00
Arne Morten Kvarving
f119b3c3fb update redhat packaging 2017-10-30 11:07:16 +01:00
Arne Morten Kvarving
cfd71c5dbb bump debian packaging version to 2017.10-rc1 2017-10-23 14:23:15 +02:00
Andreas Lauser
80e16e6d59 change version to 2017.10-rc1 2017-10-19 19:27:45 +02:00
Andreas Lauser
ef0b41419e Merge pull request #279 from akva2/remove_stale_file
remove stale file
2017-10-19 19:24:23 +02:00
Arne Morten Kvarving
f8cac9cf3f remove stale file 2017-10-19 13:46:01 +02:00
Atgeirr Flø Rasmussen
c784931db8 Merge pull request #278 from GitPaean/require_umfpack_opm_simulators
[discussion] adding UMFpack to prerequisite of opm-simulators
2017-10-17 07:02:45 +02:00
Kai Bao
e7b1172528 adding UMFpack to prerequisite of opm-simulators 2017-10-16 21:17:28 +02:00
Arne Morten Kvarving
e1f7da13d2 Merge pull request #273 from blattms/cmakify-sibling-search
Simplify dune/opm module search by relying on cmake package config files
2017-10-16 20:02:27 +02:00
Markus Blatt
6715ed6d48 Allow multiple find_package calls in config mode 2017-10-13 21:35:24 +02:00
Markus Blatt
5662f2a188 Allow second search for opm-common to get all its dependencies and defines.
As opm-common is search in the toplevel CMakeLists.txt of each module in
config mode and the dependencies and defines are only processed in
opm_find_package(opm-common), we allow a second search using module mode
to trigger opm_find_package.
2017-10-13 21:20:30 +02:00
Markus Blatt
db0a52ffdb Force module mode in search for dune and opm even if *_DIR is set.
Otherwise some defines and macros will not be set as this is done
in opm_find_package. This might also make sense for dunecontrol
which always will set *_DIR.
2017-10-13 21:19:11 +02:00
Markus Blatt
c7fc21e343 Stop setting COMPARE_(SUMMARY|ECL)_COMAND in Findopm-output.cmake.
Theses variables are already set in opm-output-config.cmake. Unfortunately,
theres is still a bug there which will be fixed by a PR in opm-output. After
that everything should work and have less guess work in it.
2017-10-11 14:37:21 +02:00
Markus Blatt
7a891baef7 Use correct default clone directory in sibling search for ecl.
Previously we assumed it to be ecl (like the project name).
That is not correct. With this commit we now use the correct
default clone directory, libecl, in the sibling search.
2017-10-10 12:44:22 +02:00
Markus Blatt
fc4bac6b7a Suppress message "finding .. using module mode" for OPM modules. 2017-10-10 12:42:49 +02:00
Arne Morten Kvarving
352b5a371d Merge pull request #275 from akva2/fix_message
fix message posted on repeated update_data calls
2017-10-09 12:51:21 +02:00
Arne Morten Kvarving
2edffb8e61 fix message posted on repeated update_data calls 2017-10-09 12:40:14 +02:00
Atgeirr Flø Rasmussen
29d3df8e58 Merge pull request #274 from akva2/no_new_pr
changed: do not open a new PR in repeated update-data calls
2017-10-09 12:15:01 +02:00
Arne Morten Kvarving
2c74f75231 changed: do not open a new PR in repeated update-data calls 2017-10-09 11:10:46 +02:00
Markus Blatt
7c779697c7 Deactivate package cache and activate sibling search for ecl.
Even though people are telling that ecl is already found using
sibling search it turned out that this statement is false. It
was always found using the CMake package cache. When installing
this lead to the installed package using ecl from the build tree.
With this commit we first try to find ecl without the package cache
but maybe using sibling search. Building installed packages no works
by setting -DSIBLING_SEARCH=Off -DCMAKE_INSTALL_PREFIX=/install/path
2017-10-06 22:36:40 +02:00
Arne Morten Kvarving
e6e5491c74 add HAVE_SUITESPARSE_UMFPACK to opm-simulators config.h 2017-09-29 23:19:48 +02:00
Arne Morten Kvarving
48472bcf1a typo: SUITEPARSE -> SUITESPARSE 2017-09-29 21:13:10 +02:00
Arne Morten Kvarving
fd411cb1b7 Merge pull request #259 from blattms/fix-check-for-opm-grid-with-dune-2.5
Fix check for opm grid with dune 2.5
2017-09-29 20:21:40 +02:00
Markus Blatt
38e198d961 Always append CONFIG_VARS to ${module}_CONFIG_VARS.
It seems like this variable was not empty for e.g. dune-grid
and therefore we did not add some necessary defines before this
commit.
2017-09-29 11:02:14 +02:00
Arne Morten Kvarving
3283278090 Merge pull request #265 from akva2/add_another_alias
add another alias for UMFPACK
2017-09-27 08:44:06 +02:00
Bård Skaflestad
151e6e55e4 Merge pull request #272 from akva2/update_fdapps_prereqs
changed: update opm-flowdiagnostics-applications prereqs
2017-09-26 17:23:04 +02:00
Markus Blatt
f5bf291f7d Simplify dune/opm module search by relying on cmake package configuration files.
We use ${module}_DIR to set the correct path when sibling search is activated.
The package configuration files set all the necessary variable and we save
us a lot of CMake magic.
2017-09-26 16:49:18 +02:00
Arne Morten Kvarving
9646753a10 changed: update opm-flowdiagnostics-applications prereqs
it is now ecl, not ERT
2017-09-26 13:48:03 +02:00
Atgeirr Flø Rasmussen
9ca5b7d37b Merge pull request #271 from akva2/prune_old_branches
added: prune old branches from jenkins4opm remote on update_data calls
2017-09-26 10:34:32 +02:00
Arne Morten Kvarving
73d978d6c5 added: prune old branches from jenkins4opm remote on update_data calls 2017-09-26 09:48:15 +02:00
Arne Morten Kvarving
0ea57b9054 Merge pull request #268 from andlaus/compile-ONLY_COMPILE
also compile tests marked `ONLY_COMPILE` on `make test-suite`
2017-09-22 11:46:16 +02:00
Atgeirr Flø Rasmussen
2f872e82b3 Merge pull request #269 from akva2/optional_petsc
add option to enable PETSc
2017-09-10 16:16:59 +02:00
Arne Morten Kvarving
8c9776688d add option to enable PETSc
disabled by default
2017-09-10 06:18:48 +02:00
Andreas Lauser
4b60de7248 also compile tests marked ONLY_COMPILE on make test-suite 2017-09-03 17:44:22 +02:00
Atgeirr Flø Rasmussen
67a8d5b553 Merge pull request #266 from akva2/slu_stuff
changed: add option to disable superlu
2017-08-22 09:32:50 +02:00
Arne Morten Kvarving
e3ff47dd9f changed: add option to disable superlu
make this default to off.

additionally, check that the found superlu version
is compatible with the dune-istl version in use.
in particular superlu5 is not compatible with dune-istl 2.4
2017-08-21 16:49:47 +02:00
Arne Morten Kvarving
0a9bae6587 add another alias for UMFPACK
used by dune 2.5
2017-08-16 12:25:20 +02:00
Atgeirr Flø Rasmussen
15aba45d53 Merge pull request #260 from nairr/term_output
Message formatting edit
2017-08-01 11:22:50 +02:00
Rohith Nair
da654bde90 Modified tests 2017-07-31 15:39:31 +02:00
Joakim Hove
19aaeff10a Merge pull request #262 from andlaus/travis_dune-2.4.2
travis: switch from dune 2.3.1 to dune 2.4.1
2017-07-19 08:05:14 +02:00
Andreas Lauser
f3be13c5af travis: switch from dune 2.3.1 to dune 2.4.1
It seems like OPM support for Dune 2.3 is going to be removed sooner
rather than later. Also, all relevant distributions which I'm aware of
seem to ship at least Dune-2.4 packages.

note that this patch switches to Dune 2.4.1 instead of the latest Dune
2.4 release (i.e., 2.4.2) because travis seems to block downloads from
sites it does not know -- in this case dune-project.org -- and the
Dune github mirrors seem to have been abandoned a few months ago and
thus do not feature dune 2.4.2.
2017-07-18 18:22:51 +02:00
Rohith Nair
579a648ebc edit 2017-06-27 10:32:05 +02:00
Rohith Nair
08b659fe11 Revert to formatting prefix message 2017-06-27 10:27:32 +02:00
Rohith Nair
531fb27ba1 edit 2017-06-26 11:54:53 +02:00
Rohith Nair
0024fd9052 Add line space before problems, messages and warnings 2017-06-26 10:57:38 +02:00
Markus Blatt
f8841cea15 Search for same header as used in compile test of Findopm-grid.cmake 2017-06-21 13:23:05 +00:00
Markus Blatt
3dd214ba34 Include geometry version in config.h.
This is needed with DUNE 2.5 as otherwise the includes of
geometry headers are for older DUNE versions.
2017-06-21 13:15:12 +00:00
Markus Blatt
ef5f730786 Make check for opm-grid work with DUNE 2.5.
Previously, we checked for header CpGrid.hpp which finally
tried to include the non-existent generic geometry headers
as the checks for dune-geometry versions do not work during
 a CMake run.
With this patch we search for the header GlobalIdMapper.hpp which
does not use any version checks and therefore works for every DUNE
version.
2017-06-21 13:15:12 +00:00
Arne Morten Kvarving
65b4a7cc96 Merge pull request #258 from jokva/find-opm-parser-require-boost
Add find_package(Boost) in Findopm-parser
2017-06-16 10:15:47 +02:00
Jørgen Kvalsvik
62c2b15c29 Don't exit early when checking dynamic boost 2017-06-15 14:39:27 +02:00
Jørgen Kvalsvik
5df5c59c27 Add find_package(Boost) in Findopm-parser 2017-06-15 10:04:35 +02:00
Arne Morten Kvarving
98728e91f7 Merge pull request #257 from blattms/use-hints-precedenting-cache
Pass sibling dirs HINTS to find_package calls for opm-parser.
2017-06-13 11:47:47 +02:00
Markus Blatt
5c731bf2ce Stop marking non-stored variables as advanced. 2017-06-13 11:09:11 +02:00
Markus Blatt
bea6eb9240 Removed dead code. 2017-06-13 10:21:54 +02:00
Markus Blatt
5500dcfe8b Pass sibling dirs HINTS to find_package calls for opm-parser.
These take precendence over the package registry where we have no control
on which entry will be used. The registry is only the last resort.

On some Linux version the most recently created package registry key will
be used. Please not that an entry is only created for a build try that is
not already in the registry. If there is already key, then not even the
modification date of the key will be updated. This default behaviour might
lead to strange mixes of build configurations.
2017-06-12 21:13:58 +02:00
Joakim Hove
8502fdd324 Merge pull request #254 from joakim-hove/update-travis-build
Update travis build
2017-06-10 12:59:34 +02:00
Joakim Hove
073e0c809c Set env variable TRAVIS_CI when running travis. 2017-06-10 11:17:03 +02:00
Joakim Hove
9e88a3d4e7 CHanged travis build order. 2017-06-10 11:16:01 +02:00
Atgeirr Flø Rasmussen
d997b26bf9 Merge pull request #252 from akva2/sca_fixes
Fixes for warnings from static code analysis
2017-06-09 12:15:49 +02:00
Arne Morten Kvarving
b9dde75a4d remove extra class qualification
may cause portability issues
2017-06-08 16:33:25 +02:00
Arne Morten Kvarving
19ca0e291b initialize members 2017-06-08 16:30:53 +02:00
Arne Morten Kvarving
2c00b418b5 pass by reference 2017-06-08 16:30:46 +02:00
Arne Morten Kvarving
b7302a5ace mark single-parameter constructors as explicit 2017-06-08 16:30:09 +02:00
Atgeirr Flø Rasmussen
89b84ccde4 Merge pull request #243 from nairr/term_output_mod
Add exception TooManyIterations
2017-06-07 15:04:34 +02:00
Rohith Nair
d361bd8766 Adds exception TooManyIterations
Adds 2 new message types to OpmLog

Revert "Adds 2 new message types to OpmLog"

This reverts commit 587cde3c6c78077cd6e5ae008038f72b2b39982d.
2017-06-07 09:58:20 +02:00
Atgeirr Flø Rasmussen
9602be7ca0 Merge pull request #251 from akva2/quell_sca_error
remove namespace qualifier
2017-06-06 08:28:56 +02:00
Arne Morten Kvarving
f147dd9589 remove namespace qualifier
code is already in the namespace, some compilers consider this an error.
2017-06-02 16:02:24 +02:00
Arne Morten Kvarving
eaf09f34c3 Merge pull request #250 from akva2/add_sca
Add static code analysis support
2017-06-02 14:53:19 +02:00
Arne Morten Kvarving
ed50891e5f add ability to execute a specific ctest configuration in jenkins scripts 2017-06-02 10:38:54 +02:00
Arne Morten Kvarving
cdbcb74e5e add static analysis support to buildsystem 2017-06-02 10:38:54 +02:00
jokva
6d2194edc2 Merge pull request #248 from jokva/refactor-parser-cmake
Refactor parser cmake
2017-06-01 15:29:52 +02:00
Jørgen Kvalsvik
fbec9b1e0d Findopm-parser tries CONFIG mode first
CONFIG mode is usually a fallback when Find* modules are not found, but
opm-parser is now mainly meant to be used with config mode, so it's the
first thing being tried. If that fails, continue with the old logic.

Some legacy requires HAVE_ERT being set somewhere, so this logic is
injected here.
2017-05-31 21:51:35 +02:00
Jørgen Kvalsvik
2b342ce3f0 ERT -> ecl 2017-05-31 14:54:19 +02:00
Jørgen Kvalsvik
2aedb2407f Upgrade cmake on travis 2017-05-26 13:43:23 +02:00
Arne Morten Kvarving
fa3a6a1b13 Merge pull request #247 from blattms/allow-external-static-libs-for-shared-opm-libs
Allow using external static libraries with BUILD_SHARED_LIBS=ON
2017-05-19 13:24:54 +02:00
Markus Blatt
cd4c0f54fb Allow using external static libraries with BUILD_SHARED_LIBS=ON
Previously, this failed if one dependency was a static library compiled
without -fPIC. This is is the case for library libsuitesparseconfig on
Debian which has no dynamic alternative. The error messages read e.g.

```
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libsuitesparseconfig.a(SuiteSparse_config.o): relocation R_X86_64_PC32 against undefined symbol `malloc@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
```

With this patch we change the target_link_libraries call when using
BUILD_SHARED_LIBS=ON. We only pass the dynamic libraries as PUBLIC such
that they will get linked to the library. The static ones are passed as
INTERFACE libraries. This means that they will be automatically linked
to executables which link to the main library. Currently this transitive
linking will only work in the same module as we do not correctly export
libraries. But our build system explicitly links the others ones anyway.
2017-05-18 20:37:31 +02:00
Arne Morten Kvarving
a7402e5720 Merge pull request #245 from alfbr/master
Change release build optimization from -O2 to -O3
2017-05-16 14:37:10 +02:00
Alf B. Rustad
6332d56c2c Change release build optimization from -O2 to -O3 2017-05-16 11:17:19 +02:00
Arne Morten Kvarving
e6c4d4f0d0 Merge pull request #244 from akva2/leftover_ert
add a missed ert -> libecl
2017-05-12 16:01:16 +02:00
Arne Morten Kvarving
530791ede3 add a missed ert -> libecl 2017-05-12 12:06:59 +02:00
Joakim Hove
f8ef8dbe07 Merge pull request #237 from joakim-hove/jenkins-use-libecl
Changed jenkins build script to use libecl.
2017-05-10 13:36:18 +02:00
Joakim Hove
cb46a93dca Changed to use libecl when building on jenkins. 2017-05-07 12:50:10 +02:00
Atgeirr Flø Rasmussen
ec96d6e9c9 Merge pull request #242 from akva2/adjust_opm_core_test
fix opm-core test
2017-05-02 07:19:33 +02:00
Arne Morten Kvarving
e86d9b8b73 fix opm-core test
namespace has been removed
2017-04-28 15:32:18 +02:00
Atgeirr Flø Rasmussen
0a7a9f65a3 Merge pull request #241 from akva2/remove_tinyxml
remove tinyxml from opm-core requirements
2017-04-28 14:07:30 +02:00
Arne Morten Kvarving
7d7dd7e582 remove tinyxml from opm-core requirements 2017-04-28 11:19:43 +02:00
Atgeirr Flø Rasmussen
cf06e2c00b Merge pull request #236 from joakim-hove/travis-use-libecl
The travis build will use Statoil/libecl
2017-04-28 10:15:24 +02:00
Andreas Lauser
8aa6894a88 Merge pull request #240 from akva2/no_native_in_packaging
disable native tuning in packaging
2017-04-26 14:49:01 +02:00
Arne Morten Kvarving
1be92935b0 disable native tuning in packaging 2017-04-26 14:45:09 +02:00
Joakim Hove
d1a3e4a872 Change ert -> libecl
- The travis build will use Statoi/libecl
 - The FindERT cmake module has been updated to look for both ert/ and
   libecl/
2017-04-18 20:32:02 +02:00
Andreas Lauser
0dc982c005 Change the version to 2017.10-pre 2017-04-13 12:58:53 +02:00
Atgeirr Flø Rasmussen
5c62c6e96f Merge pull request #239 from dr-robertk/PR/add-some-more-warning-disable
added two gcc 6.3 related warning disable for 3rd party libs.
2017-04-10 14:49:24 +02:00
Robert Kloefkorn
d38658858d added two gcc 6.3 related warnings. 2017-04-10 13:44:54 +02:00
Atgeirr Flø Rasmussen
176d0b188e Merge pull request #194 from blattms/support-c++14-for-dune-2.5
dune 2.5 support
2017-04-07 21:02:12 +02:00
Atgeirr Flø Rasmussen
41c3eb7ff0 Merge pull request #235 from akva2/fix_path_intree_config_file_dc
fix path written to in-tree config file
2017-04-07 14:00:57 +02:00
Arne Morten Kvarving
8d8e612356 fix path written to in-tree config file 2017-04-07 11:20:37 +02:00
Atgeirr Flø Rasmussen
40bb3159ea Merge pull request #234 from nairr/terminal_output_problem_color
modify terminal output color for problem messages
2017-04-04 13:48:11 +02:00
Rohith Nair
be3f1ed59b edited formatting 2017-04-04 10:01:13 +02:00
Rohith Nair
2313ab4029 Changed terminal output color for problem messages to magenta from red 2017-04-04 09:55:46 +02:00
Joakim Hove
554b5ff1b6 Merge pull request #232 from joakim-hove/findert-use-eclgrid
Changed FindERT to create ecl_grid.
2017-03-27 14:56:44 +02:00
Joakim Hove
98959d4a08 Changed FindERT to create ecl_grid. 2017-03-20 11:30:28 +01:00
Atgeirr Flø Rasmussen
f9311b96f3 Merge pull request #231 from atgeirr/refine-simple-logging
Make setupSimpleDefaultLogging() more flexible.
2017-03-20 08:08:04 +01:00
Atgeirr Flø Rasmussen
26974f28ef Make implementation of stdoutIsTerminal() more robust. 2017-03-17 15:40:02 +01:00
Atgeirr Flø Rasmussen
e0105c6ccf Merge pull request #205 from GitPaean/adding_Wcast_qual_warning_flag
adding -Wcast-qual to disable_warnings.h
2017-03-17 15:35:49 +01:00
Atgeirr Flø Rasmussen
7462cc4b96 Only use color coding for simple log setup if terminal.
Note that isatty() might need to be replaced by isatty_() for Windows.
2017-03-17 08:46:50 +01:00
Atgeirr Flø Rasmussen
726496c0b6 Make setupSimpleDefaultLogging() more flexible.
Also added documentation for the function.
2017-03-16 12:56:34 +01:00
Andreas Lauser
f979d1942f Merge pull request #230 from akva2/travis_enable_bc
fixed: install bc on travis builder
2017-03-10 15:03:38 +01:00
Arne Morten Kvarving
59319936e0 fixed: install bc on travis builder
required by some scripts
2017-03-10 13:52:53 +01:00
Atgeirr Flø Rasmussen
afc5903dfa Merge pull request #229 from akva2/remove_libtool
remove libtool archive generation
2017-02-23 15:26:51 +01:00
Arne Morten Kvarving
481d416c22 remove libtool archive generation 2017-02-23 14:13:49 +01:00
Atgeirr Flø Rasmussen
1788ecc1f0 Merge pull request #226 from andlaus/move_valgrind_crs
move the infrastructure for valgrind client requests into the Opm namespace
2017-02-10 10:22:14 +01:00
Andreas Lauser
52c05e6525 move the infrastructure for valgrind client requests into the Opm namespace 2017-02-09 18:26:31 +01:00
Atgeirr Flø Rasmussen
7222b210c7 Merge pull request #225 from akva2/automate_data_updates
add script for automating data updates
2017-01-26 13:50:44 +01:00
Arne Morten Kvarving
dcdb444050 add script for automating data updates 2017-01-26 11:51:45 +01:00
Pål Grønås Drange
7843964163 Merge pull request #224 from pgdr/message-status-for-opm-data
status if opm-data found, not warning
2017-01-12 09:30:51 +01:00
Pål Grønås Drange
8984579e77 status if opm-data found, not warning 2017-01-09 19:04:10 +01:00
Atgeirr Flø Rasmussen
1854c37b5b Merge pull request #223 from bska/update-fdappl-requirements
Request Boost.Regex to Support FD-Application Acceptance Tests
2017-01-09 16:58:17 +01:00
Bård Skaflestad
57fa257642 Request Boost.Regex to Support FD-Application Acceptance Tests 2017-01-09 15:52:19 +01:00
Atgeirr Flø Rasmussen
46144e814a Merge pull request #222 from andlaus/minor_reorg
Minor reorg
2016-12-14 21:45:50 +01:00
Andreas Lauser
3d096a54ec move over the code for valgrind client requests from opm-material 2016-12-14 16:47:41 +01:00
Atgeirr Flø Rasmussen
70bec15988 Merge pull request #221 from andlaus/reset_locale
Provide a free function to reset the localization settings
2016-12-08 12:01:23 +01:00
Andreas Lauser
f17880579c Provide a free function to reset the localization settings
Under some circumstances, some environments seem to set a locale which
they do not install. In turn this leads to std::runtime_errror being
thrown by some parts of Boost (for some versions) which causes
unsolicited program aborts.

This issue asside, it looks pretty weird if the e.g. the number format
is different than the that of the language used to print stuff by rest
of the simulation.
2016-12-07 14:04:32 +01:00
Arne Morten Kvarving
7b4bd58a82 Merge pull request #220 from akva2/fix_parallel_core_grid
fixed: mpi and dune-istl needs to be explicity in opm-grid now
2016-11-30 17:41:20 +01:00
Arne Morten Kvarving
aac2166cb8 fixed: mpi and dune-istl needs to be explicity in opm-grid now
previously opm-core guaranteed these
2016-11-30 15:55:24 +01:00
Arne Morten Kvarving
14efa7ed38 Merge pull request #218 from akva2/fix_test_program
fix test program
2016-11-30 00:46:12 +01:00
Arne Morten Kvarving
6f6801a5f2 look for opm/core/wells.h
opm/core/grid.h is no more
2016-11-29 23:57:16 +01:00
Arne Morten Kvarving
fa47d6a623 fix test program 2016-11-29 22:55:42 +01:00
Atgeirr Flø Rasmussen
29e12bfa79 Merge pull request #217 from akva2/update_downstreams_grid
update downstream list
2016-11-29 22:49:21 +01:00
Arne Morten Kvarving
d406e9f344 update travis build order 2016-11-29 22:07:41 +01:00
Arne Morten Kvarving
15583bdec6 update downstream list
opm-grid move in dependency graph
2016-11-29 21:36:07 +01:00
Atgeirr Flø Rasmussen
c15c3b6b9f Merge pull request #216 from atgeirr/revert-depencency-grid-core
Revert depencency grid core
2016-11-29 21:04:05 +01:00
Atgeirr Flø Rasmussen
bfeef48fbd Update test program to find opm-core.
Used classes were moved to opm-grid.
2016-11-29 13:19:56 +01:00
Atgeirr Flø Rasmussen
5a706c635e Merge branch 'PR/revert-dependency-grid-core' of https://github.com/dr-robertk/opm-common into dr-robertk-PR/revert-dependency-grid-core 2016-11-29 13:10:32 +01:00
Atgeirr Flø Rasmussen
bf656cd28f Merge pull request #213 from andlaus/move_Unused_hpp
move the Unused.hpp file from opm-material to here
2016-11-29 10:35:21 +01:00
Robert Kloefkorn
15f4d7e808 small change. 2016-11-24 13:24:42 +01:00
Robert Kloefkorn
264f621021 Revert dependencies of opm-core and opm-grid. opm-core is not dependent on
opm-grid.
2016-11-23 14:28:24 +01:00
Arne Morten Kvarving
35bd292fdf Merge pull request #214 from akva2/update_downstreams_ewoms
update downstream list
2016-11-22 16:03:51 +01:00
Andreas Lauser
5100db5694 move the Unused.hpp file from opm-material to here 2016-11-22 15:53:36 +01:00
Arne Morten Kvarving
fa3bba5510 update downstream list
ewoms moved in the tree
2016-11-22 15:21:35 +01:00
Atgeirr Flø Rasmussen
bbc8d23473 Merge pull request #210 from atgeirr/option-warnings-crossmodule
Make use of system includes for cross-module optional.
2016-11-21 13:22:32 +01:00
Atgeirr Flø Rasmussen
2ee1224917 Make use of system includes for cross-module optional. 2016-11-21 11:08:38 +01:00
Atgeirr Flø Rasmussen
2ddb6ac8c2 Merge pull request #162 from andlaus/frankenstein
[POC] added ewoms dependency to opm-simulators.
2016-11-18 15:49:35 +01:00
Robert Kloefkorn
825b96c1a3 added ewoms dependency to opm-simulators. 2016-11-17 17:41:42 +01:00
Andreas Lauser
8b3a4a6e23 Merge pull request #207 from blattms/fix-multiple-dune-version-request-hickups
Request dune module versions only in the most upstream opm module.
2016-11-17 17:38:26 +01:00
Markus Blatt
6608bc87e4 Request dune module versions only in the most upstream opm module.
Otherwise we are running into weired problems as downstream modules
refuse to set the version information correctly. This leads to
unset DUNE_MODULE_VERSION_{MINOR,MAJOR,REVISION} in config.h.

This only happened for dune-istl which was first requested by opm-core
but that module did not set the version information. Opm-grid requested
it, too. But this time this information was not correctly put into
opm-grid-config.cmake leading to erroneous checks like:

if (DEFINED DUNE_ISTL_VERSION_MAJOR AND NOT "${DUNE_ISTL_VERSION_MAJOR}" STREQUAL "")
        message (WARNING "Incompatible value \"${DUNE_ISTL_VERSION_MAJOR}\" of variable \"DUNE_ISTL_VERSION_MAJOR\"")
endif ()

Note there should have been a number instead of an empty string. The version
numbers were also undefined in config.h of opm-grid. Same picture for opm-simulators.

My assumption is that for these modules Finddune-istl.cmake was implicitly included
when searching for opm-core. That module sets the version in the parent scope only
which might cause this problem. I am not sure though.

With this commit the version is always added to CONFIG_VARS for the first most upstream
OPM module that requests a dune module. This fixes the issue at least for me on my system.

Also note that this problem did not occur in all configurations. I experienced breaking
builds with the installed dune module 2.4.1 of Debian backports while using dunecontrol.
The warnings about unmatching versions happened with uninstalled 2.3, too.
2016-11-17 17:01:33 +01:00
Atgeirr Flø Rasmussen
ec63c6b7fd Merge pull request #202 from atgeirr/warnings-fix
Silence warnings not from current module.
2016-11-16 10:14:46 +01:00
Atgeirr Flø Rasmussen
4398342048 Merge pull request #206 from joakim-hove/disable-ewoms-tests
Disable ewoms tests
2016-11-15 12:07:07 +01:00
Joakim Hove
c62f91154a Temporary measures to reduce build time on Travis.
- The tests are disabled when building ewoms.
 - opm-upscaling is not built.
2016-11-15 11:16:38 +01:00
Joakim Hove
00debb5e08 Use ON to silence external warnings. 2016-11-14 20:07:14 +01:00
Kai Bao
2724aae005 adding -Wcast-qual to disable_warnings.h 2016-11-14 18:05:41 +01:00
Arne Morten Kvarving
f48a647fc8 Merge pull request #204 from joakim-hove/travis-cleanup
Remove unused travis scripts
2016-11-14 09:49:34 +01:00
Joakim Hove
f6fb9d09c4 Removed unused travis scripts 2016-11-13 08:26:57 +01:00
Andreas Lauser
bb1040df70 Merge pull request #201 from andlaus/check_for_valgrind_in_opm-material
opm-material: actually check for valgrind
2016-11-08 11:42:35 +01:00
Andreas Lauser
05e1bd64a9 opm-material: actually check for valgrind
a config.h variable was already set but the actual test was not run
for opm-material.
2016-11-08 15:04:52 +01:00
Atgeirr Flø Rasmussen
5344392b99 Silence warnings not from current module. 2016-11-08 10:46:35 +01:00
Markus Blatt
ebe3457064 Correctly use -std=c++<version> instead of -std=<version> with older CMake. 2016-11-04 16:25:32 +01:00
Atgeirr Flø Rasmussen
1c5a17b6e8 Merge pull request #200 from atgeirr/bump-version
dune.module: change version to 2017.04-pre
2016-11-04 12:30:26 +01:00
Atgeirr Flø Rasmussen
596bafb2e7 dune.module: change version to 2017.04-pre 2016-11-04 12:26:59 +01:00
Markus Blatt
dbad03c62f Correctly request compiler flags for feature tests 2016-11-03 12:09:10 +01:00
Markus Blatt
2ce0810f68 Readded lost ) 2016-11-03 12:05:58 +01:00
Markus Blatt
69da5816d6 Make c++14 available for CMake >=3.1 and do not test c++0x 2016-11-03 12:00:11 +01:00
Arne Morten Kvarving
b4fd17e9a7 Merge pull request #199 from blattms/support-external-cjson
Support external cjson
2016-11-03 11:51:02 +01:00
Markus Blatt
bf31f7b4e9 Force a search for installed cJSON when looking for opm-parser.
If the version within opm-parser was used then the symbols are
in libopmjson anyway.
2016-11-02 21:24:40 +01:00
Markus Blatt
c7cf7d8144 Only search in PROJECT_SOURCE_DIR for cjson.
Otherwise will never find an installed version for downstream modules
as they will find the header in opm-parser but not library.
2016-11-02 21:22:58 +01:00
Markus Blatt
34ed49d765 Add external cJSON library to opm-parser_LIBRARIES. 2016-11-02 20:28:12 +01:00
Markus Blatt
b75f24afc2 Use external instead of opm/json for suffixes to search for cjson of opm-parser. 2016-11-02 19:46:41 +01:00
Arne Morten Kvarving
4696486879 Merge pull request #198 from akva2/jenkins_build_threads
added: allow building with multiple threads in jenkins scripts
2016-11-02 15:51:39 +01:00
Arne Morten Kvarving
e0a146708c added: allow building with multiple threads in jenkins scripts
use the BUILDTHREADS environment variable

convenient for local use
2016-11-02 15:46:30 +01:00
Markus Blatt
1352e89d4e Make dune-grid compile test more generic 2016-10-26 13:42:42 +00:00
Markus Blatt
b46d3df2f7 Find dune-grid 2.5 2016-10-26 13:19:40 +00:00
Markus Blatt
4d31c7efdc Activate -std=c++14 switch if compiler supports it.
This is needed to make OPM compile with 2.5. Otherwise dune-common
is not found because of missing std::decay_t support.
2016-10-25 09:41:29 +00:00
67 changed files with 1135 additions and 657 deletions

View File

@@ -8,6 +8,7 @@ addons:
sources:
- boost-latest
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
packages:
- libboost1.55-all-dev
- gcc-4.8
@@ -17,6 +18,14 @@ addons:
- libgmp3-dev
- libsuitesparse-dev
- libeigen3-dev
- bc
- cmake
- cmake-data
env:
global:
- TRAVIS_CI=1
before_script:
- export CXX="g++-4.8" CC="gcc-4.8" FC="gfortran-4.8"

View File

@@ -12,7 +12,7 @@ endmacro (dir_hook)
set(OPM_PROJECT_EXTRA_CODE_INSTALLED "set(OPM_MACROS_ROOT ${CMAKE_INSTALL_PREFIX}/share/opm)
list(APPEND CMAKE_MODULE_PATH \${OPM_MACROS_ROOT}/cmake/Modules)")
set(OPM_PROJECT_EXTRA_CODE_INTREE "set(OPM_MACROS_ROOT ${OPM_COMMON_ROOT})
set(OPM_PROJECT_EXTRA_CODE_INTREE "set(OPM_MACROS_ROOT ${OPM_MACROS_ROOT})
list(APPEND CMAKE_MODULE_PATH \${OPM_MACROS_ROOT}/cmake/Modules)")
# project information is in dune.module. Read this file and set variables.

View File

@@ -54,6 +54,9 @@ list (APPEND PROGRAM_SOURCE_FILES
list( APPEND PUBLIC_HEADER_FILES
opm/common/ErrorMacros.hpp
opm/common/Exceptions.hpp
opm/common/ResetLocale.hpp
opm/common/Unused.hpp
opm/common/Valgrind.hpp
opm/common/data/SimulationDataContainer.hpp
opm/common/OpmLog/CounterLog.hpp
opm/common/OpmLog/EclipsePRTLog.hpp

View File

@@ -33,23 +33,34 @@ include(CheckIncludeFileCXX)
# macro to only add option once
include(AddOptions)
if(CMAKE_VERSION VERSION_LESS 3.1)
if(NOT MSVC)
# try to use compiler flag -std=c++11
CHECK_CXX_ACCEPTS_FLAG("-std=c++11" CXX_FLAG_CXX11)
if(CXX_FLAG_CXX11)
add_options (CXX ALL_BUILDS "-std=c++11")
set(CXX_STD0X_FLAGS "-std=c++11")
else()
# try to use compiler flag -std=c++0x for older compilers
CHECK_CXX_ACCEPTS_FLAG("-std=c++0x" CXX_FLAG_CXX0X)
if(CXX_FLAG_CXX0X)
add_options (CXX ALL_BUILDS "-std=c++0x")
set(CXX_STD0X_FLAGS "-std=c++0x")
endif(CXX_FLAG_CXX0X)
endif(CXX_FLAG_CXX11)
endif(NOT MSVC)
# Force CXX Standard cross platfrom for CMakeVersion >=3.1
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
if(NOT MSVC)
foreach(_flag "14" "11")
set(_FLAG "CXX_FLAG_CXX${_flag}")
string(TOUPPER ${_FLAG} _FLAG)
# try to use compiler flag -std=c++${_flag}
CHECK_CXX_ACCEPTS_FLAG("-std=c++${_flag}" ${_FLAG})
if(${_FLAG})
if(CMAKE_VERSION VERSION_LESS 3.1)
add_options (CXX ALL_BUILDS "-std=c++${_flag}")
endif()
set(CXX_STD0X_FLAGS "-std=c++${_flag}")
#Use vriables for CMake > 3.1 set the standard with no extensions
set(CMAKE_CXX_STANDARD ${_flag})
break()
endif()
endforeach()
endif(NOT MSVC)
endif()
if(CMAKE_VERSION VERSION_LESS 3.1)
# if we are building with an Apple toolchain in MacOS X,
# we cannot use the old GCC 4.2 fork, but must use the
# new runtime library
@@ -58,8 +69,8 @@ if(CMAKE_VERSION VERSION_LESS 3.1)
if (APPLE AND (_comp_id MATCHES "CLANG"))
CHECK_CXX_ACCEPTS_FLAG ("-stdlib=libc++" CXX_FLAG_STDLIB_LIBCXX)
if (CXX_FLAG_STDLIB_LIBCXX)
add_options (CXX ALL_BUILDS "-stdlib=libc++")
set (CXX_STDLIB_FLAGS "-stdlib=libc++")
add_options (CXX ALL_BUILDS "-stdlib=libc++")
set (CXX_STDLIB_FLAGS "-stdlib=libc++")
endif (CXX_FLAG_STDLIB_LIBCXX)
endif (APPLE AND (_comp_id MATCHES "CLANG"))
@@ -69,13 +80,9 @@ if(CMAKE_VERSION VERSION_LESS 3.1)
else (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
set (CXX_SPACE)
endif (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
else()
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.1)
# Workaround bug in cmake:
# cxx standard flags are not applied in CheckCXXSourceCompiles
if (CMAKE_CXX_STANDARD EQUAL 14)
@@ -85,6 +92,7 @@ else()
endif()
endif()
# perform tests
include(CheckCXXSourceCompiles)

View File

@@ -0,0 +1,11 @@
# Find clang-check.
#
# This module defines:
# CLANGCHECK_PROGRAM, the clang-check executable.
# CLANGHCECK_FOUND, If false, do not try to use cppcheck.
#
find_program(CLANGCHECK_PROGRAM NAMES clang-check clang-check-3.8)
find_package_handle_standard_args(ClangCheck DEFAULT_MSG CLANGCHECK_PROGRAM)
mark_as_advanced(CLANGCHECK_PROGRAM)

View File

@@ -0,0 +1,11 @@
# Find CppCheck.
#
# This module defines:
# CPPCHECK_PROGRAM, the cppcheck executable.
# CPPCHECK_FOUND, If false, do not try to use cppcheck.
#
find_program(CPPCHECK_PROGRAM NAMES cppcheck)
find_package_handle_standard_args(CppCheck DEFAULT_MSG CPPCHECK_PROGRAM)
mark_as_advanced(CPPCHECK_PROGRAM)

View File

@@ -33,7 +33,7 @@ endif (ERT_ROOT)
find_path (ERT_ECL_INCLUDE_DIR
NAMES "ert/ecl/ecl_util.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libecl/include/" "include"
DOC "Path to ERT Eclipse library header files"
${_no_default_path}
@@ -41,7 +41,7 @@ find_path (ERT_ECL_INCLUDE_DIR
find_path (ERT_ECL_WELL_INCLUDE_DIR
NAMES "ert/ecl_well/well_const.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libecl_well/include/" "include"
DOC "Path to ERT Eclipse library header files"
${_no_default_path}
@@ -49,7 +49,7 @@ find_path (ERT_ECL_WELL_INCLUDE_DIR
find_path (ERT_ECLXX_INCLUDE_DIR
NAMES "ert/ecl/EclKW.hpp"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libeclxx/include/" "include"
DOC "Path to ERT Eclipse C++ library header files"
${_no_default_path}
@@ -57,7 +57,7 @@ find_path (ERT_ECLXX_INCLUDE_DIR
find_path (ERT_UTIL_INCLUDE_DIR
NAMES "ert/util/stringlist.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libert_util/include/" "include"
DOC "Path to ERT Eclipse library header files"
${_no_default_path}
@@ -65,7 +65,7 @@ find_path (ERT_UTIL_INCLUDE_DIR
find_path (ERT_UTILXX_INCLUDE_DIR
NAMES "ert/util/ert_unique_ptr.hpp"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libert_utilxx/include/" "include"
DOC "Path to ERT Eclipse C++ library header files"
${_no_default_path}
@@ -73,7 +73,7 @@ find_path (ERT_UTILXX_INCLUDE_DIR
find_path (ERT_GEN_INCLUDE_DIR
NAMES "ert/util/int_vector.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libert_util/include"
"include" "build/libert_util/include" "build/libert_util/include"
DOC "Path to ERT generated library header files"
@@ -88,7 +88,10 @@ endif (CMAKE_SIZEOF_VOID_P)
find_library (ERT_LIBRARY_ECL
NAMES "ecl"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../ert"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
@@ -98,7 +101,10 @@ find_library (ERT_LIBRARY_ECL
find_library (ERT_LIBRARY_ECLXX
NAMES "eclxx"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../ert"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
@@ -108,7 +114,10 @@ find_library (ERT_LIBRARY_ECLXX
find_library (ERT_LIBRARY_ECL_WELL
NAMES "ecl_well"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../ert"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
@@ -118,7 +127,10 @@ find_library (ERT_LIBRARY_ECL_WELL
find_library (ERT_LIBRARY_GEOMETRY
NAMES "ert_geometry"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../ert"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
@@ -128,7 +140,10 @@ find_library (ERT_LIBRARY_GEOMETRY
find_library (ERT_LIBRARY_UTIL
NAMES "ert_util"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../ert"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
@@ -138,7 +153,10 @@ find_library (ERT_LIBRARY_UTIL
find_library (ERT_LIBRARY_UTILXX
NAMES "ert_utilxx"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../ert"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
@@ -242,9 +260,10 @@ if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND
set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR})
set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES})
check_cxx_source_compiles (
"#include <ert/ecl/EclKW.hpp>
"#include <ert/ecl/ecl_grid.h>
int main ( ) {
ERT::EclKW< int > kw( ecl_kw_alloc( \"SATNUM\", 0, ECL_INT_TYPE ) );
ecl_grid_type * grid = ecl_grid_alloc_rectangular( 10,10,10,1,1,1, NULL);
ecl_grid_free( grid );
return 0;
}" HAVE_ERT)
cmake_pop_check_state ()

View File

@@ -16,6 +16,11 @@
# find out the size of a pointer. this is required to only search for
# libraries in the directories relevant for the architecture
if(NOT USE_PETSC)
return()
endif()
if (CMAKE_SIZEOF_VOID_P)
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
endif (CMAKE_SIZEOF_VOID_P)

View File

@@ -15,6 +15,10 @@
# SUPERLU_LIBRARIES Name to the SuperLU library.
#
if(NOT USE_SUPERLU)
return()
endif()
include(CheckIncludeFiles)
include(CMakePushCheckState)
include(CheckCSourceCompiles)
@@ -118,6 +122,19 @@ int main(void)
return 0;
}"
SUPERLU_POST_2005_VERSION)
# check whether version is at least 5.0
CHECK_C_SOURCE_COMPILES("
typedef int int_t;
#include <supermatrix.h>
#include <slu_util.h>
int main(void)
{
GlobalLU_t glu;
return 0;
}"
SUPERLU_MIN_VERSION_5)
cmake_pop_check_state()
if(SUPERLU_MIN_VERSION_4_3)
@@ -128,6 +145,17 @@ else()
"Human readable string containing SuperLU version information.")
endif()
if(SUPERLU_MIN_VERSION_5)
include(UseDuneVer)
find_dune_version("dune" "istl")
set(DUNE_ISTL_VERSION ${DUNE_ISTL_VERSION_MAJOR}.${DUNE_ISTL_VERSION_MINOR}.${DUNE_ISTL_VERSION_REVISION})
if(DUNE_ISTL_VERSION VERSION_LESS 2.5)
message(STATUS "SuperLU requested, but version found not compatible with dune-istl ${DUNE_ISTL_VERSION}")
set(SUPERLU_LIBRARY "")
set(SUPERLU_INCLUDE_DIR "")
endif()
endif()
# behave like a CMake module is supposed to behave
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(

View File

@@ -1,37 +0,0 @@
# - Find TinyXML library
#
# Defines the following variables:
# TinyXML_INCLUDE_DIRS Directory of header files
# TinyXML_LIBRARIES Directory of shared object files
# TinyXML_DEFINITIONS Defines that must be set to compile
# Copyright (C) 2012 Uni Research AS
# This code is licensed under The GNU General Public License v3.0
# use the generic find routine
include (OpmPackage)
find_opm_package (
# module name
"TinyXML"
# dependencies
""
# header to search for
"tinyxml.h"
# library to search for
"tinyxml"
# defines to be added to compilations
""
# test program
"#include <tinyxml.h>
int main (void) {
TiXmlDocument doc;
return 0;
}
"
# config variables
"")

View File

@@ -20,8 +20,8 @@ endif (CJSON_ROOT)
find_path (CJSON_INCLUDE_DIR
NAMES "cjson/cJSON.h"
HINTS "${CJSON_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/../opm-parser"
PATH_SUFFIXES "include" "opm/json"
PATHS "${PROJECT_SOURCE_DIR}"
PATH_SUFFIXES "include" "external"
DOC "Path to cjson library header files"
${_no_default_path} )

View File

@@ -41,7 +41,7 @@ find_opm_package (
"#include <dune/grid/onedgrid.hh>
int main (void) {
Dune::OneDGrid grid(1, 0., 1.);
return grid.lbegin<0>(0) == grid.lend<0>(0);
return grid.size(0);
}
"
# config variables

View File

@@ -21,7 +21,7 @@ find_opm_package (
"${opm-core_DEPS}"
# header to search for
"opm/core/grid.h"
"opm/core/wells.h"
# library to search for
"opmcore"
@@ -30,12 +30,13 @@ find_opm_package (
""
# test program
"#include <opm/core/grid.h>
int main (void) {
struct UnstructuredGrid *g;
g = create_grid_empty ();
destroy_grid (g);
return 0;
"
#include <opm/core/utility/parameters/ParameterGroup.hpp>
int main()
{
Opm::ParameterGroup parameters;
parameters.insertParameter(\"number\", \"7\");
return 0;
}
"
# config variables

View File

@@ -17,8 +17,8 @@ endif()
if (EXISTS "${_opm_data_root}/norne/NORNE_ATW2013.DATA")
set( HAVE_OPM_DATA True )
set( OPM_DATA_ROOT ${_opm_data_root} )
message( "-- Setting OPM_DATA_ROOT: ${OPM_DATA_ROOT}")
message(STATUS "Setting OPM_DATA_ROOT: ${OPM_DATA_ROOT}")
else()
set( HAVE_OPM_DATA False )
message( "opm-data not found - integration tests using opm-data will be skipped.")
endif()
message(WARNING "opm-data not found - integration tests using opm-data will be skipped.")
endif()

View File

@@ -20,7 +20,7 @@ find_opm_package (
"${opm-grid_DEPS}"
# header to search for
"dune/grid/CpGrid.hpp"
"dune/grid/cpgrid/GlobalIdMapping.hpp"
# library to search for
"opmgrid"
@@ -29,9 +29,9 @@ find_opm_package (
"HAVE_OPM_GRID"
# test program
"#include <dune/grid/CpGrid.hpp>
"#include <dune/grid/cpgrid/GlobalIdMapping.hpp>
int main (void) {
Dune::CpGrid g;
Dune::cpgrid::GlobalIdMapping g;
return 0;
}
"

View File

@@ -42,14 +42,3 @@ include (UseDynamicBoost)
#debug_find_vars ("opm-output")
if(OPM_OUTPUT_FOUND)
get_filename_component(opm-output_PREFIX_DIR ${opm-output_LIBRARY} PATH)
find_program(COMPARE_SUMMARY_COMMAND compareSummary
PATHS ${opm-output_PREFIX_DIR}/../bin
${opm-output_PREFIX_DIR}/../../bin)
find_program(COMPARE_ECL_COMMAND compareECL
PATHS ${opm-output_PREFIX_DIR}/../bin
${opm-output_PREFIX_DIR}/../../bin)
endif()

View File

@@ -18,13 +18,6 @@ else ()
set (OPM_PARSER_QUIET "")
endif ()
# use lowercase versions of the variables if those are set
if (opm-parser_ROOT)
set (OPM_PARSER_ROOT ${opm-parser_ROOT})
endif ()
if (opm_ROOT)
set (OPM_ROOT ${opm_ROOT})
endif ()
# inherit "suite" root if not specifically set for this library
if ((NOT OPM_PARSER_ROOT) AND OPM_ROOT)
@@ -50,120 +43,24 @@ else ()
"${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}")
endif ()
# use this header as signature
find_path (OPM_PARSER_INCLUDE_DIR
NAMES "opm/parser/eclipse/Parser/Parser.hpp"
HINTS "${OPM_PARSER_ROOT}"
PATHS ${_opm_parser_source}
PATH_SUFFIXES "include"
DOC "Path to OPM parser header files"
${_no_default_path} )
find_path (OPM_PARSER_GEN_INCLUDE_DIR
NAMES "opm/parser/eclipse/Parser/ParserKeywords.hpp"
HINTS "${OPM_PARSER_ROOT}"
PATHS ${_opm_parser_build}
PATH_SUFFIXES "generated-source/include" "include"
DOC "Path to OPM parser generated header files"
${_no_default_path} )
find_package(opm-parser CONFIG HINTS ${_opm_parser_build})
if (opm-parser_FOUND)
find_package(ecl REQUIRED)
find_package(Boost 1.44.0
COMPONENTS regex filesystem system date_time
REQUIRED)
set(HAVE_OPM_PARSER 1)
# setting HAVE_ERT is a mega hack here, but some downstreams require it.
# Eventually projets should move on to properly handle dependencies and
# configurations, and Findopm-parser be deprecated
set(HAVE_ERT 1)
set(opm-parser_CONFIG_VARS HAVE_OPM_PARSER HAVE_REGEX HAVE_ERT)
set(opm-parser_LIBRARIES opmparser)
# backup: if we didn't find any headers there, but a CMakeCache.txt,
# then it is probably a build directory; read the CMake cache of
# opm-parser to figure out where the source directory is
if ((NOT OPM_PARSER_INCLUDE_DIR) AND
(OPM_PARSER_ROOT AND (EXISTS "${OPM_PARSER_ROOT}/CMakeCache.txt")))
set (_regex "^OPMParser_SOURCE_DIR:STATIC=\(.*\)$")
file (STRINGS
"${OPM_PARSER_ROOT}/CMakeCache.txt"
_cache_entry
REGEX "${_regex}")
string(REGEX REPLACE "${_regex}" "\\1"
OPM_PARSER_INCLUDE_DIR
"${_cache_entry}")
if (OPM_PARSER_INCLUDE_DIR)
set (OPM_PARSER_INCLUDE_DIR "${OPM_PARSER_INCLUDE_DIR}"
CACHE PATH "Path to OPM parser header files" FORCE)
endif ()
endif ()
# find out the size of a pointer. this is required to only search for
# libraries in the directories relevant for the architecture
if (CMAKE_SIZEOF_VOID_P)
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
endif ()
# these libraries constitute the parser core
find_library (OPM_PARSER_LIBRARY
NAMES "opmparser"
HINTS "${OPM_PARSER_ROOT}"
PATHS ${_opm_parser_build}
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
"opm/parser/eclipse"
DOC "Path to OPM parser library archive/shared object files"
${_no_default_path} )
# find the OPM-parser wrapper library around cJSON
find_library (OPM_JSON_LIBRARY
NAMES "opmjson"
HINTS "${OPM_PARSER_ROOT}"
PATHS ${_opm_parser_build}
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
"opm/json"
DOC "Path to OPM JSON library archive/shared object files"
${_no_default_path} )
# get the prerequisite ERT libraries
if (NOT ERT_FOUND)
find_package(ERT ${OPM_PARSER_QUIET})
endif ()
# get the prerequisite Boost libraries
find_package(Boost 1.44.0 COMPONENTS filesystem date_time system unit_test_framework regex ${OPM_PARSER_QUIET})
if (ERT_FOUND AND Boost_FOUND AND
OPM_PARSER_LIBRARY AND OPM_JSON_LIBRARY AND OPM_PARSER_INCLUDE_DIR)
# setup list of all required libraries to link with opm-parser. notice that
# we use the plural form to get *all* the libraries needed by cjson
set (opm-parser_INCLUDE_DIRS
${OPM_PARSER_INCLUDE_DIR}
${OPM_PARSER_GEN_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${ERT_INCLUDE_DIRS})
set (opm-parser_LIBRARIES
${OPM_PARSER_LIBRARY}
${OPM_JSON_LIBRARY}
${Boost_LIBRARIES}
${ERT_LIBRARIES})
# see if we can compile a minimum example
# CMake logical test doesn't handle lists (sic)
include (CMakePushCheckState)
include (CheckCSourceCompiles)
cmake_push_check_state ()
set (CMAKE_REQUIRED_INCLUDES ${opm-parser_INCLUDE_DIRS})
set (CMAKE_REQUIRED_LIBRARIES ${opm-parser_LIBRARIES})
check_cxx_source_compiles (
"#include <cstdlib>
#include <opm/parser/eclipse/Deck/Deck.hpp>
int main (void) {
return EXIT_SUCCESS;
}" HAVE_OPM_PARSER)
cmake_pop_check_state ()
endif()
# if the test program didn't compile, but was required to do so, bail
# out now and display an error; otherwise limp on
set (OPM_PARSER_FIND_REQUIRED ${opm-parser_FIND_REQUIRED})
find_package_handle_standard_args (opm-parser
DEFAULT_MSG
opm-parser_INCLUDE_DIRS opm-parser_LIBRARIES HAVE_OPM_PARSER
find_package_handle_standard_args(opm-parser
DEFAULT_MSG
opm-parser_LIBRARIES HAVE_OPM_PARSER HAVE_ERT
)
endif ()
set (opm-parser_CONFIG_VARS "HAVE_OPM_PARSER;HAVE_REGEX")
set (opm-parser_FOUND ${OPM-PARSER_FOUND})
mark_as_advanced(opm-parser_LIBRARIES opm-parser_INCLUDE_DIRS OPM-PARSER_FOUND)

View File

@@ -9,6 +9,7 @@ function (set_aliases)
# are separated by space
set (aliases
"HAVE_UMFPACK HAVE_SUITESPARSE_UMFPACK_H"
"HAVE_SUITESPARSE_UMFPACK HAVE_SUITESPARSE_UMFPACK_H"
"HAVE_DUNE_BOOST HAVE_BOOST"
)
foreach (alias IN LISTS aliases)

View File

@@ -13,28 +13,53 @@ macro (opm_compile opm)
# all public header files are together with the source. prepend our own
# source path to the one of the dependencies so that our version of any
# ambigious paths are used.
set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS})
option(SILENCE_CROSSMODULE_WARNINGS "Disable warnings from cross-module includes" OFF)
if (SILENCE_CROSSMODULE_WARNINGS)
include_directories("${PROJECT_SOURCE_DIR}")
include_directories (SYSTEM ${${opm}_INCLUDE_DIRS})
set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS})
else()
set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS})
include_directories (${${opm}_INCLUDE_DIRS})
endif()
# create this library, if there are any compilation units
include_directories (${${opm}_INCLUDE_DIRS})
link_directories (${${opm}_LIBRARY_DIRS})
add_definitions (${${opm}_DEFINITIONS})
set (${opm}_VERSION "${${opm}_VERSION_MAJOR}.${${opm}_VERSION_MINOR}")
if (${opm}_SOURCES)
add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES})
set_target_properties (${${opm}_TARGET} PROPERTIES
SOVERSION ${${opm}_VERSION_MAJOR}
VERSION ${${opm}_VERSION}
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES})
set_target_properties (${${opm}_TARGET} PROPERTIES
SOVERSION ${${opm}_VERSION_MAJOR}
VERSION ${${opm}_VERSION}
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
POSITION_INDEPENDENT_CODE TRUE
)
target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES})
if (${${opm}_LIBRARY_TYPE} STREQUAL "SHARED")
# libs that will be linked with the main lib
string(REGEX REPLACE "([;^])[^;]+\\.a[;$]" "\\1" _public_libs
"${${opm}_LIBRARIES}")
# libs that will not actually linked to the library but
# transitively linked to binaries that link to the main library
string(REGEX REPLACE "([^;]+\\.[^a][a-zA-Z0-9]*|-[a-z]*)[;$]" "" _interface_libs
"${${opm}_LIBRARIES}")
else()
# Use all libs for real and transitive linking
set(_public_libs ${${opm}_LIBRARIES})
unset(_interface)
endif()
target_link_libraries (${${opm}_TARGET} PUBLIC ${_public_libs}
INTERFACE ${_interface_libs})
if (STRIP_DEBUGGING_SYMBOLS)
# queue this executable to be stripped
strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG)
endif()
add_static_analysis_tests(${opm}_SOURCES ${opm}_INCLUDE_DIRS)
else (${opm}_SOURCES)
# unset this variable to signal that no library is generated
set (${opm}_TARGET)

View File

@@ -33,6 +33,7 @@
# )
include (Duplicates)
include (OpmSiblingSearch)
# list of suffixes for all the project variables
set (_opm_proj_vars
@@ -135,15 +136,34 @@ macro (find_and_append_package_to prefix name)
set (${name}_FOUND FALSE)
set (${NAME}_FOUND FALSE)
else ()
# using config mode is better than using module (aka. find) mode
# because then the package has already done all its probes and
# stored them in the config file for us
if (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND)
if (${name}_DIR)
message (STATUS "Finding package ${name} using config mode")
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
else ()
message (STATUS "Finding package ${name} using module mode")
# using config mode is better than using module (aka. find) mode
# because then the package has already done all its probes and
# stored them in the config file for us
# For dune and opm modules and exempted packages we force module mode.
# For dune and opm it will use config mode underneath.
# We even need to repeat the search for opm-common once as this is done
# in the top most CMakeLists.txt without querying defines, setting dependencies
# and the likes which is only done via opm_find_package
if (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND
OR ("${name}" STREQUAL "opm-common" AND NOT _opm_common_deps_processed))
string(REGEX MATCH "(dune|opm)-.*" _is_opm ${name})
if (${name}_DIR AND NOT (_${name}_exempted OR _is_opm))
message (STATUS "Finding package ${name} using config mode ${_${name}_exempted}")
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
else ()
# print message if this neither an opm module nor ecl
if (NOT (${name}_exempted EQUAL -1 OR _is_opm_) )
message (STATUS "Finding package ${name} using module mode")
endif()
if(${name} STREQUAL "ecl")
# Give us a chance to find ecl installed to CMAKE_INSTALL_PREFIX.
# We need to deactivate the package registry for this.
create_module_dir_var(ecl)
set(ARGN_NO_REQUIRED ${ARGN})
list(REMOVE_ITEM ARGN_NO_REQUIRED "REQUIRED")
find_package (${name} ${ARGN_NO_REQUIRED} NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_PACKAGE_REGISTRY)
# If everything else failed fall back to the registry
endif()
find_package (${name} ${ARGN})
endif ()
endif ()
@@ -153,6 +173,10 @@ macro (find_and_append_package_to prefix name)
if (NOT DEFINED ${NAME}_FOUND)
set (${NAME}_FOUND "${${name}_FOUND}")
endif ()
if(name STREQUAL "opm-common")
set(_opm_common_deps_processed ON)
endif()
endif ()
# the variable "NAME" may be replaced during find_package (as this is

View File

@@ -102,6 +102,16 @@ find_openmp (${project})
include (UseThreads)
find_threads (${project})
# SuperLU is optional
option (USE_SUPERLU "Use SuperLU direct solvers" OFF)
# PETSc is optional
option (USE_PETSC "Use PETSc iterative solvers" OFF)
# static code analysis
include(UseStaticAnalysis)
setup_static_analysis_tools()
# callback hook to setup additional dependencies
if (COMMAND prereqs_hook)
prereqs_hook ()
@@ -285,10 +295,6 @@ opm_doc (${project} ${doxy_dir})
# provide compatibility with using this build in dunecontrol
include (DuneCompat)
include (LibtoolArchives)
if (${project}_TARGET)
configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE)
endif ()
### clean in-source builds ###
include (OpmDistClean)

View File

@@ -37,9 +37,7 @@
# <http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries>
include (OpmFind)
option (SIBLING_SEARCH "Search sibling directories before system paths" ON)
mark_as_advanced (SIBLING_SEARCH)
include (OpmSiblingSearch)
# append all items from src into dst; both must be *names* of lists
macro (append_found src dst)
@@ -57,8 +55,15 @@ macro (find_opm_package module deps header lib defs prog conf)
string (REPLACE "-" "_" MODULE "${MODULE_UPPER}")
# if someone else has included this test, don't do it again
# one exception is opm-common which is already found in the
# top most CMakeLists.txt but we still need to search for its
# dependencies
if (${MODULE}_FOUND OR ${module}_FOUND)
return ()
if (${module} STREQUAL "opm-common" AND NOT _opm_common_deps_processed)
set(_opm_common_deps_processed ON)
else()
return ()
endif()
endif ()
# variables to pass on to other packages
@@ -73,198 +78,13 @@ macro (find_opm_package module deps header lib defs prog conf)
set (_${module}_required "")
endif (${module}_FIND_REQUIRED)
# see if there is a pkg-config entry for this package, and use those
# settings as a starting point
find_package (PkgConfig)
pkg_check_modules (PkgConf_${module} QUIET ${module})
create_module_dir_var(${module})
# these variables have non-standard names in FindPkgConfig (sic)
set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER})
set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER})
# This will also set all the needed variables with the exception of
# ${module}_CONFIG_VARS for dune modules.
find_package(${module} ${_${module}_quiet} ${_${module}_required} CONFIG)
# try to figure out whether we are in a subdir build tree, and attempt
# to put the same name as the appropriate build tree for the module
get_filename_component (_build_dir "${CMAKE_CURRENT_BINARY_DIR}" NAME)
# don't bother if we are in a project specific directory already
# (assuming no-one wants to name the build dir after another module!)
if ("${_build_dir}" STREQUAL "${PROJECT_NAME}")
set (_build_dir "")
endif ("${_build_dir}" STREQUAL "${PROJECT_NAME}")
# if the user hasn't specified any location, and it isn't found
# in standard system locations either, then start to wander
# about and look for it in proximity to ourself. Qt Creator likes
# to put the build-directories as siblings to the source trees,
# but with a -build suffix, DUNE likes to have the the build tree
# in a "build-cmake" sub-directory of each module
set(workaround_cmake_bug 0)
if(${module}_DIR})
set(workaround_cmake_bug 1)
endif()
if(${module}_ROOT})
set(workaround_cmake_bug 1)
endif()
if(${MODULE}_ROOT})
set(workaround_cmake_bug 1)
endif()
if (NOT workaround_cmake_bug)
string (TOLOWER "${module}" _module_lower)
set (_guess
"../${module}"
"../${_module_lower}"
)
set (_guess_bin_only
"../${module}-build"
"../${_module_lower}-build"
)
# look in similar dirs for the other module
if (_build_dir)
list (APPEND _guess_bin_only
"../../${module}/${_build_dir}"
"../../${_module_lower}/${_build_dir}"
)
endif (_build_dir)
# generate items that are in the build, not source dir
set (_guess_bin)
foreach (_item IN ITEMS ${_guess} ${_guess_bin_only})
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
endforeach (_item)
set (_no_system "")
else ()
# start looking at the paths in this order
set (_guess_bin
${${module}_DIR}
${${module}_ROOT}
${${MODULE}_ROOT}
)
# if every package is installed directly in the "suite" directory
# (e.g. /usr) then allow us to back-track one directory from the
# module sub-dir that was added by OpmFind (this happens incidently
# already for the source do to the out-of-source support)
if ("${${MODULE}_ROOT}" MATCHES "/${module}$")
get_filename_component (_suite_parent ${${MODULE}_ROOT} PATH)
list (APPEND _guess_bin
${_suite_parent}
${_suite_parent}/${module}
${_suite_parent}/${module}/${_build_dir}
)
endif ("${${MODULE}_ROOT}" MATCHES "/${module}$")
# when we look for the source, it may be that we have been specified
# a build directory which is a sub-dir of the source, so we look in
# the parent also
set (_guess
${${module}_DIR}
${${module}_ROOT}
${${MODULE}_ROOT}
)
# only add parent directories for those variants that are actually set
# (otherwise, we'll inadvertedly add the root directory (=all))
if (${module}_DIR)
list (APPEND _guess ${${module}_DIR}/..)
endif (${module}_DIR)
if (${module}_ROOT)
list (APPEND _guess ${${module}_ROOT}/..)
endif (${module}_ROOT)
if (${MODULE}_ROOT)
list (APPEND _guess ${${MODULE}_ROOT}/..)
endif (${MODULE}_ROOT)
# don't search the system paths! that would be dangerous; if there
# is a problem in our own specified directory, we don't necessarily
# want an old version that is left in one of the system paths!
set (_no_system "NO_DEFAULT_PATH")
endif ()
# by specifying _guess in the HINTS section, it gets searched before
# the system locations as well. the CMake documentation has a cloudy
# recommendation, but it ends up like this: if NO_DEFAULT_PATH is
# specified, then PATHS is used. Otherwise, it looks in HINTS, then in
# system paths, and the finally in PATHS (!)
if (SIBLING_SEARCH)
set (_guess_hints ${_guess})
set (_guess_hints_bin ${_guess_bin})
else (SIBLING_SEARCH)
set (_guess_hints)
set (_guess_hints_bin)
endif (SIBLING_SEARCH)
# if an include directory is specified directly (e.g. OPM_CORE_INCLUDE_DIR=
# /usr/include/opm-2013.03) then this overrides everything else. Notice that
# this variable uses the fully capitalized version of the name.
if (${MODULE}_INCLUDE_DIR)
set (_guess "${${MODULE}_INCLUDE_DIR}")
set (_no_system_incl "NO_DEFAULT_PATH")
else ()
set (_no_system_incl "${_no_system}")
endif ()
# search for this include and library file to get the installation
# directory of the package; hints are searched before the system locations,
# paths are searched afterwards
find_path (${module}_INCLUDE_DIR
NAMES "${header}"
PATHS ${_guess}
HINTS ${PkgConf_${module}_INCLUDE_DIRS} ${_guess_hints}
PATH_SUFFIXES "include"
${_no_system_incl}
)
# some modules are all in headers
if (NOT "${lib}" STREQUAL "")
if (CMAKE_SIZEOF_VOID_P)
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
endif (CMAKE_SIZEOF_VOID_P)
# again, we may directly override the location of the library alone by
# specifying e.g. OPM_CORE_LIB_DIR. notice that this is a *directory*
# and not the name of the library
if (${MODULE}_LIB_DIR)
set (_guess_bin "${${MODULE}_LIB_DIR}")
set (_no_system_lib "NO_DEFAULT_PATH")
else ()
set (_no_system_lib "${_no_system}")
endif ()
# if there is more than one library, then look for all of them, putting
# them in variables with the name of the library appended. however, the
# first entry is assumed to be the "primary" library and will be named
# like the module. thus, with a lib entry of "foo;bar", the first library
# is called ${module}_LIBRARY and the second ${module}_LIBRARY_bar
foreach (_lib IN ITEMS ${lib})
# don't include any suffix if it is the first one
if ("${lib}" MATCHES "^${_lib}")
set (_which)
else ()
set (_which "_${_lib}")
endif ()
find_library (${module}_LIBRARY${_which}
NAMES "${_lib}"
PATHS ${_guess_bin}
HINTS ${PkgConf_${module}_LIBRARY_DIRS} ${_guess_hints_bin}
PATH_SUFFIXES "lib" "lib/Debug" "lib/Release" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib"
${_no_system_lib}
)
# debug info if we didn't find the desired library
if (NOT ${module}_LIBRARY${_which})
message (STATUS "Failed to find library \"${_lib}\" for module ${module}")
endif ()
endforeach (_lib)
else (NOT "${lib}" STREQUAL "")
set (${module}_LIBRARY "")
endif (NOT "${lib}" STREQUAL "")
# add dependencies so that our result variables are complete
# list of necessities to build with the software
set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}")
foreach (_lib IN ITEMS ${lib})
if ("${lib}" MATCHES "^${_lib}")
set (${module}_LIBRARIES "${${module}_LIBRARY}")
else ()
list (APPEND ${module}_LIBRARIES "${${module}_LIBRARY_${_lib}}")
endif ()
endforeach (_lib)
# period because it should be something that evaluates to true
# in find_package_handle_standard_args
set (${module}_ALL_PREREQS ".")
@@ -309,10 +129,10 @@ macro (find_opm_package module deps header lib defs prog conf)
# these defines are used in dune/${module} headers, and should be put
# in config.h when we include those
foreach (_var IN ITEMS ${conf})
# massage the name to remove source code formatting
string (REGEX REPLACE "^[\n\t\ ]+" "" _var "${_var}")
string (REGEX REPLACE "[\n\t\ ]+$" "" _var "${_var}")
list (APPEND ${module}_CONFIG_VARS ${_var})
# massage the name to remove source code formatting
string (REGEX REPLACE "^[\n\t\ ]+" "" _var "${_var}")
string (REGEX REPLACE "[\n\t\ ]+$" "" _var "${_var}")
list (APPEND ${module}_CONFIG_VARS ${_var})
endforeach (_var)
# these are the defines that should be set when compiling
@@ -335,51 +155,19 @@ macro (find_opm_package module deps header lib defs prog conf)
# write status message in the same manner as everyone else
include (FindPackageHandleStandardArgs)
if ("${lib}" STREQUAL "")
set (_lib_var "")
set (_and_lib_var)
else ("${lib}" STREQUAL "")
foreach (_lib IN ITEMS ${lib})
if ("${lib}" MATCHES "^${_lib}")
set (_lib_var "${module}_LIBRARY")
set (_and_lib_var AND ${_lib_var})
else ()
list (APPEND _lib_var "${module}_LIBRARY_${_lib}")
set (_and_lib_var ${_and_lib_var} AND "${module}_LIBRARY_${_lib}")
endif ()
endforeach (_lib)
endif ("${lib}" STREQUAL "")
# if the search is going to fail, then write these variables to
# the console as well as a diagnostics
if ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
AND (_${module}_required OR NOT _${module}_quiet))
if (DEFINED ${module}_DIR)
message (STATUS "${module}_DIR = ${${module}_DIR}")
elseif (DEFINED ${module}_ROOT)
message (STATUS "${module}_ROOT = ${${module}_ROOT}")
elseif (DEFINED ${MODULE}_ROOT)
message (STATUS "${MODULE}_ROOT = ${${MODULE}_ROOT}")
endif (DEFINED ${module}_DIR)
endif ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
AND (_${module}_required OR NOT _${module}_quiet))
if ("${${module}_ALL_PREREQS}" MATCHES "-NOTFOUND")
message (STATUS "${module} prereqs: ${${module}_ALL_PREREQS}")
endif ()
find_package_handle_standard_args (
${module}
DEFAULT_MSG
${module}_INCLUDE_DIR ${_lib_var} HAVE_${MODULE} ${module}_ALL_PREREQS
)
# allow the user to override these from user interface
mark_as_advanced (${module}_INCLUDE_DIR)
mark_as_advanced (${module}_LIBRARY)
${module}
DEFAULT_MSG
${module}_INCLUDE_DIRS ${module}_LIBRARIES ${module}_FOUND ${module}_ALL_PREREQS
)
# some genius that coded the FindPackageHandleStandardArgs figured out
# that the module name should be in uppercase (?!)
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}")
set (${MODULE}_FOUND "${${MODULE_UPPER}_FOUND}")
# This variable is used by UseDuneVer
list(GET ${module}_INCLUDE_DIRS 0 ${module}_INCLUDE_DIR)
# print everything out if we're asked to
if (${module}_DEBUG)
debug_find_vars (${module})

View File

@@ -72,6 +72,7 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
set (_test_lib "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
else (NOT "${test_regexp}" STREQUAL "")
set (_test_lib "")
add_static_analysis_tests(_sat_FILE ${opm}_INCLUDE_DIRS)
endif (NOT "${test_regexp}" STREQUAL "")
target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib})
if (STRIP_DEBUGGING_SYMBOLS)
@@ -302,11 +303,6 @@ macro(opm_add_test TestName)
if(CURTEST_DEPENDS)
add_dependencies("${CURTEST_EXE_NAME}" ${CURTEST_DEPENDS})
endif()
if(NOT TARGET test-suite)
add_custom_target(test-suite)
endif()
add_dependencies(test-suite "${CURTEST_EXE_NAME}")
endif()
# figure out how the test should be run. if a test driver script
@@ -336,6 +332,13 @@ macro(opm_add_test TestName)
endif()
endif()
if (NOT CURTEST_NO_COMPILE)
if(NOT TARGET test-suite)
add_custom_target(test-suite)
endif()
add_dependencies(test-suite "${CURTEST_EXE_NAME}")
endif()
else() # test is skipped
# the following causes the test to appear as 'skipped' in the

View File

@@ -0,0 +1,36 @@
option (SIBLING_SEARCH "Search sibling directories before system paths" ON)
mark_as_advanced (SIBLING_SEARCH)
macro(create_module_dir_var module)
if(SIBLING_SEARCH AND NOT ${module}_DIR)
# guess the sibling dir
get_filename_component(_leaf_dir_name ${PROJECT_BINARY_DIR} NAME)
get_filename_component(_parent_full_dir ${PROJECT_BINARY_DIR} DIRECTORY)
get_filename_component(_parent_dir_name ${_parent_full_dir} NAME)
#Try if <module-name>/<build-dir> is used
get_filename_component(_modules_dir ${_parent_full_dir} DIRECTORY)
if (module STREQUAL "ecl")
#use clone directory libecl
set(_clone_dir "libecl")
else()
set(_clone_dir "${module}")
endif()
if(IS_DIRECTORY ${_modules_dir}/${_clone_dir}/${_leaf_dir_name})
set(${module}_DIR ${_modules_dir}/${_clone_dir}/${_leaf_dir_name})
else()
string(REPLACE ${PROJECT_NAME} ${_clone_dir} _module_leaf ${_leaf_dir_name})
if(NOT _leaf_dir_name STREQUAL _module_leaf
AND IS_DIRECTORY ${_parent_full_dir}/${_module_leaf})
# We are using build directories named <prefix><module-name><postfix>
set(${module}_DIR ${_parent_full_dir}/${_module_leaf})
elseif(IS_DIRECTORY ${_parent_full_dir}/${_clone_dir})
# All modules are in a common build dir
set(${module}_DIR "${_parent_full_dir}/${_clone_dir}}")
endif()
endif()
endif()
if(${module}_DIR AND NOT IS_DIRECTORY ${${module}_DIR})
message(WARNING "Value ${${module}_DIR} passed to variable"
" ${module}_DIR is not a directory")
endif()
endmacro()

View File

@@ -1,6 +1,4 @@
if (NOT Boost_UNIT_TEST_FRAMEWORK_FOUND)
find_package (Boost 1.44.0 COMPONENTS unit_test_framework QUIET)
endif ()
find_package (Boost 1.44.0 COMPONENTS unit_test_framework QUIET)
if (Boost_UNIT_TEST_FRAMEWORK_FOUND)
# setup to do a test compile

View File

@@ -38,7 +38,7 @@ if (CXX_COMPAT_GCC)
# default optimization flags, if not set by user
set_default_option (CXX _opt_dbg "-O0" "(^|\ )-O")
set_default_option (CXX _opt_rel "-O2" "(^|\ )-O")
set_default_option (CXX _opt_rel "-O3" "(^|\ )-O")
# use these options for debug builds - no optimizations
add_options (ALL_LANGUAGES "${_prof_DEBUG}" ${_opt_dbg} "-DDEBUG")

View File

@@ -0,0 +1,50 @@
# Add static analysis tests for a given source file
macro(setup_static_analysis_tools)
find_package(CppCheck)
if(CMAKE_EXPORT_COMPILE_COMMANDS)
find_package(ClangCheck)
else()
message(STATUS "Disabling clang-check as CMAKE_EXPORT_COMPILE_COMMANDS is not enabled")
endif()
if(OPM_COMMON_ROOT)
set(DIR ${OPM_COMMON_ROOT})
elseif(OPM_MACROS_ROOT)
set(DIR ${OPM_MACROS_ROOT})
else()
set(DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(CPPCHECK_FOUND)
file(COPY ${DIR}/cmake/Scripts/cppcheck-test.sh
DESTINATION bin
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
if(CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS)
configure_file(${DIR}/cmake/Scripts/clang-check-test.sh.in
${CMAKE_BINARY_DIR}/CMakeFiles/clang-check-test.sh)
file(COPY ${CMAKE_BINARY_DIR}/CMakeFiles/clang-check-test.sh
DESTINATION bin
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
endmacro()
function(add_static_analysis_tests sources includes)
if(CPPCHECK_FOUND OR (CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS))
foreach(dep ${${includes}})
list(APPEND IPATHS -I ${dep})
endforeach()
foreach(src ${${sources}})
file(RELATIVE_PATH name ${PROJECT_SOURCE_DIR} ${src})
if(CPPCHECK_FOUND)
add_test(NAME cppcheck+${name}
COMMAND bin/cppcheck-test.sh ${CPPCHECK_PROGRAM} ${src} ${IPATHS}
CONFIGURATIONS analyze cppcheck)
endif()
if(CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS)
add_test(NAME clang-check+${name}
COMMAND bin/clang-check-test.sh ${CLANGCHECK_PROGRAM} ${src}
CONFIGURATIONS analyze clang-check)
endif()
endforeach()
endif()
endfunction()

View File

@@ -35,8 +35,7 @@ set (ewoms_DEPS
"dune-fem"
"opm-parser"
"opm-grid"
# librt (on some systems necessary for clock_gettime())
"librt REQUIRED"
"opm-core"
# valgrind client requests
"Valgrind"
# quadruple precision floating point calculations

View File

@@ -1,19 +0,0 @@
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
# defines that must be present in config.h for our headers
set (opm-benchmarks_CONFIG_VAR
)
# dependencies
set (opm-benchmarks_DEPS
# compile with C++0x/11 support if available
"CXX11Features REQUIRED"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
# OPM dependency
"opm-common"
"opm-core REQUIRED"
"opm-upscaling REQUIRED"
)

View File

@@ -3,7 +3,7 @@
# defines that must be present in config.h for our headers
set (opm-common_CONFIG_VAR
)
"HAS_ATTRIBUTE_UNUSED")
# dependencies
set (opm-common_DEPS

View File

@@ -8,6 +8,9 @@ set (opm-core_CONFIG_VAR
HAVE_DUNE_ISTL
HAVE_MPI
HAVE_PETSC
DUNE_ISTL_VERSION_MAJOR
DUNE_ISTL_VERSION_MINOR
DUNE_ISTL_VERSION_REVISION
)
# dependencies
@@ -26,10 +29,8 @@ set (opm-core_DEPS
"SuiteSparse COMPONENTS umfpack"
# solver
"SuperLU"
# xml processing (for config parsing)
"TinyXML"
# Ensembles-based Reservoir Tools (ERT)
"ERT REQUIRED"
"ecl REQUIRED"
# Look for MPI support
"MPI"
# PETSc numerical backend
@@ -42,5 +43,8 @@ set (opm-core_DEPS
"opm-parser REQUIRED"
# the code which implements the material laws
"opm-material REQUIRED"
# the code which implements the output routines
"opm-output REQUIRED"
# the code which implements grids
"opm-grid REQUIRED"
)

View File

@@ -12,8 +12,8 @@ set (opm-flowdiagnostics-applications_DEPS
# compile with C++0x/11 support if available
"CXX11Features REQUIRED"
"Boost 1.44.0
COMPONENTS filesystem system unit_test_framework REQUIRED"
"ERT REQUIRED"
COMPONENTS filesystem regex system unit_test_framework REQUIRED"
"ecl REQUIRED"
# prerequisite OPM modules
"opm-common REQUIRED;
opm-flowdiagnostics REQUIRED;

View File

@@ -6,12 +6,14 @@ set (opm-grid_CONFIG_VAR
DUNE_GRID_VERSION_MAJOR
DUNE_GRID_VERSION_MINOR
DUNE_GRID_VERSION_REVISION
DUNE_GEOMETRY_VERSION_MAJOR
DUNE_GEOMETRY_VERSION_MINOR
DUNE_GEOMETRY_VERSION_REVISION
DUNE_COMMON_VERSION_MAJOR
DUNE_COMMON_VERSION_MINOR
DUNE_COMMON_VERSION_REVISION
DUNE_ISTL_VERSION_MAJOR
DUNE_ISTL_VERSION_MINOR
DUNE_ISTL_VERSION_REVISION
HAVE_DUNE_ISTL
HAVE_MPI
HAVE_ZOLTAN
)
@@ -24,13 +26,11 @@ set (opm-grid_DEPS
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
# DUNE dependency
"dune-common REQUIRED;
dune-grid REQUIRED;
dune-geometry REQUIRED
dune-istl"
# OPM dependency
"opm-common REQUIRED;
opm-core REQUIRED"
"MPI"
"dune-common"
"dune-grid REQUIRED"
"dune-istl"
"opm-common REQUIRED"
"opm-parser REQUIRED"
"ZOLTAN"
)

View File

@@ -20,4 +20,6 @@ set (opm-material_DEPS
"opm-common REQUIRED"
# DUNE dependency
"dune-common REQUIRED"
# valgrind client requests
"Valgrind"
)

View File

@@ -16,7 +16,7 @@ set (opm-output_DEPS
"Boost 1.44.0
COMPONENTS unit_test_framework REQUIRED"
# Ensembles-based Reservoir Tools (ERT)
"ERT REQUIRED"
"ecl REQUIRED"
# Look for MPI support
"opm-common REQUIRED"
# Parser library for ECL-type simulation models

View File

@@ -5,6 +5,11 @@
set (opm-simulators_CONFIG_VAR
HAVE_OPM_GRID
HAVE_PTHREAD
HAVE_EWOMS
DUNE_ISTL_VERSION_MAJOR
DUNE_ISTL_VERSION_MINOR
DUNE_ISTL_VERSION_REVISION
HAVE_SUITESPARSE_UMFPACK
)
# dependencies
@@ -20,12 +25,15 @@ set (opm-simulators_DEPS
"dune-common REQUIRED;
dune-istl REQUIRED"
"ERTPython"
# OPM dependency
# Tim Davis' SuiteSparse archive
"SuiteSparse COMPONENTS umfpack"
# OPM dependency
"opm-common REQUIRED;
opm-parser REQUIRED;
opm-core REQUIRED;
opm-output REQUIRED;
opm-grid"
opm-parser REQUIRED;
opm-grid REQUIRED;
opm-core REQUIRED;
opm-output REQUIRED;
ewoms REQUIRED"
# Eigen
"Eigen3 3.2.0"
)

View File

@@ -26,7 +26,7 @@ set (opm-upscaling_DEPS
dune-geometry REQUIRED;
dune-grid REQUIRED;
opm-common REQUIRED;
opm-grid REQUIRED;
opm-core REQUIRED;
opm-grid REQUIRED;
opm-output REQUIRED"
)

View File

@@ -0,0 +1,23 @@
#!/bin/bash
# This script performs a single analysis using clang-check
# It is used by the 'make test' target in the buildsystems
# Usually you should use 'ctest -C clang-check' rather than calling this script directly
#
# Parameters: $1 = Application binary
# $2 = Source file to process
clangcheck_cmd=$1
source_file=$2
tmpfil=`mktemp`
$clangcheck_cmd -p @CMAKE_BINARY_DIR@ -analyze $source_file &> $tmpfil
cat $tmpfil
if test -s $tmpfil
then
rm $tmpfil
exit 1
fi
rm $tmpfil
exit 0

30
cmake/Scripts/cppcheck-test.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# This script performs a single analysis using cppcheck
# It is used by the 'make test' target in the buildsystems
# Usually you should use 'ctest -C cppcheck' rather than calling this script directly
#
# Parameters: $1 = Application binary
# $2 = Source file to process
# $3..$N = include path parameters (-I dir1 -I dir2 ...)
cppcheck_cmd=$1
source_file=$2
shift 2
tmpfil=`mktemp`
$cppcheck_cmd $@ --enable=all --suppress=unusedFunction $source_file &> $tmpfil
nmatch=`cat $tmpfil | grep "\[.*\]" | wc -l`
nsys=`cat $tmpfil | grep "\[/usr.*\]" | wc -l`
nnone=`cat $tmpfil | grep "\[\\*]" | wc -l`
ndef=`cat $tmpfil | grep "\[.*Too many #ifdef" | wc -l`
let "nval=$nmatch-$nsys-$nnone-$ndef"
if test $nval -gt 0
then
cat $tmpfil
rm $tmpfil
exit 1
fi
rm $tmpfil
exit 0

View File

@@ -19,51 +19,55 @@
# <http://www.vtk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file>
# propagate these properties from one build system to the other
set (@opm-project_NAME@_VERSION "@opm-project_VERSION@")
set (@opm-project_NAME@_DEFINITIONS "@opm-project_DEFINITIONS@")
set (@opm-project_NAME@_INCLUDE_DIRS "@opm-project_INCLUDE_DIRS@")
set (@opm-project_NAME@_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
set (@opm-project_NAME@_LINKER_FLAGS "@opm-project_LINKER_FLAGS@")
set (@opm-project_NAME@_CONFIG_VARS "@opm-project_CONFIG_VARS@")
# Prevent multiple inclusions
if(NOT @opm-project_NAME@_FOUND)
# libraries come from the build tree where this file was generated
set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@")
set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@")
mark_as_advanced (@opm-project_NAME@_LIBRARY)
# propagate these properties from one build system to the other
set (@opm-project_NAME@_VERSION "@opm-project_VERSION@")
set (@opm-project_NAME@_DEFINITIONS "@opm-project_DEFINITIONS@")
set (@opm-project_NAME@_INCLUDE_DIRS "@opm-project_INCLUDE_DIRS@")
set (@opm-project_NAME@_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
set (@opm-project_NAME@_LINKER_FLAGS "@opm-project_LINKER_FLAGS@")
set (@opm-project_NAME@_CONFIG_VARS "@opm-project_CONFIG_VARS@")
# not all projects have targets; conditionally add this part
if (NOT "@opm-project_TARGET@" STREQUAL "")
# add the library as a target, so that other things in the project including
# this file may depend on it and get rebuild if this library changes.
add_library (@opm-project_TARGET@ UNKNOWN IMPORTED)
set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}")
endif (NOT "@opm-project_TARGET@" STREQUAL "")
# libraries come from the build tree where this file was generated
set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@")
set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@")
mark_as_advanced (@opm-project_NAME@_LIBRARY)
# ensure that we build with support for C++11 to preserve ABI
string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string (REPLACE "@CXX_STDLIB_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
set (CMAKE_CXX_FLAGS "@CXX_STD0X_FLAGS@@CXX_SPACE@@CXX_STDLIB_FLAGS@ ${CMAKE_CXX_FLAGS}")
# not all projects have targets; conditionally add this part
if (NOT "@opm-project_TARGET@" STREQUAL "")
# add the library as a target, so that other things in the project including
# this file may depend on it and get rebuild if this library changes.
add_library (@opm-project_TARGET@ UNKNOWN IMPORTED)
set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}")
endif (NOT "@opm-project_TARGET@" STREQUAL "")
# same as above, but for C99
string (REPLACE "@C_STD99_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
set (CMAKE_C_FLAG "@C_STD99_FLAGS@ ${CMAKE_C_FLAGS}")
# build with OpenMP if that was found
if (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
string (REPLACE "@OpenMP_C_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
set (CMAKE_C_FLAG "@OpenMP_C_FLAGS@ ${CMAKE_C_FLAGS}")
endif (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
if (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
string (REPLACE "@OpenMP_CXX_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# ensure that we build with support for C++11 to preserve ABI
string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string (REPLACE "@CXX_STDLIB_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
set (CMAKE_C_FLAG "@OpenMP_CXX_FLAGS@ ${CMAKE_CXX_FLAGS}")
endif (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
set (CMAKE_CXX_FLAGS "@CXX_STD0X_FLAGS@@CXX_SPACE@@CXX_STDLIB_FLAGS@ ${CMAKE_CXX_FLAGS}")
# this is the contents of config.h as far as our probes can tell:
# same as above, but for C99
string (REPLACE "@C_STD99_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
set (CMAKE_C_FLAG "@C_STD99_FLAGS@ ${CMAKE_C_FLAGS}")
# extra code
@OPM_PROJECT_EXTRA_CODE@
# build with OpenMP if that was found
if (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
string (REPLACE "@OpenMP_C_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
set (CMAKE_C_FLAG "@OpenMP_C_FLAGS@ ${CMAKE_C_FLAGS}")
endif (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
if (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
string (REPLACE "@OpenMP_CXX_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
set (CMAKE_C_FLAG "@OpenMP_CXX_FLAGS@ ${CMAKE_CXX_FLAGS}")
endif (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
# this is the contents of config.h as far as our probes can tell:
# extra code
@OPM_PROJECT_EXTRA_CODE@
endif()

2
debian/changelog vendored
View File

@@ -1,4 +1,4 @@
opm-common (2015.10-1~trusty) trusty; urgency=medium
opm-common (2017.10-rfinal-1~xenial) xenial; urgency=medium
* New release

2
debian/rules vendored
View File

@@ -20,7 +20,7 @@ override_dh_auto_build:
# consider using -DUSE_VERSIONED_DIR=ON if backporting
override_dh_auto_configure:
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-common1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-common1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF
override_dh_auto_install:
dh_auto_install -- install-html

View File

@@ -5,8 +5,8 @@
Module: opm-common
Description: Open Porous Media Initiative shared infrastructure
Version: 2016.10-pre
Label: 2016.10-pre
Version: 2017.10
Label: 2017.10
Maintainer: opm@opm-project.org
MaintainerName: OPM community
Url: http://opm-project.org

View File

@@ -83,9 +83,19 @@ function build_module {
test $? -eq 0 || exit 1
if test $2 -eq 1
then
cmake --build .
if [ ! -z $BUILDTHREADS ]
then
cmake --build . -- -j$BUILDTHREADS
else
cmake --build .
fi
test $? -eq 0 || exit 2
ctest -T Test --no-compress-output
if test -z "$CTEST_CONFIGURATION"
then
ctest -T Test --no-compress-output
else
ctest -C $CTEST_CONFIGURATION --timeout 5000 -T Test --no-compress-output
fi
# Convert to junit format
$WORKSPACE/deps/opm-common/jenkins/convert.py -x $WORKSPACE/deps/opm-common/jenkins/conv.xsl -t . > testoutput.xml
@@ -96,7 +106,12 @@ function build_module {
sed -e "s/classname=\"TestSuite\"/classname=\"${configuration}\"/g" testoutput.xml > $WORKSPACE/$configuration/testoutput.xml
fi
else
cmake --build . --target install
if [ ! -z $BUILDTHREADS ]
then
cmake --build . --target install -- -j$BUILDTHREADS
else
cmake --build . --target install
fi
fi
}
@@ -109,9 +124,9 @@ function clone_module {
mkdir -p $WORKSPACE/deps/$1
cd $WORKSPACE/deps/$1
git init .
if [ "$1" == "ert" ]
if [ "$1" == "libecl" ]
then
git remote add origin https://github.com/Ensembles/$1
git remote add origin https://github.com/Statoil/$1
else
git remote add origin https://github.com/OPM/$1
fi
@@ -173,7 +188,13 @@ function build_downstreams {
# Installation for downstream
pushd .
cd $WORKSPACE/$configuration/build-$downstream
cmake --build . --target install
if [ ! -z $BUILDTHREADS ]
then
cmake --build . --target install -- -j$BUILDTHREADS
else
cmake --build . --target install
fi
popd
egrep_cmd="$egrep_cmd $WORKSPACE/$configuration/build-$downstream/testoutput.xml"
done

View File

@@ -8,26 +8,27 @@ ln -sf $WORKSPACE deps/opm-common
# Downstreams and revisions
declare -a downstreams
downstreams=(ert
downstreams=(libecl
opm-parser
opm-output
opm-material
opm-core
opm-grid
opm-core
ewoms
opm-simulators
opm-upscaling
ewoms)
)
declare -A downstreamRev
downstreamRev[ert]=master
downstreamRev[libecl]=master
downstreamRev[opm-parser]=master
downstreamRev[opm-material]=master
downstreamRev[opm-core]=master
downstreamRev[opm-grid]=master
downstreamRev[opm-output]=master
downstreamRev[ewoms]=master
downstreamRev[opm-simulators]=master
downstreamRev[opm-upscaling]=master
downstreamRev[ewoms]=master
parseRevisions
printHeader opm-common

93
jenkins/update-opm-data.sh Executable file
View File

@@ -0,0 +1,93 @@
#!/bin/bash
MAIN_REPO=$1 # The repo the update was triggered from
source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh
declare -a upstreams # Everything is considered an upstream to aid code reuse
upstreams=(libecl
opm-common
opm-parser
opm-output
opm-material
opm-grid
opm-core
ewoms
opm-simulators
opm-upscaling
)
declare -A upstreamRev
upstreamRev[libecl]=master
upstreamRev[opm-common]=master
upstreamRev[opm-parser]=master
upstreamRev[opm-material]=master
upstreamRev[opm-core]=master
upstreamRev[opm-grid]=master
upstreamRev[opm-output]=master
upstreamRev[ewoms]=master
upstreamRev[opm-simulators]=master
upstreamRev[opm-upscaling]=master
# Setup revision tables
parseRevisions
upstreamRev[$MAIN_REPO]=$sha1
# Create branch name
BRANCH_NAME="update"
for repo in ${upstreams[*]}
do
if [ "${upstreamRev[$repo]}" != "master" ]
then
rev=${upstreamRev[$repo]}
prnumber=${rev//[!0-9]/}
BRANCH_NAME="${BRANCH_NAME}_${repo}_$prnumber"
test -n "$REASON" && REASON+=" "
REASON+="https://github.com/OPM/$repo/pull/$prnumber\n"
fi
done
# Do the commit
export REASON
export BRANCH_NAME
$WORKSPACE/deps/opm-simulators/tests/update_reference_data.sh $OPM_DATA_ROOT
# Finally open the pull request
cd $OPM_DATA_ROOT
git remote add jenkins4opm git@github.com:jenkins4opm/opm-data
# Do some cleaning of old remote branches
# Easier code with git 2.7+
#BRANCHES=`git branch --sort=committerdate -r | grep jenkins4opm`
#NBRANCHES=`git branch --sort=committerdate -r | grep jenkins4opm | wc -l`
git fetch jenkins4opm # Sadly necessary with older git
BRANCHES=`git for-each-ref --sort=committerdate refs/remotes/jenkins4opm/ --format='%(refname:short)'`
NBRANCHES=`git for-each-ref --sort=committerdate refs/remotes/jenkins4opm/ --format='%(refname:short)' | wc -l`
if test $NBRANCHES -gt 30
then
for BRANCH in $BRANCHES
do
BNAME=`echo $BRANCH | cut -f1 -d '/' --complement`
if [ "$BNAME" != "HEAD" ]
then
git push jenkins4opm :$BNAME
fi
NBRANCHES=$((NBRANCHES-1))
if test $NBRANCHES -lt 30
then
break
fi
done
fi
if [ -n "`echo $BRANCHES | tr ' ' '\n' | grep ^jenkins4opm/$BRANCH_NAME$`" ]
then
GH_TOKEN=`git config --get gitOpenPull.Token`
REV=${upstreamRev[$MAIN_REPO]}
PRNUMBER=${rev//[!0-9]/}
DATA_PR=`curl -X GET https://api.github.com/repos/OPM/opm-data/pulls?head=jenkins4opm:$BRANCH_NAME | grep '"number":' | awk -F ':' '{print $2}' | sed -e 's/,//'`
git push -u jenkins4opm $BRANCH_NAME -f
curl -d "{ \"body\": \"Existing PR https://github.com/OPM/opm-data/pull/$DATA_PR was updated\" }" -X POST https://api.github.com/repos/OPM/$MAIN_REPO/issues/$PRNUMBER/comments?access_token=$GH_TOKEN
else
git-open-pull -u jenkins4opm --base-account OPM --base-repo opm-data -r /tmp/cmsg $BRANCH_NAME
fi

View File

@@ -58,6 +58,13 @@ public:
: NumericalProblem(message)
{}
};
class TooManyIterations : public NumericalProblem
{
public:
explicit TooManyIterations(const std::string &message)
: NumericalProblem(message)
{}
};
}
#endif // OPM_EXCEPTIONS_HPP

View File

@@ -33,7 +33,7 @@ namespace Opm {
class CounterLog : public LogBackend
{
public:
CounterLog(int64_t messageMask);
explicit CounterLog(int64_t messageMask);
CounterLog();
size_t numMessages(int64_t messageType) const;

View File

@@ -58,16 +58,16 @@ namespace Log {
prefix = "Info";
break;
case MessageType::Warning:
prefix = "Warning";
prefix = "\nWarning";
break;
case MessageType::Error:
prefix = "Error";
prefix = "\nError";
break;
case MessageType::Problem:
prefix = "Problem";
prefix = "\nProblem";
break;
case MessageType::Bug:
prefix = "Bug";
prefix = "\nBug";
break;
default:
throw std::invalid_argument("Unhandled messagetype");
@@ -85,8 +85,9 @@ namespace Log {
return message; // No color coding, not even the code for default color.
case MessageType::Warning:
return AnsiTerminalColors::blue_strong + message + AnsiTerminalColors::none;
case MessageType::Error:
case MessageType::Problem:
return AnsiTerminalColors::magenta_strong + message + AnsiTerminalColors::none;
case MessageType::Error:
case MessageType::Bug:
return AnsiTerminalColors::red_strong + message + AnsiTerminalColors::none;
default:

View File

@@ -49,6 +49,8 @@ namespace Log {
const std::string yellow_strong = "\033[33;1m";
const std::string blue = "\033[34m";
const std::string blue_strong = "\033[34;1m";
const std::string magenta = "\033[35m";
const std::string magenta_strong = "\033[35;1m";
const std::string default_color = "\033[39m";
}

View File

@@ -64,7 +64,7 @@ namespace Opm
}
SimpleMessageFormatter(const bool use_color_coding)
explicit SimpleMessageFormatter(const bool use_color_coding)
: use_color_coding_(use_color_coding)
{
prefix_flag_ = Log::MessageType::Warning + Log::MessageType::Error

View File

@@ -62,7 +62,7 @@ namespace Opm
{
}
MessageLimiter(const int tag_limit, const std::map<int64_t, int> category_limits)
MessageLimiter(const int tag_limit, const std::map<int64_t, int>& category_limits)
: tag_limit_(tag_limit < 0 ? NoLimit : tag_limit),
category_limits_(category_limits)
{

View File

@@ -21,9 +21,27 @@
#include <opm/common/OpmLog/Logger.hpp>
#include <opm/common/OpmLog/StreamLog.hpp>
#include <iostream>
#include <errno.h> // For errno
#include <stdio.h> // For fileno() and stdout
#include <unistd.h> // For isatty()
namespace Opm {
namespace {
bool stdoutIsTerminal()
{
const int errno_save = errno; // For playing nice with C error handling.
const int file_descriptor = fileno(stdout);
if (file_descriptor == -1) {
// stdout is an invalid stream
errno = errno_save;
return false;
} else {
return isatty(file_descriptor);
}
}
}
std::shared_ptr<Logger> OpmLog::getLogger() {
if (!m_logger)
@@ -176,12 +194,14 @@ namespace Opm {
void OpmLog::setupSimpleDefaultLogging(const bool use_prefix)
void OpmLog::setupSimpleDefaultLogging(const bool use_prefix,
const bool use_color_coding,
const int message_limit)
{
std::shared_ptr<StreamLog> streamLog = std::make_shared<StreamLog>(std::cout, Log::DefaultMessageTypes);
OpmLog::addBackend( "SimpleDefaultLog", streamLog);
streamLog->setMessageLimiter(std::make_shared<MessageLimiter>(10));
streamLog->setMessageFormatter(std::make_shared<SimpleMessageFormatter>(use_prefix, true));
streamLog->setMessageLimiter(std::make_shared<MessageLimiter>(message_limit));
streamLog->setMessageFormatter(std::make_shared<SimpleMessageFormatter>(use_prefix, use_color_coding && stdoutIsTerminal()));
}
/******************************************************************/

View File

@@ -64,17 +64,26 @@ public:
static void removeAllBackends();
static bool enabledMessageType( int64_t messageType );
static void addMessageType( int64_t messageType , const std::string& prefix);
static void setupSimpleDefaultLogging(const bool use_prefix);
/// Create a basic logging setup that will send all log messages to standard output.
///
/// By default category prefixes will be printed (i.e. Error: or
/// Warning:), color coding will be used, and a maximum of 10
/// messages with the same tag will be printed. These settings can
/// be controlled by the function parameters.
static void setupSimpleDefaultLogging(const bool use_prefix = true,
const bool use_color_coding = true,
const int message_limit = 10);
template <class BackendType>
static std::shared_ptr<BackendType> getBackend(const std::string& name) {
auto logger = OpmLog::getLogger();
auto logger = getLogger();
return logger->getBackend<BackendType>(name);
}
template <class BackendType>
static std::shared_ptr<BackendType> popBackend(const std::string& name) {
auto logger = OpmLog::getLogger();
auto logger = getLogger();
return logger->popBackend<BackendType>(name);
}

View File

@@ -32,11 +32,13 @@ namespace Opm {
TimerLog::TimerLog(const std::string& logFile) : StreamLog( logFile , StopTimer | StartTimer )
{
m_work.precision(8);
m_start = 0;
}
TimerLog::TimerLog(std::ostream& os) : StreamLog( os , StopTimer | StartTimer )
{
m_work.precision(8);
m_start = 0;
}

View File

@@ -39,8 +39,8 @@ public:
static const int64_t StartTimer = 4096;
static const int64_t StopTimer = 8192;
TimerLog(const std::string& logFile);
TimerLog(std::ostream& os);
explicit TimerLog(const std::string& logFile);
explicit TimerLog(std::ostream& os);
void clear();
~TimerLog() {};

View File

@@ -0,0 +1,62 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file
* \brief Provides a free function to reset the localization settings
*
* Under some circumstances, some environments seem to set a locale which they do not
* install. In turn this leads to std::runtime_errror being thrown by some parts of Boost
* (for some versions) which causes unsolicited program aborts.
*
* This issue asside, it looks pretty weird if the e.g. the number format is inconsistent
* with the language used by rest of the simulation.
*/
#ifndef OPM_RESET_LOCALE_HH
#define OPM_RESET_LOCALE_HH
#include <stdlib.h>
namespace Opm {
inline void resetLocale()
{
#ifndef WIN32
// this probably only works for POSIX compatible operating systems. for all others,
// unsetting a few environment variables should not hurt, though.
unsetenv("LC_ALL");
unsetenv("LANG");
unsetenv("LANGUAGE");
unsetenv("LC_ADDRESS");
unsetenv("LC_COLLATE");
unsetenv("LC_CTYPE");
unsetenv("LC_IDENTIFICATION");
unsetenv("LC_MEASUREMENT");
unsetenv("LC_MESSAGES");
unsetenv("LC_MONETARY");
unsetenv("LC_NAME");
unsetenv("LC_NUMERIC");
unsetenv("LC_PAPER");
unsetenv("LC_TELEPHONE");
unsetenv("LC_TIME");
#endif // !WIN32
}
} // namespace Opm
#endif

43
opm/common/Unused.hpp Normal file
View File

@@ -0,0 +1,43 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file
* \brief Provides the OPM_UNUSED macro
*
* This macro can be used to mark variables as "potentially unused" which suppresses some
* bogus compiler warnings. If the compiler does not support this, the macro is a no-op.
*/
#ifndef OPM_UNUSED_HH
#define OPM_UNUSED_HH
#ifndef HAS_ATTRIBUTE_UNUSED
#define OPM_UNUSED
#else
#define OPM_UNUSED __attribute__((unused))
#endif
#ifdef NDEBUG
#define OPM_DEBUG_UNUSED
#define OPM_OPTIM_UNUSED OPM_UNUSED
#else
#define OPM_DEBUG_UNUSED OPM_UNUSED
#define OPM_OPTIM_UNUSED
#endif
#endif

311
opm/common/Valgrind.hpp Normal file
View File

@@ -0,0 +1,311 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
* \brief Some templates to wrap the valgrind client request macros
*/
#ifndef OPM_VALGRIND_HPP
#define OPM_VALGRIND_HPP
#include <opm/common/Unused.hpp>
#if HAVE_VALGRIND
#include <valgrind/memcheck.h>
#endif
#if HAVE_VALGRIND
#define OPM_VALGRIND_OPTIM_UNUSED OPM_OPTIM_UNUSED
#else
#define OPM_VALGRIND_OPTIM_UNUSED OPM_UNUSED
#endif
namespace Opm {
namespace Valgrind {
/*!
* \ingroup Valgrind
* \brief Returns whether the program is running under Valgrind or not.
*/
inline bool IsRunning()
{
#if !defined NDEBUG && HAVE_VALGRIND
return RUNNING_ON_VALGRIND;
#else
return false;
#endif
}
/*!
* \ingroup Valgrind
* \brief Make valgrind complain if any of the memory occupied by an object
* is undefined.
*
* Please note that this does not check whether the destinations of an
* object's pointers or references are defined. Also, for performance
* reasons the compiler might insert "padding bytes" between within
* the objects which leads to false positives.
*
* Example:
*
* \code
* int i;
* Valgrind::CheckDefined(i); // Valgrind complains!
* \endcode
*
* \tparam T The type of the object which ought to be checked
*
* \param value the object which valgrind should check
*
* \return true iff there are no undefined bytes in the memory
* occupied by the object.
*/
template <class T>
inline bool CheckDefined(const T& value OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
auto tmp = VALGRIND_CHECK_MEM_IS_DEFINED(&value, sizeof(T));
return tmp == 0;
#else
return true;
#endif
}
/*!
* \ingroup Valgrind
* \brief Make valgrind complain if any of the memory occupied by an object
* is not addressable.
*
* Example:
*
* \code
* int* i = NULL;
* Valgrind::CheckAddressable(*i); // Valgrind complains!
* \endcode
*
* \tparam T The type of the object which ought to be checked
*
* \param value the object which valgrind should check
*
* \return true iff there are no unadressable bytes in the memory
* occupied by the object.
*/
template <class T>
inline bool CheckAddressable(const T& value OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
auto tmp = VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&value, sizeof(T));
return tmp == 0;
#else
return true;
#endif
}
/*!
* \ingroup Valgrind
* \brief Make valgrind complain if any of the the memory occupied
* by a C-style array objects is undefined.
*
* Please note that this does not check whether the destinations of an
* object's pointers or references are defined. Also, for performance
* reasons the compiler might insert "padding bytes" between within
* the objects which leads to false positives.
*
* Example:
*
* \code
* int i[2];
* Valgrind::CheckDefined(i, 2); // Valgrind complains!
* \endcode
*
* \tparam T The type of the object which ought to be checked
*
* \param value Pointer to the first object of the array.
* \param size The size of the array in number of objects
*
* \return true iff there are no undefined bytes in the memory
* occupied by the array.
*/
template <class T>
inline bool CheckDefined(const T* value OPM_VALGRIND_OPTIM_UNUSED, int size OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
auto tmp = VALGRIND_CHECK_MEM_IS_DEFINED(value, size*sizeof(T));
return tmp == 0;
#else
return true;
#endif
}
/*!
* \ingroup Valgrind
* \brief Make the memory on which an object resides undefined in
* valgrind runs.
*
* Example:
*
* \code
* int i = 0;
* Valgrind::SetUndefined(i);
* Valgrind::CheckDefined(i); // Valgrind complains!
* \endcode
*
* \tparam T The type of the object which ought to be set to undefined
*
* \param value The object which's memory valgrind should be told is undefined
*/
template <class T>
inline void SetUndefined(const T &value OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
VALGRIND_MAKE_MEM_UNDEFINED(&value, sizeof(T));
#endif
}
/*!
* \ingroup Valgrind
* \brief Make the memory on which an array of object resides
* undefined in valgrind runs.
*
* Example:
*
* \code
* int i[3] = {0, 1, 3};
* Valgrind::SetUndefined(&i[1], 2);
* Valgrind::CheckDefined(i, 3); // Valgrind complains!
* \endcode
*
* \tparam T The type of the object which ought to be set to undefined
*
* \param value Pointer to the first object of the array.
* \param size The size of the array in number of objects
*/
template <class T>
inline void SetUndefined(const T* value OPM_VALGRIND_OPTIM_UNUSED, int size OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
VALGRIND_MAKE_MEM_UNDEFINED(value, size*sizeof(T));
#endif
}
/*!
* \ingroup Valgrind
* \brief Make the memory on which an object resides defined.
*
* Example:
*
* \code
* int i;
* Valgrind::SetDefined(i);
* Valgrind::CheckDefined(i); // Valgrind does not complain!
* \endcode
*
* \tparam T The type of the object which valgrind should consider as defined
*
* \param value The object which's memory valgrind should consider as defined
*/
template <class T>
inline void SetDefined(const T& value OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
VALGRIND_MAKE_MEM_DEFINED(&value, sizeof(T));
#endif
}
/*!
* \ingroup Valgrind
* \brief Make the memory on which a C-style array of objects resides
* defined.
*
* Example:
*
* \code
* int i[3];
* Valgrind::SetDefined(i, 3);
* Valgrind::CheckDefined(i, 3); // Valgrind does not complain!
* \endcode
*
* \tparam T The type of the object which valgrind should consider as defined
*
* \param value Pointer to the first object of the array.
* \param n The size of the array in number of objects
*/
template <class T>
inline void SetDefined(const T *value OPM_VALGRIND_OPTIM_UNUSED, int n OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
VALGRIND_MAKE_MEM_DEFINED(value, n*sizeof(T));
#endif
}
/*!
* \ingroup Valgrind
* \brief Make valgrind complain if an object's memory is accessed.
*
* Example:
*
* \code
* int i = 1;
* Valgrind::SetNoAccess(i);
* int j = i; // Valgrind complains!
* \endcode
*
* \tparam T The type of the object which valgrind should complain if accessed
*
* \param value The object which's memory valgrind should complain if accessed
*/
template <class T>
inline void SetNoAccess(const T &value OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
VALGRIND_MAKE_MEM_NOACCESS(&value, sizeof(T));
#endif
}
/*!
* \ingroup Valgrind
* \brief Make valgrind complain if the memory of a C-style array of
* objects is accessed.
*
* Example:
*
* \code
* int i[3] = {0, 1, 2};
* Valgrind::SetNoAccess(i, 2);
* int j = i[1]; // Valgrind complains!
* \endcode
*
* \param value Pointer to the first object of the array.
* \param size The size of the array in number of objects
*/
template <class T>
inline void SetNoAccess(const T *value OPM_VALGRIND_OPTIM_UNUSED, int size OPM_VALGRIND_OPTIM_UNUSED)
{
#if !defined NDEBUG && HAVE_VALGRIND
VALGRIND_MAKE_MEM_NOACCESS(value, size*sizeof(T));
#endif
}
}} // namespace Valgrind, Opm
#endif

View File

@@ -73,6 +73,9 @@
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wcast-qual"
#pragma GCC diagnostic ignored "-Wignored-attributes"
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
#endif // COMPATIBLE_COMPILER
#endif // SILENCE_EXTERNAL_WARNINGS

View File

@@ -2,19 +2,19 @@
# spec file for package opm-common
#
%define tag rc4
%define tag final
Name: opm-common
Version: 2015.10
Version: 2017.10
Release: 0
Summary: Open Porous Media - common helpers and buildsystem
License: GPL-3.0
Group: Development/Libraries/C and C++
Url: http://www.opm-project.org/
Source0: https://github.com/OPM/%{name}/archive/release/%{version}/%{tag}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: git doxygen bc
%{?el6:BuildRequires: devtoolset-3-toolchain cmake28 boost148-devel}
%{!?el6:BuildRequires: gcc gcc-c++ cmake boost-devel}
BuildRequires: git doxygen bc devtoolset-6-toolchain
%{?el6:BuildRequires: cmake3 boost148-devel}
%{!?el6:BuildRequires: cmake boost-devel}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -48,8 +48,8 @@ This package contains the documentation files for opm-common
# consider using -DUSE_VERSIONED_DIR=ON if backporting
%build
%{?el6:scl enable devtoolset-3 bash}
%{?el6:cmake28} %{?!el6:cmake} -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DUSE_RUNPATH=OFF %{?el6:-DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/gfortran -DBOOST_LIBRARYDIR=%{_libdir}/boost148 -DBOOST_INCLUDEDIR=%{_includedir}/boost148}
scl enable devtoolset-6 bash
%{?el6:cmake28} %{?!el6:cmake} -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gfortran %{?el6:-DBOOST_LIBRARYDIR=%{_libdir}/boost148 -DBOOST_INCLUDEDIR=%{_includedir}/boost148}
make
%install

View File

@@ -48,8 +48,8 @@ BOOST_AUTO_TEST_CASE(DoLogging) {
BOOST_AUTO_TEST_CASE(Test_Format) {
BOOST_CHECK_EQUAL( "There is an error here?\nIn file /path/to/file, line 100\n" , Log::fileMessage("/path/to/file" , 100 , "There is an error here?"));
BOOST_CHECK_EQUAL( "Error: This is the error" , Log::prefixMessage(Log::MessageType::Error , "This is the error"));
BOOST_CHECK_EQUAL( "Warning: This is the warning" , Log::prefixMessage(Log::MessageType::Warning , "This is the warning"));
BOOST_CHECK_EQUAL( "\nError: This is the error" , Log::prefixMessage(Log::MessageType::Error , "This is the error"));
BOOST_CHECK_EQUAL( "\nWarning: This is the warning" , Log::prefixMessage(Log::MessageType::Warning , "This is the warning"));
BOOST_CHECK_EQUAL( "Info: This is the info" , Log::prefixMessage(Log::MessageType::Info , "This is the info"));
}
@@ -250,10 +250,10 @@ BOOST_AUTO_TEST_CASE(TestHelperFunctions)
// fileMessage
BOOST_CHECK_EQUAL(fileMessage("foo/bar", 1, "message"), "message\nIn file foo/bar, line 1\n");
BOOST_CHECK_EQUAL(fileMessage(MessageType::Error, "foo/bar", 1, "message"), "Error: message\nIn file foo/bar, line 1\n");
BOOST_CHECK_EQUAL(fileMessage(MessageType::Error, "foo/bar", 1, "message"), "\nError: message\nIn file foo/bar, line 1\n");
// prefixMessage
BOOST_CHECK_EQUAL(prefixMessage(MessageType::Error, "message"), "Error: message");
BOOST_CHECK_EQUAL(prefixMessage(MessageType::Error, "message"), "\nError: message");
BOOST_CHECK_EQUAL(prefixMessage(MessageType::Info, "message"), "Info: message");
BOOST_CHECK_EQUAL(prefixMessage(MessageType::Note, "message"), "Note: message");
@@ -356,7 +356,7 @@ BOOST_AUTO_TEST_CASE(TestOpmLogWithLimits)
+ Log::colorCodeMessage(Log::MessageType::Info, "Info") + "\n"
+ Log::colorCodeMessage(Log::MessageType::Bug, "Bug") + "\n"
+ Log::colorCodeMessage(Log::MessageType::Warning, "Warning") + "\n"
+ Log::colorCodeMessage(Log::MessageType::Warning, "Message limit reached for message category: Warning") + "\n";
+ Log::colorCodeMessage(Log::MessageType::Warning, "Message limit reached for message category: \nWarning") + "\n";
BOOST_CHECK_EQUAL(log_stream2.str(), expected2);

View File

@@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e
pushd . > /dev/null
opm-common/travis/build-opm-common.sh
cd opm-common/build
ctest --output-on-failure
popd > /dev/null

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -e
build_order=(opm-common opm-parser opm-material opm-output opm-core opm-grid ewoms opm-simulators opm-upscaling)
build_order=(opm-common opm-parser opm-output opm-material opm-grid opm-core ewoms opm-simulators)
# This shell script should be started with the name of a module as
# only only command line argument. It will start by building all
@@ -30,7 +30,7 @@ function upstream_build {
echo "Building: ${project}"
mkdir -p ${project}/build
pushd ${project}/build > /dev/null
cmake ../ -DENABLE_PYTHON=ON -DBUILD_TESTING=OFF -DSILENCE_EXTERNAL_WARNINGS=True -DUSE_QUADMATH=OFF -DADD_DISABLED_CTESTS=OFF
cmake ../ -DENABLE_PYTHON=ON -DBUILD_TESTING=OFF -DSILENCE_EXTERNAL_WARNINGS=ON -DUSE_QUADMATH=OFF -DADD_DISABLED_CTESTS=OFF
make
popd > /dev/null
}
@@ -44,9 +44,14 @@ function downstream_build_and_test {
# The build commands cmake, make and ctest must be given as
# separate commands and not chained with &&. If chaining with &&
# is used the 'set -e' does not exit on first error.
cmake ../ -DENABLE_PYTHON=ON -DBUILD_TESTING=ON -DSILENCE_EXTERNAL_WARNINGS=True -DUSE_QUADMATH=OFF -DADD_DISABLED_CTESTS=OFF
make
ctest --output-on-failure
if [ "$project" == "ewoms" ]; then
cmake ../ -DENABLE_PYTHON=ON -DBUILD_TESTING=OFF -DSILENCE_EXTERNAL_WARNINGS=ON -DUSE_QUADMATH=OFF -DADD_DISABLED_CTESTS=OFF
make
else
cmake ../ -DENABLE_PYTHON=ON -DBUILD_TESTING=ON -DSILENCE_EXTERNAL_WARNINGS=ON -DUSE_QUADMATH=OFF -DADD_DISABLED_CTESTS=OFF
make
ctest --output-on-failure
fi
popd > /dev/null
}

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -e
pushd . > /dev/null
cd opm-common
mkdir build
cd build
cmake ../ -DBUILD_SHARED_LIBS=ON
make
popd > /dev/null

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -e
pushd . > /dev/null
cd opm-common
mkdir build
cd build
cmake ../
make
popd > /dev/null

View File

@@ -25,7 +25,7 @@ function build_dune {
pushd . > /dev/null
git clone ${url}
cd ${project}
git checkout tags/v2.3.1
git checkout tags/v2.4.1
mkdir build
cd build
cmake ../
@@ -62,11 +62,11 @@ function install_python_deps {
}
function build_ert {
function build_libecl {
install_python_deps
git clone https://github.com/Ensembles/ert.git
mkdir -p ert/build
pushd ert/build > /dev/null
git clone https://github.com/Statoil/libecl.git
mkdir -p libecl/build
pushd libecl/build > /dev/null
cmake .. && make
popd > /dev/null
}
@@ -75,7 +75,7 @@ function build_ert {
#################################################################
build_superlu
build_ert
build_libecl
build_dune dune-common
build_dune dune-istl