Compare commits

...

444 Commits

Author SHA1 Message Date
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
Atgeirr Flø Rasmussen
4947c64556 Merge pull request #192 from qilicun/fix-error-summary
Correct error summary category.
2016-10-21 11:04:45 +02:00
Atgeirr Flø Rasmussen
7226f67e0d Merge pull request #188 from dr-robertk/PR/fix-istl-dependency-opm-grid
[bugfix] since HAVE_DUNE_ISTL is used in opm-grid it should be tested for.
2016-10-21 11:00:11 +02:00
Liu Ming
cc0dc95de6 correct error summary category. 2016-10-20 20:58:04 +08:00
Atgeirr Flø Rasmussen
46c1dfe3b4 Merge pull request #186 from qilicun/messages-limits
Support category limits setting.
2016-10-20 09:22:28 +02:00
Liu Ming
a4f4578dc1 Merge pull request #1 from atgeirr/qilicun-messages-limits
Revised message limits work
2016-10-20 09:02:53 +08:00
Atgeirr Flø Rasmussen
0283536ac4 Finish revision of logging. 2016-10-19 15:08:46 +02:00
Atgeirr Flø Rasmussen
35514c0aa0 Improve MessageLimiter class. 2016-10-19 13:11:13 +02:00
Atgeirr Flø Rasmussen
68311cf5b3 Merge branch 'messages-limits' of https://github.com/qilicun/opm-common into qilicun-messages-limits 2016-10-19 10:58:26 +02:00
Robert Kloefkorn
b9af87abc2 [bugfix] since HAVE_DUNE_ISTL is used in opm-grid it should be tested for. It's
not a hard dependency, though.
2016-10-18 17:30:22 +02:00
Arne Morten Kvarving
bd52696fc2 Merge pull request #187 from akva2/fix_cxx11_opm_grid
fixed: turns out skipping the (unnecessary) c++11 tests cause issues
2016-10-18 15:40:01 +02:00
Arne Morten Kvarving
e3793e3577 fixed: turns out skipping the (unnecessary) c++11 tests cause issues
these defines are not used in OPM, but they are used in headers
from dune. 10x cola for me.
2016-10-18 15:02:47 +02:00
Liu Ming
9020c7cb36 Support category limits setting. 2016-10-18 19:26:06 +08:00
Atgeirr Flø Rasmussen
c32693f44c Merge pull request #185 from atgeirr/add-nolog-throw
Add OPM_THROW_NOLOG macro.
2016-10-18 08:55:25 +02:00
Atgeirr Flø Rasmussen
f998f52d61 Merge pull request #184 from akva2/use_cmake_cxx11
added: use cmake mechanisms to enable c++11 with cmake >= 3.1
2016-10-18 08:54:23 +02:00
Atgeirr Flø Rasmussen
3b22b584f3 Add OPM_THROW_NOLOG macro. 2016-10-17 13:02:50 +02:00
Arne Morten Kvarving
e329f502ba added: use cmake mechanisms to enable c++11 with cmake >= 3.1
as a bonus it makes it easy to experiment with c++14
2016-10-17 11:56:44 +02:00
Arne Morten Kvarving
1216bc0525 Merge pull request #183 from akva2/update_packaging_devtoolset
update redhat6 packaging
2016-10-12 15:53:26 +02:00
Arne Morten Kvarving
924e4d6ad1 update redhat6 packaging
build using devtoolset-3
2016-10-12 14:07:46 +02:00
Arne Morten Kvarving
d47816eb84 Merge pull request #182 from joakim-hove/update-find-output
Update find output
2016-10-12 11:47:59 +02:00
Joakim Hove
8bb00bc1e2 Updated Findopm-output to reflect repo changes. 2016-10-07 11:31:38 +02:00
Joakim Hove
69d0edc558 Merge pull request #181 from pgdr/add-findcwrap
Added FindCwrap, add to pythonpath
2016-10-05 14:14:26 +02:00
Pål Grønås Drange
dac092dc8b Added FindCwrap, add to pythonpath 2016-10-04 12:57:38 +02:00
Atgeirr Flø Rasmussen
e83fa6d066 Merge pull request #180 from akva2/update_petsc
changed: update petsc module for newer petsc
2016-09-29 16:50:44 +02:00
Arne Morten Kvarving
899730284a changed: update petsc module for newer petsc
newer petsc changed layout a bit. as of petsc 3.6.4 a
proper pkg-config file is ready for use.

additionally, align the find module with how petsc is expected to be
configured. the environment variable PETSC_DIR is the root of the source
tree and PETSC_ARCH is the build configuration, located in
$PETSC_DIR/$PETSC_ARCH

the old approach is kept for backwards compatibility but will not work
with newer petsc, in particular not if petsc is built static.
2016-09-29 14:17:31 +02:00
Atgeirr Flø Rasmussen
dd52371189 Merge pull request #175 from blattms/allow-quiet-EclipsePRTLog
Allow disabling output in EclipsePRTLog.
2016-09-26 09:18:15 +02:00
Atgeirr Flø Rasmussen
e7a047d53d Merge pull request #172 from atgeirr/use-map-for-simulationdatacontainer
Use map instead of unordered_map.
2016-09-22 18:40:05 +02:00
Andreas Lauser
9e0a5cea6c Merge pull request #177 from andlaus/optional_dune-localfunctions
make dune-localfunctions optional for eWoms
2016-09-22 17:20:04 +02:00
Arne Morten Kvarving
5d158d81e2 Merge pull request #176 from blattms/activate-dune-mpi-2-if-available
Check for MPI 2 functionality and activate it for DUNE.
2016-09-22 09:22:12 +02:00
Andreas Lauser
04d7375f9c make dune-localfunctions optional for eWoms
this is the build system side of OPM/ewoms#70...
2016-09-21 19:15:38 +02:00
Markus Blatt
333011212a Use MPI_C_* instead of MPI_CXX_* 2016-09-21 15:46:44 +02:00
Markus Blatt
a7db2bfb2d Only search for MPI_Finalized with MPI found. 2016-09-21 15:46:01 +02:00
Arne Morten Kvarving
3d380cb395 Merge pull request #174 from akva2/change_name_and_fix_jenkins
Change name of cmake variables and fix jenkins
2016-09-20 17:37:04 +02:00
Markus Blatt
a9d105c1a0 Check for MPI 2 functionality and activate it for DUNE.
This allow mixing the MPIHelper and MPI_Init/MPI_Finalize. This commit
makes OPM a bit more DUNE compatible.
2016-09-16 18:17:19 +02:00
Markus Blatt
c0056ac4c8 Always initialize EclipsePRTLog::print_summary_ 2016-09-16 11:28:20 +02:00
Markus Blatt
644914ce5d Increase readability. 2016-09-16 09:57:20 +02:00
Markus Blatt
8eb2cead4d Document new stuff. 2016-09-16 09:50:19 +02:00
Markus Blatt
7da4e4a919 Resort to inherit StreamLog constructors in EclipsePRTLog.
That way we will never miss a constructor. Before this commit
some of them were actually missing.
2016-09-16 09:46:55 +02:00
Markus Blatt
64c0651ffa Allow disabling output in EclipsePRTLog.
In a parallel run we need to be able to disable output in EclipsePRTLog
as only one process is allowed to output messages. This commit adds a
new defaulted constructor parameter to allow this.
2016-09-15 21:22:21 +02:00
Arne Morten Kvarving
a32145c272 fixed: missed the passing of opm-data root for main module build 2016-09-14 14:57:18 +02:00
Kristian Hole-Drabløs
909a00fade Changed name of cmake variables
Changed name of cmake variables due to namechange of binaries
2016-09-14 12:03:37 +02:00
Atgeirr Flø Rasmussen
81a9f0521f Use map instead of unordered_map.
This is because downstream code can benefit from the ordering guarantee.
2016-09-07 13:37:09 +02:00
Atgeirr Flø Rasmussen
37938bbf5e Merge pull request #171 from bska/opm-fd-chase-api-update
Update opm-flowdiagnostics system probe for API change
2016-09-01 06:40:48 +02:00
Bård Skaflestad
29a1dcb6dc Update opm-flowdiagnostics system probe for API change
This commit brings the system probe for module

    opm-flowdiagnostics

up-to-date with recent changes in the public interface of the
module's main entry point.  Commit OPM/opm-flowdiagnostics@8456e81
removed the nested type

    Opm::FlowDiagnostics::Toolbox::PoreVolume

so we must drop all references to this type.
2016-08-31 22:07:46 +02:00
Arne Morten Kvarving
a802a5173b Merge pull request #170 from andlaus/fix_quadmath
FindQuadmath.cmake: fix the first argument of find_package_handle_standard_args()
2016-08-24 16:03:07 +02:00
Arne Morten Kvarving
688ded14c3 Merge pull request #169 from akva2/add_multiconfiguration
Add multiconfiguration support to jenkins scripts
2016-08-24 16:00:58 +02:00
Andreas Lauser
bf63963c0c FindQuadmath.cmake: fix the first argument of find_package_handle_standard_args()
It needs to match the filename exacly, i.e. including the case.
2016-08-24 14:56:08 +02:00
Arne Morten Kvarving
5e9e979051 add multiple build configuration support to jenkins scripts
will be used for mpi-enabled builds

note options required for opm-parser, ewoms have been
moved to the build configurations for simpler maintenance.
2016-08-24 14:46:49 +02:00
Joakim Hove
43aa36e0f7 Merge pull request #168 from akva2/simplify_jenkins_after_ert_reorg
simplify jenkins scripts after ert reorganization
2016-08-22 17:28:51 +02:00
Arne Morten Kvarving
cbda0ae4a0 Merge pull request #165 from andlaus/travis_ewoms
Travis ewoms
2016-08-22 17:14:09 +02:00
Andreas Lauser
425f87b2e4 also ignore disabled ctests on jenkins 2016-08-22 14:52:01 +02:00
Arne Morten Kvarving
ab0dbee33d simplify jenkins scripts after ert reorganization 2016-08-22 12:12:24 +02:00
Andreas Lauser
b1cbd664d2 travis: add the -DADD_DISABLED_CTESTS=OFF and-DUSE_QUADMATH=OFF cmake flags
ctest will return an error code if it encounters disabled tests
otherwise.
2016-08-22 12:10:13 +02:00
Joakim Hove
547234a29c Added ewoms build to travis configuration. 2016-08-22 12:10:13 +02:00
Andreas Lauser
a742ddead4 opm_add_test: make it possible to hide disabled tests
the purpose is to make CI systems like travis happy because ctest
counts tests with status "(Not Run)" as failed and returns a non-zero
exit code.

hiding disabled ctests can be achived by adding the
-DADD_DISABLED_CTESTS=OFF cmake parameter.
2016-08-22 12:09:30 +02:00
Joakim Hove
e2fe88c739 Merge pull request #167 from joakim-hove/ert-repo-reorg
Ert repo reorg
2016-08-22 11:56:08 +02:00
Joakim Hove
3535a43382 Update cmake / jenkins / travis due to ert reorg. 2016-08-20 18:20:32 +02:00
Atgeirr Flø Rasmussen
e8e631ad3a Merge pull request #166 from bska/recognize-fd-appl
Hook FD-Applications up to OPM build system
2016-08-17 14:01:50 +02:00
Bård Skaflestad
34c4173dc3 Hook FD-Applications up to OPM build system
This commit recognizes the opm-flowdiagnostics-applications module
in OPM's centralised build system.  We make requisite changes to the
FIND support for module opm-flowdiagnostics (header 'tarjan.h' is
currently not public) and make a first cut at explicit prerequisites
for FD-Applications.
2016-08-17 12:25:20 +02:00
Arne Morten Kvarving
bd425bfff9 Merge pull request #158 from kristfho/master
Added CMake variable OPM_OUTPUT_BINARIES
2016-07-21 16:27:20 +02:00
Kristian Hole-Drabløs
c5f3c1eca1 Added commands for running regression test binaries 2016-07-19 09:52:29 +02:00
jokva
7f1716b9a6 Merge pull request #157 from joakim-hove/travis-install-numpy
Installing numpy using conda before building ert.
2016-07-04 10:19:53 +02:00
Joakim Hove
47778333bc Installing numpy using conda before building ert. 2016-07-01 18:35:38 +02:00
Joakim Hove
06b18c1490 Merge pull request #156 from joakim-hove/findert-python-updates
Findert python updates
2016-07-01 16:33:37 +02:00
Joakim Hove
0d261d24f3 Update FindERTPython to check for EclSum. 2016-07-01 15:13:46 +02:00
Arne Morten Kvarving
fbc67f4ef9 Merge pull request #149 from joakim-hove/python-testing
Run Python / ERT based integration tests.
2016-06-30 13:20:58 +02:00
Joakim Hove
7064cde08b Run Python / ERT based integration tests.
Added a new optional dependency the ERT Python distribution to
opm-simulators, and a cmake function 'opm_add_python_test' which can be
used to simplify integration tests of the type:

 1. Run flow on a model.
 2. Compare the results with a well known reference solution.
2016-06-29 20:03:26 +02:00
Arne Morten Kvarving
18ed6a2703 Merge pull request #151 from joakim-hove/jenkins-enable-python
Enable Python in jenkins builder.
2016-06-28 12:22:07 +02:00
Joakim Hove
03b5b8e785 Updates to FindERTPython:
- Fixed bug: CMAKE_INSTALL_PREFIX -> CMAKE_PREFIX_PATH
 - Factored out path component ${PYTHON_INSTALL_PREFIX}
2016-06-28 11:28:05 +02:00
Joakim Hove
a33f369e04 Enable Python in jenkins builder. 2016-06-27 16:49:21 +02:00
Joakim Hove
22dcb236ca Merge pull request #150 from joakim-hove/findert-python-cmake-prefix
FindERTPython will consider CMAKE_INSTALL_PREFIX.
2016-06-27 13:56:49 +02:00
Joakim Hove
6d18022e19 FindERTPython will consider CMAKE_INSTALL_PREFIX. 2016-06-27 13:03:40 +02:00
Atgeirr Flø Rasmussen
c753787c84 Merge pull request #147 from andlaus/remove_std_regex_test
FindCXX11Features.cmake: remove the test for `std::regex`
2016-06-23 07:34:24 +02:00
Arne Morten Kvarving
25d582c19e Merge pull request #148 from joakim-hove/find-ert-utilxx
FindERT: look for ert_util C++ wrappers.
2016-06-22 17:55:12 +02:00
Joakim Hove
3e57bfd844 FindERT: look for ert_util C++ wrappers. 2016-06-22 16:12:35 +02:00
Andreas Lauser
1ea00e5602 FindCXX11Features.cmake: remove the test for std::regex
this test is quite fragile, takes relatively long and after
OPM/opm-parser#850 it is not required anymore.
2016-06-16 14:34:08 +02:00
Atgeirr Flø Rasmussen
01c6f9fbc8 Merge pull request #142 from qilicun/minor-format-change
use the 'msg + file name + line number' format.
2016-06-15 14:20:28 +02:00
Liu Ming
8de9921890 file name and line number are in a new line. 2016-06-15 11:20:34 +08:00
Joakim Hove
c089761bc9 Merge pull request #146 from jokva/remove-boost-dependencies-from-output
Remove boost dependencies from output except test
2016-06-14 10:35:34 +02:00
Arne Morten Kvarving
577088d80e Merge pull request #145 from jokva/new-find-opm-output
Change Find-output test source code
2016-06-13 15:57:33 +02:00
Jørgen Kvalsvik
5ad08b3843 Change Find-output test source code
opm-output is about to remove the OutputWriter.hpp header, which means
this test program will break. Wells.hpp and default-constructed
data::Rates is a better fit for the future.
2016-06-13 15:13:24 +02:00
Jørgen Kvalsvik
c1e48b969c Remove boost dependencies from output except test 2016-06-13 14:44:22 +02:00
Bård Skaflestad
e7db252f3e Merge pull request #144 from akva2/fix_output_config_var
fixed: set correct config variable
2016-06-13 12:37:35 +02:00
Arne Morten Kvarving
080a3ff687 fixed: set correct config variable 2016-06-13 10:44:01 +02:00
Liu Ming
eb654771d9 fix test issue. 2016-06-13 14:28:27 +08:00
Liu Ming
f9510e31a0 use the 'msg + file name + line number' format. 2016-06-13 13:46:51 +08:00
Joakim Hove
acad3a560e Merge pull request #141 from akva2/move_opm_output
update jenkins build scripts
2016-06-11 07:28:54 +02:00
Arne Morten Kvarving
3440258a72 update jenkins build scripts
update build order, opm-output moved in the dependency tree
2016-06-10 13:43:03 +02:00
Joakim Hove
2ec97ba27f Merge pull request #127 from magnesj/vs2015-compile-fixes
VS2015 : Improvements to FIND functions for ERT and find_opm_package
2016-06-10 13:17:26 +02:00
Joakim Hove
eee539e6f1 Merge pull request #121 from jokva/opm-output-core-dependencies
Swap opm-core/opm-output dependencies
2016-06-10 13:15:11 +02:00
Jørgen Kvalsvik
e598210529 Travis builds output before core
Since the edge between output and core in the dependency graph has been
inverted, build the two repositories in the right order.
2016-06-10 12:53:56 +02:00
Jørgen Kvalsvik
86a1d87a74 Swap opm-core/opm-output dependencies
Core depends on output, not the other way around.
2016-06-10 12:53:20 +02:00
Joakim Hove
340f860c52 Merge pull request #140 from joakim-hove/fix-opm-clone
travis/clone-opm.sh will never clone opm-common.
2016-06-10 12:37:16 +02:00
Joakim Hove
3c4e995a75 travis/clone-opm.sh will never clone opm-common. 2016-06-10 11:46:22 +02:00
Pål Grønås Drange
70bfdc5061 Merge pull request #128 from joakim-hove/travis-build-downstream
Script for travis to build and test downstream.
2016-06-10 09:47:32 +02:00
Atgeirr Flø Rasmussen
2102160bd1 Merge pull request #137 from qilicun/set-default-prefix
Make Error, Problem, Error, Warning with prefix by default.
2016-06-10 08:43:46 +02:00
Atgeirr Flø Rasmussen
d69e33f677 Merge pull request #139 from joakim-hove/streamlog-append
Log: StreamLog can optionally open in append mode.
2016-06-10 07:11:21 +02:00
Joakim Hove
405a6c31c5 Log: StreamLog can optionally open in append mode. 2016-06-09 18:52:40 +02:00
Arne Morten Kvarving
bf935bac89 Merge pull request #138 from bska/enable-opm-flowdiagnostics
Recognize OPM-Flowdiagnostics as an OPM Module
2016-06-09 11:51:55 +02:00
Liu Ming
213d4932a6 remove unused member data and fix initializing order. 2016-06-09 09:05:23 +02:00
Bård Skaflestad
0a0332d4e3 Recognize OPM-Flowdiagnostics as an OPM Module
This enables using the OPM build system in the new module

    opm-flowdiagnostics.
2016-06-08 16:59:52 +02:00
Liu Ming
af9b0977f6 add two new constructors. 2016-06-08 15:30:52 +02:00
Liu Ming
46b7b2a114 fix test issues with prefix. 2016-06-08 13:52:40 +02:00
Liu Ming
e89bef777a fix prefix testing. 2016-06-08 13:40:19 +02:00
Liu Ming
752c8f3197 make Error, Warning, Bug, Problem with prefix by default. 2016-06-08 13:37:34 +02:00
Liu Ming
1a273ff6e3 make the first letter of prefix to be captial. 2016-06-08 13:35:05 +02:00
Atgeirr Flø Rasmussen
51d3ba1b66 Merge pull request #135 from qilicun/add-prtinfo-type
Add prtinfo type
2016-06-08 11:35:18 +02:00
Liu Ming
b4c9f82585 Let Note has its own prefix. 2016-06-08 10:55:38 +02:00
Liu Ming
2dce26c9f0 fix indentation and order. 2016-06-08 10:52:23 +02:00
Liu Ming
83db625173 change the message type order. 2016-06-08 09:12:19 +02:00
Liu Ming
aa51ea67bc change Prtinfo to Note. 2016-06-08 09:00:24 +02:00
Joakim Hove
422a11c6c7 Reorganized travis building.
1. travis/build-prereqs.sh will build all the from-source dependencies;
    i.e. dune, superLU and ert.

 2. travis/clone-opm.sh will clone all opm modules, except the module
    given as commandline argument; it is assumed that travis has already
    fetched and merged the correct ref of this repo.

 3. travis/build-and-test.sh will build all upstream modules and then
    build and test the module given as commandline argument including
    all downstream modules:

       travis/build-and-test.sh  opm-output

With this the .travis.yml file can be nearly identical for each module,
e.g. for opm-output the before_script and script sections will be:

   before_script:
       - export CXX="g++-4.8" CC="gcc-4.8" FC="gfortran-4.8"
       - cd ..
       - opm-common/travis/build-prereqs.sh
       - opm-common/travis/clone-opm.sh opm-output

   script: opm-common/travis/build-and-test.sh opm-output
2016-06-07 22:40:52 +02:00
Liu Ming
3573ab0181 fix indentation. 2016-06-07 14:16:25 +02:00
Liu Ming
314a3ffec7 Add a new message type that allows messages only go into print file. 2016-06-07 14:08:33 +02:00
Atgeirr Flø Rasmussen
1278e431ae Merge pull request #134 from qilicun/set-color
change yellow to blue.
2016-06-06 15:34:11 +02:00
Liu Ming
199324363b fix color test. 2016-06-06 15:29:09 +02:00
Liu Ming
908acdcb74 add yellow back and change warning color as blue. 2016-06-06 15:11:32 +02:00
Liu Ming
099099d87c change yellow to blue. 2016-06-06 14:56:29 +02:00
Atgeirr Flø Rasmussen
ef6dea7b8d Merge pull request #131 from qilicun/useful-types
Define one useful message type.
2016-06-06 12:28:28 +02:00
Liu Ming
9683fe2b95 Define one useful message type. 2016-06-06 11:52:57 +02:00
Magne Sjaastad
258476a196 VS2015 : Improvements to FIND functions for ERT and find_opm_package 2016-06-03 08:00:57 +02:00
Joakim Hove
82b638b429 Merge pull request #126 from jokva/ert-ecl-kw-bugfix
Fix typo in FindERT compile check
2016-05-27 13:35:31 +02:00
Jørgen Kvalsvik
53151baf66 Fix typo in FindERT compile check 2016-05-27 13:33:49 +02:00
Joakim Hove
da4923b5bb Merge pull request #125 from jokva/find-ert-new-eclkw
FindERT uses new EclKW interface.
2016-05-27 13:19:06 +02:00
Atgeirr Flø Rasmussen
c91cd7c8c1 Merge pull request #124 from atgeirr/simplify-colorization
No longer emit default Ansi color code for black.
2016-05-27 13:14:59 +02:00
Jørgen Kvalsvik
1acba75552 FindERT uses new EclKW interface. 2016-05-27 10:29:41 +02:00
Atgeirr Flø Rasmussen
c4eb8936a8 No longer emit default Ansi color code for black.
Using no code for black makes it easier to read output with color in editors etc.
2016-05-25 13:56:33 +02:00
Arne Morten Kvarving
5f9fc9bf5b Merge pull request #123 from magnesj/vs2015-compile-fixes
Added Visual Studio guards and fixed missing include
2016-05-25 11:07:49 +02:00
Magne Sjaastad
f77866bf68 Added Visual Studio guards and fixed missing include 2016-05-24 15:02:36 +02:00
Atgeirr Flø Rasmussen
2da7093a35 Merge pull request #113 from andlaus/remove_legacy_alugrid_support
remove support for the legacy ALUGrid library from dune-grid
2016-05-23 15:16:26 +02:00
Atgeirr Flø Rasmussen
e73db36f82 Merge pull request #122 from qilicun/setup-simple-log
Add default simple logging.
2016-05-23 09:41:12 +02:00
Liu Ming
9aba3ac6b3 fix type error. 2016-05-23 15:04:41 +08:00
Liu Ming
a5afe90659 add simple test for OpmLog::setupSimpleDefaultLog. 2016-05-23 15:01:50 +08:00
Liu Ming
77a3df1a61 pass value not reference. 2016-05-23 15:01:28 +08:00
Liu Ming
367a9f9a0c Add default simple logging. 2016-05-23 10:12:29 +08:00
Joakim Hove
36d959f1f5 Merge pull request #119 from atgeirr/message-limits
Message limits and tagged messages
2016-05-19 10:23:46 +02:00
Atgeirr Flø Rasmussen
c4c1fe2b30 Rename methods according to code review. 2016-05-18 22:22:10 +02:00
Atgeirr Flø Rasmussen
f1a1aa02fb Simplify Logger methods. 2016-05-18 22:21:56 +02:00
Atgeirr Flø Rasmussen
d2564ff838 Support tagged messages.
This changes the design of the LogBackend class and its subclasses,
now the main virtual method is addTaggedMessage(). The former virtual
method addMessage() is now a regular non-virtual method forwarding to
addTaggedMessage().

You can configure message limiting based on tags by passing a MessageLimiter
to the configureMessageLimiter() method, which will then be used by the
includeMessage() method. That method now takes an additional tag argument.

The most user-visible part of this is that there are new overloads of the
static methods OpmLog::warning(), OpmLog::error() etc, that take message
tags. To tie things together the OpmLog and Logger classes have also gotten
new addTaggedMessage() methods, but they should mostly be used through the
convenience methods such as OpmLog::warning().
2016-05-18 13:27:12 +02:00
Atgeirr Flø Rasmussen
9c84967734 Add MessageLimiter class and test. 2016-05-18 12:11:26 +02:00
Atgeirr Flø Rasmussen
214e45e497 Use consistent member naming. 2016-05-18 09:27:53 +02:00
Andreas Lauser
5a5d5483e1 Merge pull request #117 from andlaus/add_opm-parser_dependency
ewoms-prereqs.cmake: make the optionaly depency on opm-parser explicit
2016-05-17 12:38:46 +02:00
Andreas Lauser
33225a533a ewoms-prereqs.cmake: make the optionaly depency on opm-parser explicit
this allows to remove the opm-parser dependency of opm-core without
breaking ewoms/ebos...
2016-05-17 12:32:31 +02:00
Joakim Hove
107e43a720 Merge pull request #115 from atgeirr/refine-logging
Refine logging output
2016-05-12 13:24:21 +02:00
Atgeirr Flø Rasmussen
6be41d2fcf Added MessageFormatter. 2016-05-12 10:54:19 +02:00
Atgeirr Flø Rasmussen
474bc50519 Change clearBackends() -> removeAllBackends(). 2016-05-12 10:29:48 +02:00
Atgeirr Flø Rasmussen
2c10045195 Use constants for terminal codes. 2016-05-12 10:28:44 +02:00
Arne Morten Kvarving
ea86d58ea5 Merge pull request #114 from andlaus/misc_fixes
Misc fixes
2016-05-11 13:53:56 +02:00
Arne Morten Kvarving
0360423aa2 Merge pull request #116 from dr-robertk/PR/add-threads
Add pthread support.
2016-05-10 13:01:14 +02:00
Robert Kloefkorn
bead5d2e99 Added -pthread by default if threads are found. USE_PTHREAD is ON and can be turned OFF
to disable this feature.
2016-05-10 11:19:53 +02:00
Atgeirr Flø Rasmussen
492d31f6cc Added tests for helper functions. 2016-05-09 15:11:34 +02:00
Atgeirr Flø Rasmussen
a6c379db05 Add test exercising coloring feature. 2016-05-09 11:34:08 +02:00
Atgeirr Flø Rasmussen
56b6e45fc9 Add clearBackends() method to Logger and OpmLog singleton. 2016-05-09 11:33:35 +02:00
Atgeirr Flø Rasmussen
a896a4f792 Decorate from StreamLog, not OpmLog statics. 2016-05-09 11:32:42 +02:00
Atgeirr Flø Rasmussen
b40ea5dda7 Add configureDecoration() and decorateMessage() to LogBackend. 2016-05-09 11:30:13 +02:00
Atgeirr Flø Rasmussen
9a03758e9f Add Log::colorCodeMessage() helper. 2016-05-09 11:29:11 +02:00
Atgeirr Flø Rasmussen
de87c5a5b5 Make LogBackend pure virtual, also clean and document. 2016-05-09 10:42:28 +02:00
Andreas Lauser
c3cfe38f0c prevent cmake from warning about CMP0054
we set that policy to NEW because the old behavior is simply insane
for the sake of "convenience" (IMO).
2016-05-05 20:12:57 +02:00
Andreas Lauser
74ed9172bb FindSuperLU: make sure that the "SUPERLU_FOUND" variable is always set
I ran into problems (syntax errors in if statements) if that module
bailed out before find_package_handle_standard_args() was
invoked. Since OPM/ewoms#54 this happened e.g. on systems where no
BLAS library is installed.
2016-05-05 20:09:06 +02:00
Andreas Lauser
5d733a600c remove support for the legacy ALUGrid library from dune-grid
Considering the fact that this library has been on life support within
dune-grid since the alugrid development moved to the dune-alugrid
module -- which is available since at least dune 2.3 --, I doubt that
this was very useful and possibly it is even broken.
2016-05-04 13:53:39 +02:00
Joakim Hove
03e833db1b Merge pull request #111 from akva2/add_downstream_trigger_support
updates for jenkins build scripts
2016-05-03 14:53:14 +02:00
Atgeirr Flø Rasmussen
fdbc30f6d2 Merge pull request #112 from atgeirr/bump-version
dune.module: change version to 2016.10-pre
2016-05-03 14:34:30 +02:00
Atgeirr Flø Rasmussen
54443e5e28 dune.module: change version to 2016.10-pre 2016-05-03 14:31:32 +02:00
Arne Morten Kvarving
6e2388ff16 updates for jenkins build scripts
- add a generic function to build upstream modules
- add a generic function to build downstream modules
- add downstream trigger support in this module
2016-04-30 09:46:04 +02:00
Atgeirr Flø Rasmussen
80b73cd862 Merge pull request #110 from akva2/update_for_16.04_packaging
Updates for 16.04 packaging
2016-04-18 10:57:11 +02:00
Arne Morten Kvarving
510687f073 update redhat packaging
- package library
- add new dependencies on boost
  uses boost 1.48 on rhel6. rhel7 supplies a newer boost by default.
- pkg-config file relocated since a library is now provided.
2016-04-18 10:49:55 +02:00
Arne Morten Kvarving
06816f344a update debian packaging
- package library
- pkg-config file relocated since a library is now provided.
- add new boost dependencies
2016-04-18 10:49:37 +02:00
Arne Morten Kvarving
e4da825eb3 changed: run all tests through mpirun
ubuntu 14.04 openmpi libs will crash in MPI_Finalize()
if not run through mpirun
2016-04-15 15:01:36 +02:00
Arne Morten Kvarving
323a8b4e86 added: support trilinos-branded zoltan 2016-04-15 15:01:36 +02:00
Atgeirr Flø Rasmussen
330bda4688 Merge pull request #106 from atgeirr/log-throws
Make OPM_THROW call OpmLog::error().
2016-04-12 10:15:33 +02:00
Atgeirr Flø Rasmussen
77779e5553 Merge pull request #109 from andlaus/refine_quadmath_detection
refine FindQuadmath.cmake
2016-04-12 10:02:06 +02:00
Andreas Lauser
8ccd328b87 refine FindQuadmath.cmake
with this, it is now possible to disable quadruple precision math
detection without hacks. (by setting USE_QUADMATH to ON or OFF)
2016-04-11 23:25:31 +02:00
Joakim Hove
4abdd148e3 Merge pull request #108 from akva2/add_opm_data_handler_script
add a jenkins script for setting up opm-data
2016-04-11 14:37:38 +02:00
Arne Morten Kvarving
ca95ed62da add a jenkins script for setting up opm-data
there are two modes:
- user supplies OPM_DATA_ROOT directly. in this case, the supplied
  directory is copied into the workspace and used.
- user supplies OPM_DATA_ROOT_PREDEFINED. in this case, the
  supplied path copied into the workspace unless a specific
  PR is defined in the trigger comment.
2016-04-11 14:16:15 +02:00
Joakim Hove
42a9be4ce0 Merge pull request #107 from atgeirr/rename-autodiff
Rename opm-autodiff -> opm-simulators.
2016-04-10 22:15:22 +02:00
Atgeirr Flø Rasmussen
9b5d81e358 Rename opm-autodiff -> opm-simulators. 2016-04-08 14:05:26 +02:00
Atgeirr Flø Rasmussen
3e125643f5 Make OPM_THROW call OpmLog::error(). 2016-04-08 12:52:50 +02:00
Atgeirr Flø Rasmussen
3c295815ad Merge pull request #104 from atgeirr/module-renaming
Module renaming
2016-04-06 15:37:39 +02:00
Atgeirr Flø Rasmussen
d789962a93 Rename in comment. 2016-04-06 11:58:36 +02:00
Arne Morten Kvarving
b08fbb0022 fixed: use shallow clones on jenkins 2016-04-06 10:06:27 +02:00
Arne Morten Kvarving
4ca84813ae changed: build all targets and not just the things that are actually tested 2016-04-05 15:31:28 +02:00
Atgeirr Flø Rasmussen
c2b36fa760 Fix Findopm-grid.cmake module. 2016-04-05 14:54:08 +02:00
Arne Morten Kvarving
62ed653905 fixed: don't build test suite for upstream modules on jenkins
i somehow forgot to set this option. accelerates build process significantly.
2016-04-05 11:27:28 +02:00
Atgeirr Flø Rasmussen
0eae093620 Rename dune-cornerpoint -> opm-grid. 2016-04-04 21:17:57 +02:00
Arne Morten Kvarving
4e537c376f fixed: have the test-suite target depend on the test data file targets 2016-04-04 15:28:57 +02:00
Arne Morten Kvarving
d34a09fb2c fixed: properly quote parameter 2016-04-04 13:45:09 +02:00
Arne Morten Kvarving
49b620c295 remove erronous space 2016-04-04 13:18:50 +02:00
Joakim Hove
98afe9a8a8 Merge pull request #99 from joakim-hove/add-opm-parser-requirement
Add opm-parser requirement.
2016-04-04 12:19:12 +02:00
Arne Morten Kvarving
9a03f6320b changed: replace explicit make invocations with cmake --build 2016-04-04 11:33:32 +02:00
Arne Morten Kvarving
b139530928 Merge pull request #102 from akva2/jenkins_reboot
Jenkins reboot
2016-04-04 10:29:34 +02:00
Arne Morten Kvarving
218771a16a added: jenkins build scripts 2016-04-04 09:21:44 +02:00
Bård Skaflestad
1d3db34972 Merge pull request #100 from atgeirr/add-output-to-upscaling
Make opm-output REQUIRED for opm-upscaling.
2016-04-01 10:47:18 +02:00
Atgeirr Flø Rasmussen
5d57af105e Remove warning-generating semicolon. 2016-04-01 08:06:45 +02:00
Atgeirr Flø Rasmussen
87ca6b4764 Switch dependency order. 2016-04-01 08:06:15 +02:00
Atgeirr Flø Rasmussen
09aa68b90f Merge pull request #101 from OPM/revert-98-fix_opm-material-prereqs.cmake
Revert "opm-material-prereqs.cmake: fix the ordering of the dependencies"
2016-03-31 17:28:45 +02:00
Atgeirr Flø Rasmussen
7dc2b70aac Revert "opm-material-prereqs.cmake: fix the ordering of the dependencies" 2016-03-31 17:27:30 +02:00
Atgeirr Flø Rasmussen
fe8870bb97 Make opm-output REQUIRED for opm-upscaling. 2016-03-31 17:24:42 +02:00
Joakim Hove
6afeebd717 Add opm-parser requirement. 2016-03-31 16:04:31 +02:00
Atgeirr Flø Rasmussen
15addc22b5 Merge pull request #98 from andlaus/fix_opm-material-prereqs.cmake
opm-material-prereqs.cmake: fix the ordering of the dependencies
2016-03-31 15:07:21 +02:00
Andreas Lauser
d48a318401 opm-material-prereqs.cmake: fix the ordering of the dependencies
packages marked REQUIRED must currently preceed optional ones. Also
C99 is not required by opm-material because that module only consists
of c++ code.
2016-03-31 14:50:33 +02:00
Atgeirr Flø Rasmussen
61d3e2011a Merge pull request #92 from joakim-hove/mark-opmcommon-REQUIERED
Mark opm-common as required.
2016-03-31 13:55:24 +02:00
Atgeirr Flø Rasmussen
a75c109c0d Merge pull request #91 from akva2/import_porsol
changed: drop opm-porsol
2016-03-31 13:52:28 +02:00
Atgeirr Flø Rasmussen
dd8af482f2 Merge pull request #89 from kjellkongsvik/opm_autodiff_requires_opm_output
opm-autodiff now dependant on opm-output
2016-03-31 09:42:27 +02:00
Joakim Hove
116d741c89 Merge pull request #97 from atgeirr/experimental-pointerfiddling
Use reference pointers for fast field access.
2016-03-29 13:16:02 +02:00
Atgeirr Flø Rasmussen
52ce54bc47 Use reference pointers for fast field access.
This is necessary in the short term to replace SimulatorState with this
class without performance loss.
2016-03-29 09:44:50 +02:00
Atgeirr Flø Rasmussen
942e90c809 Merge pull request #93 from joakim-hove/add-fPIC
Add global target property: POSITION_INDEPENDENT_CODE
2016-03-29 08:32:59 +02:00
Andreas Lauser
c2d047da0d Merge pull request #96 from andlaus/add_config_macros_for_ewoms
ewoms build files: add HAVE_* variables for all dune modules
2016-03-22 11:59:37 +01:00
Andreas Lauser
06f4603fd3 ewoms build files: add HAVE_* variables for all dune modules
The main reason for this is that it is good style to add HAVE_FOO
config.h variables for everything which was discovered, but it also
turns out that dune-fem is quite picky about the macros which
expects (and I recently fell on my nose because of this)...
2016-03-22 11:55:01 +01:00
Joakim Hove
07266344bc Set target property POSITION_INDEPENDENT_CODE=True 2016-03-22 11:37:03 +01:00
Joakim Hove
7b5d10be22 Merge pull request #95 from joakim-hove/travis-build-common-shared
Added +x for travis build script
2016-03-22 10:18:17 +01:00
Joakim Hove
ddeab7dc69 Added +x for travis build script 2016-03-22 10:17:10 +01:00
Joakim Hove
e3372780c4 Merge pull request #94 from joakim-hove/travis-build-common-shared
Added travis/build-opm-common-shared.sh
2016-03-22 10:11:24 +01:00
Joakim Hove
493fbf95c3 Added travis/build-opm-common-shared.sh 2016-03-22 10:06:22 +01:00
Joakim Hove
b8f1d2164c Mark opm-common as required. 2016-03-21 22:31:05 +01:00
Joakim Hove
985819fb2c Merge pull request #90 from chflo/move_log_functionality
Added log functionality from opm-parser
2016-03-21 22:14:12 +01:00
Arne Morten Kvarving
93a3343b69 changed: drop opm-porsol 2016-03-17 20:11:46 +01:00
chflo
73ad043006 Moved in logfunctionality from opm-parser 2016-03-17 15:23:18 +01:00
Kjell W. Kongsvik
9c825716da opm-autodiff now dependant on opm-output 2016-03-17 14:56:01 +01:00
Joakim Hove
0d3d46e199 Merge pull request #88 from kjellkongsvik/Move_OutputWriter_to_opm-output_safely
Move OutputWriter to opm-output
2016-03-16 13:38:50 +01:00
Kjell W. Kongsvik
855ed76b10 Move OutputWriter to opm-output
Findopm finds opmoutput
2016-03-16 12:42:10 +01:00
Arne Morten Kvarving
5e1a915f76 Merge pull request #85 from joakim-hove/opm-output
Added cmake files for opm-output.
2016-03-14 13:58:25 +01:00
Joakim Hove
b032fc0d05 Added cmake files for opm-output. 2016-03-14 13:43:32 +01:00
Atgeirr Flø Rasmussen
c47d20468f Merge pull request #84 from blattms/make-core-common-required
Make opm-core and opm-common a hard requirement.
2016-03-08 08:40:38 +01:00
Markus Blatt
7d3c1e17ba Make opm-core and opm-common a hard requirement.
Previously, cmake succeeded even if opm-core or opm-common was not found.
The cause for this was that dune-cornerpoint was searched for first. As
it was not required it seems like opm-common and opm-core were treated as
optional too.

This commit moves the opm modules to the opm section of the variable and
changes the order of the modules such that modules listed first do not
depend on modules listed afterwards. Now cmake fails if it cannot finy any
of the required modules.
2016-03-07 17:40:23 +01:00
Atgeirr Flø Rasmussen
03fc74d115 Merge pull request #83 from joakim-hove/non-const-celldata-access
Added non const cellData() access.
2016-03-03 12:43:44 +01:00
Joakim Hove
4958bc55f2 Added non const cellData() access. 2016-03-02 23:20:16 +01:00
Arne Morten Kvarving
812902ff9d Merge pull request #79 from andlaus/do_not_depend_on_boost_iostreams
remove the dependency on boost::iostreams if it is not used
2016-03-01 09:46:37 +01:00
Bård Skaflestad
b833f6c37d Merge pull request #82 from joakim-hove/reference
Added missing &reference symbol.
2016-02-29 09:19:51 -06:00
Joakim Hove
72c8a44dc9 Added missing &reference symbol. 2016-02-29 16:06:59 +01:00
Atgeirr Flø Rasmussen
83b88f143c Merge pull request #81 from joakim-hove/add-iterator
Add iterator
2016-02-29 11:23:01 +01:00
Joakim Hove
5d2469f18e Added global cell data access methods. 2016-02-29 11:17:16 +01:00
Joakim Hove
84a827e847 Added method to query for number of components. 2016-02-29 11:13:06 +01:00
Bård Skaflestad
32dbe00516 Merge pull request #80 from joakim-hove/add-const-overload
Added const overloads
2016-02-25 22:18:35 -06:00
Joakim Hove
5e63006285 Added const overloads 2016-02-25 21:52:08 +01:00
Andreas Lauser
77e7ed97c9 remove the dependency on boost::iostreams if it is not used
as far as I can see, it is not used in any module except opm-upscaling
and it caused the configure stage to fail if I tried to use with a
self-compiled boost 1.60 (which I have to do in order to use clang on
any modern linux distribution.)
2016-02-25 16:40:59 +01:00
Joakim Hove
fb0f00662c Merge pull request #78 from atgeirr/minor-fixes
Minor bugfix and silence a warning.
2016-02-19 14:46:00 +01:00
Atgeirr Flø Rasmussen
70d1831a76 Silence sign mismatch warning. 2016-02-19 14:21:11 +01:00
Atgeirr Flø Rasmussen
4547b5bf82 Bugfix: honor tolerance arguments. 2016-02-19 14:20:44 +01:00
Atgeirr Flø Rasmussen
af24ed82d3 Merge pull request #77 from joakim-hove/template-cmp
Implemented float comparison with templates
2016-02-19 11:41:00 +01:00
Atgeirr Flø Rasmussen
b8d18a6909 Merge pull request #76 from joakim-hove/set-state-component
Added SimulationDataContainer::setCellDataComponent()
2016-02-19 10:43:12 +01:00
Joakim Hove
25746bb500 Added SimulationDataContainer::setCellDataComponent() 2016-02-19 08:31:13 +01:00
Joakim Hove
3d2fa142e2 Changes ptr_equal -> array_equal 2016-02-19 07:54:21 +01:00
Joakim Hove
aeeaf9c342 Using #include <cmath> and std::fabs() 2016-02-19 07:50:18 +01:00
Joakim Hove
48f0513ca1 Implemented float comparison with templates 2016-02-17 21:59:08 +01:00
Atgeirr Flø Rasmussen
765cd77b68 Merge pull request #74 from joakim-hove/float-cmp
Added util/numeric/cmp.hpp
2016-02-12 10:15:49 +01:00
Joakim Hove
ee6836bd39 Added equal() method to SimulationDataContainer 2016-02-09 15:34:39 +01:00
Joakim Hove
d2ab19f318 Added util/numeric/cmp.cpp 2016-02-09 15:31:40 +01:00
Alf Birger Rustad
005b2d2df4 Merge pull request #71 from akva2/fix_sibling_build_thing
fixed: workaround if() bug in cmake
2016-02-08 12:00:35 +01:00
Joakim Hove
8b36c2a7d6 Merge pull request #73 from jepebe/travis
Added Travis status to README.md
2016-02-05 10:45:01 +01:00
Jean-Paul Balabanian
ae29bdef23 Added Travis status to README.md 2016-02-05 08:33:51 +01:00
Joakim Hove
2729a503de Merge pull request #72 from joakim-hove/install-fixup
Install fixup.
2016-02-04 16:33:10 +01:00
Joakim Hove
3469177532 Install fixup. 2016-02-04 16:31:44 +01:00
Andreas Lauser
5a98a919e4 Merge pull request #67 from joakim-hove/findert-update
Simplified FindERT module
2016-02-04 16:22:44 +01:00
Joakim Hove
69d3942e21 Merge pull request #68 from joakim-hove/datacontainer
SimulationDatacontainer
2016-02-04 15:57:45 +01:00
Joakim Hove
c5acc7561d Added methods to register cell and face data. 2016-02-04 14:30:26 +01:00
Joakim Hove
e486194996 Renamed DataContainer -> SimulationDataContainer. 2016-02-04 12:54:23 +01:00
Joakim Hove
05e319b62e Added probe for sibling find of utilxx/include. 2016-02-04 12:40:03 +01:00
Joakim Hove
8b6fb56e84 Simplified FindERT module 2016-02-04 12:40:03 +01:00
Atgeirr Flø Rasmussen
daa700ab9f Merge pull request #70 from jepebe/travis
Travis support
2016-02-04 10:27:25 +01:00
Jean-Paul Balabanian
000ad4ab48 Added Travis support 2016-02-04 06:34:38 +01:00
Arne Morten Kvarving
531449951d fixed: workaround if() bug in cmake
seems you cannot rely on the NOTFOUND postfix for compound if's
2016-02-03 14:44:53 +01:00
Joakim Hove
10213b025c Merge pull request #66 from joakim-hove/create-lib
Create library in opm-common
2016-02-02 10:06:16 +01:00
Joakim Hove
cb626c71b9 Ignore build/ directory at project root. 2016-02-01 10:33:35 +01:00
Joakim Hove
c8e8be6db9 Added library opm-common with DataContainer. 2016-02-01 10:33:34 +01:00
Andreas Lauser
ecc98ac321 Merge pull request #65 from dr-robertk/PR/fix-dune-alugrid-find
Finddune-alugrid: find the package when build with cmake or autotools
2016-01-29 20:24:15 +01:00
Robert Kloefkorn
40573e6c57 Finddune-alugrid: switch order of appearance. 2016-01-28 13:42:55 -07:00
Robert Kloefkorn
1269d918a2 Finddune-alugrid: find the package when build with cmake or autotools (libs differ) 2016-01-28 13:27:45 -07:00
Joakim Hove
4b16c76d2d Added opmcommon library in Findopm-common. 2016-01-26 13:29:27 +01:00
Arne Morten Kvarving
dc77753950 Merge pull request #64 from andlaus/squelch_cmp00054_warning
hack around CMake policy CMP00054
2015-11-18 10:29:42 +01:00
Andreas Lauser
9cd4a79b87 hack around CMake policy CMP00054
newer versions of cmake (mine is 3.2.2) complain about policy CMP00054:

```
CMake Warning (dev) at /home/and/src/opm-common/cmake/Modules/ConfigVars.cmake:30 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "FILE" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  /home/and/src/opm-common/cmake/Modules/OpmLibMain.cmake:173 (configure_vars)
  CMakeLists.txt:109 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.
```

since I'm pretty sure that the old behaviour was not intended here,
fix this for older versions of cmake as well (by adding a prefix so that
CMake does not interpret "FILE" as a variable.)
2015-11-17 17:36:11 +01:00
Atgeirr Flø Rasmussen
8fefe29e7c Merge pull request #58 from andlaus/fix_alugrid_libs
adapt Finddune-alugrid.cmake to the "paramerge" branch of dune-alugrid
2015-11-09 13:13:41 +01:00
dr-robertk
66d6d11bfd Merge pull request #61 from atgeirr/bump-version
Bump version and unify format of dune.module.
2015-10-23 15:06:44 +02:00
Atgeirr Flø Rasmussen
9a615468c5 Merge pull request #60 from atgeirr/improve-useversion
Improve the UseVersion module.
2015-10-23 13:37:38 +02:00
Atgeirr Flø Rasmussen
9265a695ea Bump version and unify format of dune.module. 2015-10-23 13:18:47 +02:00
Atgeirr Flø Rasmussen
6e1efc79af Improve the UseVersion module.
The changes are:
 - Add new macros PROJECT_VERSION_NAME and PROJECT_VERSION_HASH
   in addition to the existing PROJECT_VERSION.
 - Add header include guards.
2015-10-23 10:59:08 +02:00
Andreas Lauser
aebc12a227 adapt Finddune-alugrid.cmake to the "paramerge" branch of dune-alugrid 2015-10-21 17:58:58 +02:00
114 changed files with 5547 additions and 1073 deletions

3
.gitignore vendored
View File

@@ -41,3 +41,6 @@ install_manifest.txt
CTestTestfile.cmake
DartConfiguration.tcl
Testing/
# Build directory in source.
build/

39
.travis.yml Normal file
View File

@@ -0,0 +1,39 @@
language: cpp
compiler:
- gcc
addons:
apt:
sources:
- boost-latest
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
packages:
- libboost1.55-all-dev
- gcc-4.8
- g++-4.8
- gfortran-4.8
- liblapack-dev
- 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"
- cd ..
- opm-common/travis/build-prereqs.sh
- opm-common/travis/clone-opm.sh opm-common
script: opm-common/travis/build-and-test.sh opm-common

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

@@ -20,23 +20,28 @@
# you should only add to this list if the *user* of
# the library needs it.
# originally generated with the command:
# find opm -name '*.c*' -printf '\t%p\n' | sort
list (APPEND MAIN_SOURCE_FILES
opm/common/data/SimulationDataContainer.cpp
opm/common/OpmLog/CounterLog.cpp
opm/common/OpmLog/EclipsePRTLog.cpp
opm/common/OpmLog/LogBackend.cpp
opm/common/OpmLog/Logger.cpp
opm/common/OpmLog/LogUtil.cpp
opm/common/OpmLog/OpmLog.cpp
opm/common/OpmLog/StreamLog.cpp
opm/common/OpmLog/TimerLog.cpp
)
# originally generated with the command:
# find tests -name '*.cpp' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort
list (APPEND TEST_SOURCE_FILES
)
tests/test_SimulationDataContainer.cpp
tests/test_cmp.cpp
tests/test_OpmLog.cpp
tests/test_messagelimiter.cpp
)
# originally generated with the command:
# find tests -name '*.xml' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort
list (APPEND TEST_DATA_FILES
)
# originally generated with the command:
# find tutorials examples -name '*.c*' -printf '\t%p\n' | sort
list (APPEND EXAMPLE_SOURCE_FILES
)
@@ -49,5 +54,20 @@ 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
opm/common/OpmLog/LogBackend.hpp
opm/common/OpmLog/Logger.hpp
opm/common/OpmLog/LogUtil.hpp
opm/common/OpmLog/MessageFormatter.hpp
opm/common/OpmLog/MessageLimiter.hpp
opm/common/OpmLog/OpmLog.hpp
opm/common/OpmLog/StreamLog.hpp
opm/common/OpmLog/TimerLog.hpp
opm/common/util/numeric/cmp.hpp
opm/common/utility/platform_dependent/disable_warnings.h
opm/common/utility/platform_dependent/reenable_warnings.h )
opm/common/utility/platform_dependent/reenable_warnings.h)

View File

@@ -1,3 +1,3 @@
# opm-common
Contains common components used througout all of OPM,
# opm-common ![alt text](https://travis-ci.org/OPM/opm-common.svg?branch=master "TravisCI Build Status")
Contains common components used throughout all of OPM,
in particular CMake modules for the build system.

View File

@@ -27,11 +27,10 @@
function (configure_vars obj syntax filename verb)
# this is just to make the syntax look like the build-in commands
if (NOT ("${obj}" STREQUAL "FILE" AND
if (NOT ("X Y Z ${obj}" STREQUAL "X Y Z FILE" AND
(("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND"))))
message (FATAL_ERROR "Syntax error in argument list")
endif (NOT ("${obj}" STREQUAL "FILE" AND
(("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND"))))
endif ()
if (NOT (("${syntax}" STREQUAL "CXX") OR ("${syntax}" STREQUAL "CMAKE")))
message (FATAL_ERROR "Invalid target syntax \"${syntax}\"")
endif (NOT (("${syntax}" STREQUAL "CXX") OR ("${syntax}" STREQUAL "CMAKE")))
@@ -67,14 +66,14 @@ function (configure_vars obj syntax filename verb)
# if the name of a variable has the syntax of a comments, write it
# verbatim to the file; this can be used to create headings
if ("${_var}" MATCHES "^/[/*]")
if ("X Y Z ${_var}" MATCHES "^X Y Z /[/*]")
if (NOT _prev_verbatim)
file (APPEND "${filename}" "\n")
endif (NOT _prev_verbatim)
file (APPEND "${filename}" "${_var}\n")
set (_prev_verbatim TRUE)
else ("${_var}" MATCHES "^/[/*]")
else ()
# write a CMake statements that warns if the value has changed
if ("${syntax}" STREQUAL "CMAKE")
@@ -106,6 +105,6 @@ function (configure_vars obj syntax filename verb)
endif ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL ""))
set (_prev_verbatim FALSE)
endif ("${_var}" MATCHES "^/[/*]")
endif ()
endforeach(_var)
endfunction (configure_vars obj syntax filename verb)

View File

@@ -1,150 +0,0 @@
#find_package(PkgConfig)
include(CheckLibraryExists)
macro(_opm_set_alugrid val)
set(ALUGRID_FOUND ${val})
if(NOT ALUGRID_FOUND AND ALUGRID_FIND_REQUIRED)
message(FATAL_ERROR "Could not find required libary ALUGrid")
endif()
# print status message if requested
if(NOT ALUGRID_FIND_QUIETLY)
if(ALUGRID_FOUND)
message(STATUS "Found ALUGrid")
else()
message(STATUS "Could not find ALUGrid")
endif()
endif()
endmacro()
if(ALUGRID_ROOT)
find_path(ALUGRID_PKGCONFIG_DIR alugrid.pc PATHS ${ALUGRID_ROOT}
PATH_SUFFIXES lib/pkgconfig/ alugrid/lib/pkgconfig
NO_DEFAULT_PATH)
find_file(ALUGRID_VERSION alugridversion PATHS ${ALUGRID_ROOT}/bin
NO_DEFAULT_PATH)
else()
find_path(ALUGRID_PKGCONFIG_DIR alugrid.pc
PATH_SUFFIXES lib/pkgconfig/ alugrid/lib/pkgconfig)
get_filename_component(_GUESSED_ALUGRID_ROOT ${ALUGRID_PKGCONFIG_DIR}/../../ ABSOLUTE)
find_file(ALUGRID_VERSION alugridversion PATHS ${_GUESSED_ALUGRID_ROOT}/bin NO_DEFAULT_PATH)
if(ALUGRID_VERSION)
set(ALUGRID_ROOT ${_GUESSED_ALUGRID_ROOT})
else(ALUGRID_VERSION_PATH)
get_filename_component(_GUESSED_ALUGRID_ROOT ${ALUGRID_PKGCONFIG_DIR}/../../.. ABSOLUTE)
find_file(ALUGRID_VERSION alugridversion
PATHS ${_GUESSED_ALUGRID_ROOT}
PATH_SUFFIXES bin
NO_DEFAULT_PATH)
if(ALUGRID_VERSION)
set(ALUGRID_ROOT ${_GUESSED_ALUGRID_ROOT})
endif(ALUGRID_VERSION)
endif(ALUGRID_VERSION)
endif()
unset(ALUGRID_PKGCONFIG_DIR CACHE)
set(ALUGRID_VERSION_REQUIRED 1.50)
if(NOT ALUGRID_VERSION)
message(STATUS "Could not find ALUGrid.")
_opm_set_alugrid(0)
return()
endif(NOT ALUGRID_VERSION)
execute_process(COMMAND ${ALUGRID_VERSION} -c ${ALUGRID_VERSION_REQUIRED} OUTPUT_VARIABLE ALUGRID_VERSION)
if(ALUGRID_VERSION LESS 0)
message(STATUS "ALUGrid version is less than ${ALUGRID_VERSION_REQUIRED}")
_opm_set_alugrid(0)
unset(ALUGRID_VERSION CACHE)
return()
else()
message(STATUS "ALUGrid version is compatible")
endif()
unset(ALUGRID_VERSION CACHE)
find_path(ALUGRID_INCLUDE_DIR "alugrid_serial.h"
PATHS "${ALUGRID_ROOT}" PATH_SUFFIXES "include" "include/serial"
NO_DEFAULT_PATH DOC "Include path of serial alugrid headers.")
if (NOT ALUGRID_INCLUDE_DIR)
message(STATUS "Could not deterimine ALUGrid include directory")
_opm_set_alugrid(0)
return()
endif()
mark_as_advanced(ALUGRID_INCLUDE_DIR)
find_library(ALUGRID_LIBRARY alugrid
PATHS "${ALUGRID_ROOT}"
PATH_SUFFIXES lib lib32 lib64
DOC "ALUGrid library"
NO_DEFAULT_PATH)
if (NOT ALUGRID_LIBRARY)
message(STATUS "Could not find ALUGrid usable library")
_opm_set_alugrid(0)
return()
endif()
set(ALUGRID_LIBRARIES ${ALUGRID_LIBRARY})
mark_as_advanced(ALUGRID_LIBRARIES)
set(ALUGRID_INCLUDE_DIRS
${ALUGRID_INCLUDE_DIR}
${ALUGRID_INCLUDE_DIR}/serial
${ALUGRID_INCLUDE_DIR}/duneinterface)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ALUGRID_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ALUGRID_LIBRARIES})
check_include_file_cxx(stlheaders.h ALUGRID_SERIAL_FOUND)
if(ALUGRID_SERIAL_FOUND)
check_cxx_source_compiles("#include <alugrid_defineparallel.h>
#if ALU3DGRID_BUILD_FOR_PARALLEL == 0
#error
#endif
int main(){}"
ALUGRID_PARALLEL_FOUND)
else()
message(STATUS "alugrid_serial.h found, but could not be compiled.")
_opm_set_alugrid(0)
return()
endif()
if(ALUGRID_PARALLEL_FOUND AND MPI_FOUND)
# must link with METIS if we are going to use parallel ALUGrid
find_package(METIS)
if (METIS_FOUND)
list(APPEND ALUGRID_LIBRARIES ${METIS_LIBRARIES})
# check for parallel ALUGrid
find_path(ALUGRID_PARALLEL_INCLUDE_PATH "alumetis.hh"
PATHS ${ALUGRID_INCLUDE_DIR}
PATH_SUFFIXES "parallel"
NO_DEFAULT_PATH)
if(ALUGRID_PARALLEL_INCLUDE_PATH)
list(APPEND ALUGRID_INCLUDE_DIRS ${ALUGRID_PARALLEL_INCLUDE_PATH})
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ALUGRID_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ALUGRID_LIBRARIES})
#set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
check_include_file_cxx(alugrid_parallel.h ALUGRID_PARALLEL_FOUND)
unset(ALUGRID_PARALLEL_INCLUDE_PATH CACHE)
if(NOT ALUGRID_PARALLEL_FOUND)
message(STATUS "alumetis.hh not found in ${ALUGRID_PARALLEL_INCLUDE_PATH}")
endif()
else()
message (STATUS "METIS not found, parallel ALUGrid disabled")
set (ALUGRID_PARALLEL_FOUND 0)
endif()
else()
message(STATUS "alumetis.hh not found (required by parallel alugrid).")
set(ALUGRID_PARALLEL_FOUND 0)
endif()
endif()
if(ALUGRID_SERIAL_FOUND)
_opm_set_alugrid(1)
endif(ALUGRID_SERIAL_FOUND)

View File

@@ -8,7 +8,6 @@
# HAVE_SHARED_PTR True if std::shared_ptr is available
# HAVE_UNIQUE_PTR True if std::unique_ptr is available
# HAVE_NULLPTR True if nullptr is available
# HAVE_REGEX True if std::regex available and sufficiently usable
# HAVE_ARRAY True if header <array> and fill() are available
# HAVE_ATTRIBUTE_ALWAYS_INLINE True if attribute always inline is supported
# HAS_ATTRIBUTE_UNUSED True if attribute unused is supported
@@ -34,39 +33,65 @@ include(CheckIncludeFileCXX)
# macro to only add option once
include(AddOptions)
# 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)
# Force CXX Standard cross platfrom for CMakeVersion >=3.1
set(CMAKE_CXX_EXTENSIONS OFF)
# 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
set (CXX_STDLIB_FLAGS)
string (TOUPPER "${CMAKE_CXX_COMPILER_ID}" _comp_id)
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++")
endif (CXX_FLAG_STDLIB_LIBCXX)
endif (APPLE AND (_comp_id MATCHES "CLANG"))
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
set (CXX_STDLIB_FLAGS)
string (TOUPPER "${CMAKE_CXX_COMPILER_ID}" _comp_id)
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++")
endif (CXX_FLAG_STDLIB_LIBCXX)
endif (APPLE AND (_comp_id MATCHES "CLANG"))
# to format the command-line options pretty, we have an optional space
if (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
set (CXX_SPACE " ")
else (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
set (CXX_SPACE)
endif (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
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)
add_options(CXX ALL_BUILDS ${CMAKE_CXX14_STANDARD_COMPILE_OPTION})
else()
add_options(CXX ALL_BUILDS ${CMAKE_CXX11_STANDARD_COMPILE_OPTION})
endif()
endif()
# to format the command-line options pretty, we have an optional space
if (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
set (CXX_SPACE " ")
else (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
set (CXX_SPACE)
endif (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
# perform tests
include(CheckCXXSourceCompiles)
@@ -145,33 +170,6 @@ CHECK_CXX_SOURCE_COMPILES("
" HAVE_NULLPTR
)
# <regex>
CHECK_CXX_SOURCE_RUNS("
#include <regex>
int main(void)
{
std::regex r(\"AB.*|BC+|DE.+\", std::regex::extended);
if (!std::regex_match(\"AB\", r))
return 1;
if (!std::regex_match(\"ABC\", r))
return 2;
if (!std::regex_match(\"ABC!#\", r))
return 3;
if (std::regex_match(\"B\", r))
return 4;
if (!std::regex_match(\"BC\", r))
return 5;
if (std::regex_match(\"BCE\", r))
return 6;
if (std::regex_match(\"DE\", r))
return 7;
if (!std::regex_match(\"DEF\", r))
return 8;
return 0;
}
" HAVE_REGEX
)
# constexpr
CHECK_CXX_SOURCE_COMPILES("
template <class T>
@@ -187,7 +185,7 @@ CHECK_CXX_SOURCE_COMPILES("
# array and fill
CHECK_CXX_SOURCE_COMPILES("
#include <array>
int main(void)
{
std::array<int,2> a;
@@ -242,24 +240,24 @@ CHECK_CXX_SOURCE_COMPILES("
{
bar() DEP;
};
class peng { } DEP;
template <class T>
class t_bar
{
t_bar() DEP;
};
template <class T>
class t_peng {
t_peng() {};
} DEP;
void foo() DEP;
void foo() {};
int main(void)
{
return 0;
@@ -273,25 +271,25 @@ CHECK_CXX_SOURCE_COMPILES("
class bar {
bar() DEP;
};
class peng { } DEP;
template <class T>
class t_bar
{
t_bar() DEP;
};
template <class T>
class t_peng
{
t_peng() {};
t_peng() {};
} DEP;
void foo() DEP;
void foo() {};
int main(void)
{
return 0;
@@ -459,7 +457,7 @@ endif()
if(CXX_FEATURES_MISSING)
set (CXX11FEATURES_FOUND FALSE)
if (CXX11Features_FIND_REQUIRED)
message(FATAL_ERROR
message(FATAL_ERROR
"Your C++ compiler does not support the minimum set of C++-2011 features required. "
"Make sure to use a compiler which implements all C++-2011 features provided by GCC 4.4. "
"Your compiler does not seem to implement the following features:\n"

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

@@ -0,0 +1,49 @@
# Find the Python wrappers for module cwrap from ert
#
# Set the cache variable CWRAP_PYTHON_PATH to the install location of the root
# ert package.
find_package(PythonInterp)
if(PYTHONINTERP_FOUND)
# We try to find the cwrap Python distribution. This is done by running Python
# code which tries to 'import cwrap' and prints out the path to the module if
# the import succeeds.
#
# The normal Python import machinery is employed, so if you have installed cwrap
# python in a default location, or alternatively set the PYTHONPATH variable the
# cwrap Python distribution will eventually be found there, independently of the
# alternatives which are tested with the ${PATH_LIST} variable.
if (EXISTS "/etc/debian_version")
set( PYTHON_PACKAGE_PATH "dist-packages")
else()
set( PYTHON_PACKAGE_PATH "site-packages")
endif()
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
set(PATH_LIST)
if (ERT_ROOT)
list(APPEND PATH_LIST ${ERT_ROOT})
endif()
list(APPEND PATH_LIST ${CMAKE_PREFIX_PATH})
# Add various popular sibling alternatives.
list(APPEND PATH_LIST "${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build")
foreach( PATH ${PATH_LIST})
set( python_code "import sys; sys.path.insert(0 , '${PATH}/${PYTHON_INSTALL_PREFIX}'); import os.path; import inspect; import cwrap; print os.path.dirname(os.path.dirname(inspect.getfile(cwrap)))")
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${python_code}"
RESULT_VARIABLE import_result
OUTPUT_VARIABLE stdout_output
ERROR_VARIABLE stderr_output
OUTPUT_STRIP_TRAILING_WHITESPACE )
if (${import_result} EQUAL 0)
set( CWRAP_PYTHON_PATH ${stdout_output} CACHE PATH "Python path for cwrap" )
break()
endif()
endforeach()
endif()
find_package_handle_standard_args("Cwrap" DEFAULT_MSG CWRAP_PYTHON_PATH)

View File

@@ -33,41 +33,49 @@ endif (ERT_ROOT)
find_path (ERT_ECL_INCLUDE_DIR
NAMES "ert/ecl/ecl_util.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "devel/libecl/include/" "include"
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}
)
find_path (ERT_ECL_WELL_INCLUDE_DIR
NAMES "ert/ecl_well/well_const.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "devel/libecl_well/include/" "include"
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}
)
find_path (ERT_ECLXX_INCLUDE_DIR
NAMES "ert/ecl/EclKW.hpp"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "devel/libeclxx/include/" "include"
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}
)
find_path (ERT_UTIL_INCLUDE_DIR
NAMES "ert/util/stringlist.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "devel/libert_util/include/" "include"
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}
)
find_path (ERT_UTILXX_INCLUDE_DIR
NAMES "ert/util/ert_unique_ptr.hpp"
HINTS "${ERT_ROOT}"
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}
)
find_path (ERT_GEN_INCLUDE_DIR
NAMES "ert/util/int_vector.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "devel/libert_util/include"
"include" "build/libert_util/include"
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"
${_no_default_path}
)
@@ -80,60 +88,78 @@ 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_SOURCE_DIR}/../ert/devel/build"
"${PROJECT_BINARY_DIR}/../ert-build"
"${PROJECT_BINARY_DIR}/../ert/devel"
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Eclipse library archive/shared object files"
${_no_default_path}
)
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_SOURCE_DIR}/../ert/devel/build"
"${PROJECT_BINARY_DIR}/../ert-build"
"${PROJECT_BINARY_DIR}/../ert/devel"
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Eclipse C++ library archive/shared object files"
${_no_default_path}
)
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_SOURCE_DIR}/../ert/devel/build"
"${PROJECT_BINARY_DIR}/../ert-build"
"${PROJECT_BINARY_DIR}/../ert/devel"
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Eclipse library archive/shared object files"
${_no_default_path}
)
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_SOURCE_DIR}/../ert/devel/build"
"${PROJECT_BINARY_DIR}/../ert-build"
"${PROJECT_BINARY_DIR}/../ert/devel"
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Geometry library archive/shared object files"
${_no_default_path}
)
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_SOURCE_DIR}/../ert/devel/build"
"${PROJECT_BINARY_DIR}/../ert-build"
"${PROJECT_BINARY_DIR}/../ert/devel"
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Utilities library archive/shared object files"
${_no_default_path}
)
find_library (ERT_LIBRARY_UTILXX
NAMES "ert_utilxx"
HINTS "${ERT_ROOT}"
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}"
DOC "Path to ERT Utilities library archive/shared object files"
${_no_default_path}
)
@@ -143,6 +169,7 @@ list (APPEND ERT_INCLUDE_DIR
${ERT_ECL_WELL_INCLUDE_DIR}
${ERT_ECLXX_INCLUDE_DIR}
${ERT_UTIL_INCLUDE_DIR}
${ERT_UTILXX_INCLUDE_DIR}
${ERT_GEN_INCLUDE_DIR}
)
list (APPEND ERT_LIBRARY
@@ -151,6 +178,7 @@ list (APPEND ERT_LIBRARY
${ERT_LIBRARY_ECL_WELL}
${ERT_LIBRARY_GEOMETRY}
${ERT_LIBRARY_UTIL}
${ERT_LIBRARY_UTILXX}
)
list (APPEND ERT_LIBRARIES ${ERT_LIBRARY})
list (APPEND ERT_INCLUDE_DIRS ${ERT_INCLUDE_DIR})
@@ -170,36 +198,6 @@ if (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
return ()
endif (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
# these system variables are probed for, and used in HEADER files (sic)
list (APPEND ERT_CONFIG_VARS
HAVE_ISFINITE
HAVE_GLOB
HAVE_FORK
HAVE_GETUID
HAVE_LOCKF
HAVE_OPENDIR
HAVE_PROC
HAVE_READLINKAT
HAVE_SYMLINK
HAVE_VA_COPY
)
include (CheckSymbolExists)
include (CheckFunctionExists)
check_symbol_exists (isfinite math.h HAVE_ISFINITE)
check_function_exists (glob HAVE_GLOB)
check_function_exists (fork HAVE_FORK)
check_function_exists (getuid HAVE_GETUID)
check_function_exists (lockf HAVE_LOCKF)
check_function_exists (opendir HAVE_OPENDIR)
check_function_exists (readlinkat HAVE_READLINKAT)
check_function_exists (symlink HAVE_SYMLINK)
check_symbol_exists (va_copy stdarg.h HAVE_VA_COPY)
if (UNIX)
set (HAVE_PROC 1)
else (UNIX)
set (HAVE_PROC)
endif (UNIX)
# dependencies
@@ -221,6 +219,7 @@ if (BLAS_FOUND)
list (APPEND ERT_LIBRARIES ${BLAS_LIBRARIES})
list (APPEND ERT_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
endif (BLAS_FOUND)
find_package (LAPACK ${ERT_QUIET})
if (LAPACK_FOUND)
list (APPEND ERT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS})
@@ -261,11 +260,11 @@ 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(\"SATNUM\" , 1000);
kw[0] = 10;
return 0;
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 ()
else (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))

View File

@@ -23,20 +23,18 @@ if(PYTHONINTERP_FOUND)
endif()
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
set(PATH_LIST)
if (ERT_ROOT)
set( start_path "${ERT_ROOT}/${PYTHON_INSTALL_PREFIX}" )
else()
set( start_path "DEFAULT_PATH")
list(APPEND PATH_LIST ${ERT_ROOT})
endif()
list(APPEND PATH_LIST ${CMAKE_PREFIX_PATH})
set( PATH_LIST "${start_path}"
"${PROJECT_SOURCE_DIR}/../ert/build/${PYTHON_INSTALL_PREFIX}"
"${PROJECT_SOURCE_DIR}/../ert/devel/build/${PYTHON_INSTALL_PREFIX}"
"${PROJECT_BINARY_DIR}/../ert-build/${PYTHON_INSTALL_PREFIX}"
"${PROJECT_BINARY_DIR}/../ert/devel/${PYTHON_INSTALL_PREFIX}")
# Add various popular sibling alternatives.
list(APPEND PATH_LIST "${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build")
foreach( PATH ${PATH_LIST})
set( python_code "import sys; sys.path.insert(0 , '${PATH}'); import os.path; import inspect; import ert; print os.path.dirname(os.path.dirname(inspect.getfile(ert)))")
set( python_code "import sys; sys.path.insert(0 , '${PATH}/${PYTHON_INSTALL_PREFIX}'); import os.path; import inspect; import ert; print os.path.dirname(os.path.dirname(inspect.getfile(ert))); from ert.ecl import EclSum")
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${python_code}"
RESULT_VARIABLE import_result
OUTPUT_VARIABLE stdout_output

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)
@@ -107,22 +112,35 @@ if (Petsc_ROOT)
set (PETSC_ROOT "${Petsc_ROOT}")
endif (Petsc_ROOT)
find_path (PETSC_NORMAL_INCLUDE_DIR
NAMES "petsc.h"
PATHS ${PETSC_ROOT}
PATH_SUFFIXES "include" "petsc"
${_no_default_path}
)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
set(OLD_PKG $ENV{PKG_CONFIG_PATH})
set(ENV{PKG_CONFIG_PATH} $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig)
pkg_check_modules(PETSC PETSc>=3.4.0)
set(ENV{PKG_CONFIG_PATH} ${OLD_PKG})
set(PETSC_LIBRARIES ${PETSC_STATIC_LDFLAGS})
set(PETSC_LIBRARY ${PETSC_LIBRARIES})
set(PETSC_INCLUDE_DIR ${PETSC_INCLUDE_DIRS})
endif()
list(APPEND PETSC_INCLUDE_DIR ${PETSC_NORMAL_INCLUDE_DIR})
if(NOT PETSC_FOUND)
find_path (PETSC_NORMAL_INCLUDE_DIR
NAMES "petsc.h"
PATHS ${PETSC_ROOT}
PATH_SUFFIXES "include" "petsc"
${_no_default_path}
)
# look for actual Petsc library
find_library(PETSC_LIBRARY
NAMES "petsc-3.4.3" "petsc-3.4.4" "petsc"
PATHS ${PETSC_ROOT}
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
${_no_default_path}
)
list(APPEND PETSC_INCLUDE_DIR ${PETSC_NORMAL_INCLUDE_DIR})
# look for actual Petsc library
find_library(PETSC_LIBRARY
NAMES "petsc-3.4.3" "petsc-3.4.4" "petsc"
PATHS ${PETSC_ROOT}
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
${_no_default_path}
)
endif()
if(NOT PETSC_LIBRARY)
message(STATUS "Could not find the PETSc library")
@@ -136,7 +154,7 @@ mark_as_advanced(PETSC_INCLUDE_DIR PETSC_LIBRARY)
# if both headers and library are found, store results
if(PETSC_FOUND)
set(PETSC_INCLUDE_DIRS ${PETSC_INCLUDE_DIR})
set(PETSC_INCLUDE_DIRS ${PETSC_INCLUDE_DIR})
list(APPEND PETSC_INCLUDE_DIRS ${PETSC_MPI_INCLUDE_DIRS})
set(PETSC_LIBRARIES ${PETSC_LIBRARY})

View File

@@ -11,28 +11,38 @@ include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-Werror -fext-numeric-literals" HAVE_EXTENDED_NUMERIC_LITERALS)
if (HAVE_EXTENDED_NUMERIC_LITERALS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
endif()
if(NOT DEFINED USE_QUADMATH OR USE_QUADMATH)
if(NOT DEFINED HAVE_EXTENDED_NUMERIC_LITERALS)
check_cxx_compiler_flag("-Werror -fext-numeric-literals" HAVE_EXTENDED_NUMERIC_LITERALS)
endif()
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath")
CHECK_CXX_SOURCE_COMPILES("
if (HAVE_EXTENDED_NUMERIC_LITERALS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
endif()
cmake_push_check_state(RESET)
list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath")
CHECK_CXX_SOURCE_COMPILES("
#include <quadmath.h>
int main(void){
__float128 foo = sqrtq(123.456);
foo = FLT128_MIN;
}" HAVE_QUAD)
cmake_pop_check_state()
}" QUADMATH_FOUND)
cmake_pop_check_state()
if (HAVE_QUAD)
set(QUADMATH_LIBRARIES "quadmath")
if (QUADMATH_FOUND)
set(QUADMATH_LIBRARIES "quadmath")
set(HAVE_QUAD "${QUADMATH_FOUND}")
endif()
endif()
if (USE_QUADMATH AND NOT QUADMATH_FOUND)
message(FATAL_ERROR "Quadruple precision math support was explicitly requested but is unavailable!")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QuadMath
find_package_handle_standard_args(Quadmath
DEFAULT_MSG
QUADMATH_LIBRARIES
HAVE_QUAD

View File

@@ -15,12 +15,18 @@
# SUPERLU_LIBRARIES Name to the SuperLU library.
#
if(NOT USE_SUPERLU)
return()
endif()
include(CheckIncludeFiles)
include(CMakePushCheckState)
include(CheckCSourceCompiles)
cmake_push_check_state()
set(SUPERLU_FOUND "FALSE")
# 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)
@@ -116,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)
@@ -126,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

@@ -24,7 +24,7 @@ find_package(PTScotch)
find_path (ZOLTAN_INCLUDE_DIRS
NAMES "zoltan.h"
PATHS ${ZOLTAN_SEARCH_PATH}
PATH_SUFFIXES "include"
PATH_SUFFIXES include trilinos
${ZOLTAN_NO_DEFAULT_PATH})
# only search in architecture-relevant directory
@@ -33,7 +33,7 @@ if (CMAKE_SIZEOF_VOID_P)
endif (CMAKE_SIZEOF_VOID_P)
find_library(ZOLTAN_LIBRARIES
NAMES "zoltan"
NAMES zoltan trilinos_zoltan
PATHS ${ZOLTAN_SEARCH_PATH}
PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
${ZOLTAN_NO_DEFAULT_PATH})

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

@@ -11,6 +11,7 @@
# This code is licensed under The GNU General Public License v3.0
include (OpmPackage)
# find dune-alugrid when build with autotools (deprecated in dune 2.4 and removed after dune 3.0
find_opm_package (
# module name
"dune-alugrid"
@@ -21,7 +22,7 @@ find_opm_package (
# we just include them to forward here in case anyone else does
"CXX11Features REQUIRED;
dune-grid REQUIRED;
ZLIB REQUIRED;
ZLIB;
ZOLTAN;
METIS
"
@@ -29,13 +30,47 @@ find_opm_package (
"dune/alugrid/grid.hh"
# library to search for
"dunealugrid;alugrid_2d;alugrid_parallel;alugrid_serial"
"dunealugrid;alugrid_parallel;alugrid_serial"
# defines to be added to compilations
""
# test program
"#include <dune/alugrid/2d/indexsets.hh>
"#include <dune/alugrid/common/interfaces.hh>
int main (void) {
return 0;
}
"
# config variables
"HAVE_DUNE_ALUGRID
")
# find dune-alugrid when build with cmake
find_opm_package (
# module name
"dune-alugrid"
# dependencies
# TODO: we should probe for all the HAVE_* values listed below;
# however, we don't actually use them in our implementation, so
# we just include them to forward here in case anyone else does
"CXX11Features REQUIRED;
dune-grid REQUIRED;
ZLIB;
ZOLTAN;
METIS
"
# header to search for
"dune/alugrid/grid.hh"
# library to search for
"dunealugrid"
# defines to be added to compilations
""
# test program
"#include <dune/alugrid/common/interfaces.hh>
int main (void) {
return 0;
}

View File

@@ -57,6 +57,7 @@ int main (void) {
HAVE_NULLPTR;
HAVE_STATIC_ASSERT;
HAVE_SHARED_PTR;
MPI_2;
SHARED_PTR_HEADER;
SHARED_PTR_NAMESPACE;
HAVE_TYPE_TRAITS;
@@ -66,6 +67,17 @@ int main (void) {
")
#debug_find_vars ("dune-common")
if(MPI_C_FOUND)
# check for MPI version 2
include(CMakePushCheckState)
include(CheckFunctionExists)
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDES})
check_function_exists(MPI_Finalized MPI_2)
cmake_pop_check_state()
endif(MPI_C_FOUND)
# make version number available in config.h
include (UseDuneVer)
find_dune_version ("dune" "common")

View File

@@ -1,42 +0,0 @@
# - Find OPM corner-point grid library
#
# Defines the following variables:
# dune-cornerpoint_INCLUDE_DIRS Directory of header files
# dune-cornerpoint_LIBRARIES Directory of shared object files
# dune-cornerpoint_DEFINITIONS Defines that must be set to compile
# dune-cornerpoint_CONFIG_VARS List of defines that should be in config.h
# HAVE_DUNE_CORNERPOINT Binary value to use in config.h
# Copyright (C) 2013 Uni Research AS
# This code is licensed under The GNU General Public License v3.0
include (dune-cornerpoint-prereqs)
include (OpmPackage)
find_opm_package (
# module name
"dune-cornerpoint"
# dependencies
"${dune-cornerpoint_DEPS}"
# header to search for
"dune/grid/CpGrid.hpp"
# library to search for
"dunecornerpoint"
# defines to be added to compilations
"HAVE_DUNE_CORNERPOINT"
# test program
"#include <dune/grid/CpGrid.hpp>
int main (void) {
Dune::CpGrid g;
return 0;
}
"
# config variables
"${dune-cornerpoint_CONFIG_VAR}"
)
#debug_find_vars ("dune-cornerpoint")

View File

@@ -26,7 +26,6 @@ find_opm_package (
dune-common REQUIRED;
dune-geometry REQUIRED;
MPI;
ALUGrid;
UG
"
# header to search for
@@ -42,14 +41,13 @@ 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
"HAVE_MPI;
HAVE_UG;
HAVE_DUNE_FEM;
HAVE_ALUGRID;
HAVE_GRIDTYPE;
HAVE_GRAPE;
HAVE_PSURFACE;

View File

@@ -24,7 +24,7 @@ find_opm_package (
"opm/common/utility/platform_dependent/disable_warnings.h"
# library to search for
""
"opmcommon"
# defines to be added to compilations
""

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

@@ -0,0 +1,48 @@
# - Find OPM Flow Diagnostics Library
#
# Defines the following variables:
# opm-flowdiagnostics_INCLUDE_DIRS Directory of header files
# opm-flowdiagnostics_LIBRARIES Directory of shared object files
# opm-flowdiagnostics_DEFINITIONS Defines that must be set to compile
# opm-flowdiagnostics_CONFIG_VARS List of defines that should be in config.h
# HAVE_OPM_FLOWDIAGNOSTICS Binary value to use in config.h
# Copyright (C) 2012 Uni Research AS
# This code is licensed under The GNU General Public License v3.0
# use the generic find routine
include (opm-flowdiagnostics-prereqs)
include (OpmPackage)
find_opm_package (
# module name
"opm-flowdiagnostics"
# dependencies
"${opm-flowdiagnostics_DEPS}"
# header to search for
"opm/flowdiagnostics/Toolbox.hpp"
# library to search for
"opmflowdiagnostics"
# defines to be added to compilations
""
# test program
"#include <opm/flowdiagnostics/Toolbox.hpp>
#include <vector>
int main()
{
using FDT = Opm::FlowDiagnostics::Toolbox;
const auto pv = std::vector<double>(10, 0.3);
}
"
# config variables
"${opm-flowdiagnostics_CONFIG_VAR}"
)

View File

@@ -0,0 +1,42 @@
# - Find OPM corner-point grid library
#
# Defines the following variables:
# opm-grid_INCLUDE_DIRS Directory of header files
# opm-grid_LIBRARIES Directory of shared object files
# opm-grid_DEFINITIONS Defines that must be set to compile
# opm-grid_CONFIG_VARS List of defines that should be in config.h
# HAVE_OPM_GRID Binary value to use in config.h
# Copyright (C) 2013 Uni Research AS
# This code is licensed under The GNU General Public License v3.0
include (opm-grid-prereqs)
include (OpmPackage)
find_opm_package (
# module name
"opm-grid"
# dependencies
"${opm-grid_DEPS}"
# header to search for
"dune/grid/cpgrid/GlobalIdMapping.hpp"
# library to search for
"opmgrid"
# defines to be added to compilations
"HAVE_OPM_GRID"
# test program
"#include <dune/grid/cpgrid/GlobalIdMapping.hpp>
int main (void) {
Dune::cpgrid::GlobalIdMapping g;
return 0;
}
"
# config variables
"${opm-grid_CONFIG_VAR}"
)
#debug_find_vars ("opm-grid")

View File

@@ -0,0 +1,44 @@
# - Find OPM output library
#
# Defines the following variables:
# opm-output_INCLUDE_DIRS Directory of header files
# opm-output_LIBRARIES Directory of shared object files
# opm-output_DEFINITIONS Defines that must be set to compile
# opm-output_CONFIG_VARS List of defines that should be in config.h
# HAVE_OPM_OUTPUT Binary value to use in config.h
# Copyright (C) 2012 Uni Research AS
# This code is licensed under The GNU General Public License v3.0
# use the generic find routine
include (opm-output-prereqs)
include (OpmPackage)
find_opm_package (
# module name
"opm-output"
# dependencies
"${opm-output_DEPS}"
# header to search for
"opm/output/OutputWriter.hpp"
# library to search for
"opmoutput"
# defines to be added to compilations
""
# test program
"#include <opm/output/eclipse/Summary.hpp>
int main (void) {
return 0;
}
"
# config variables
"${opm-output_CONFIG_VAR}"
)
include (UseDynamicBoost)
#debug_find_vars ("opm-output")

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

@@ -1,42 +0,0 @@
# - Find OPM polymer library
#
# Defines the following variables:
# opm-polymer_INCLUDE_DIRS Directory of header files
# opm-polymer_LIBRARIES Directory of shared object files
# opm-polymer_DEFINITIONS Defines that must be set to compile
# opm-polymer_CONFIG_VARS List of defines that should be in config.h
# HAVE_OPM_POLYMER Binary value to use in config.h
# Copyright (C) 2013 Uni Research AS
# This code is licensed under The GNU General Public License v3.0
include (opm-polymer-prereqs)
include (OpmPackage)
find_opm_package (
# module name
"opm-polymer"
# dependencies
"${opm-polymer_DEPS}"
# header to search for
"opm/polymer/PolymerState.hpp"
# library to search for
"opmpolymer"
# defines to be added to compilations
""
# test program
"#include <opm/polymer/PolymerState.hpp>
int main (void) {
Opm::PolymerState s;
return 0;
}
"
# config variables
"${opm-polymer_CONFIG_VAR}"
)
#debug_find_vars ("opm-polymer")

View File

@@ -1,41 +0,0 @@
# - Find OPM porous media solver library
#
# Defines the following variables:
# opm-porsol_INCLUDE_DIRS Directory of header files
# opm-porsol_LIBRARIES Directory of shared object files
# opm-porsol_DEFINITIONS Defines that must be set to compile
# opm-porsol_CONFIG_VARS List of defines that should be in config.h
# HAVE_OPM_PORSOL Binary value to use in config.h
# Copyright (C) 2013 Uni Research AS
# This code is licensed under The GNU General Public License v3.0
include (opm-porsol-prereqs)
include (OpmPackage)
find_opm_package (
# module name
"opm-porsol"
# dependencies
"${opm-porsol_DEPS}"
# header to search for
"opm/porsol/mimetic/IncompFlowSolverHybrid.hpp"
# library to search for
"opmporsol"
# defines to be added to compilations
""
# test program
"#include <opm/porsol/mimetic/IncompFlowSolverHybrid.hpp>
int main (void) {
return 0;
}
"
# config variables
"${opm-porsol_CONFIG_VAR}"
)
#debug_find_vars ("opm-porsol")

View File

@@ -1,30 +1,30 @@
# - Find OPM automatic differentiation library
#
# Defines the following variables:
# opm-autodiff_INCLUDE_DIRS Directory of header files
# opm-autodiff_LIBRARIES Directory of shared object files
# opm-autodiff_DEFINITIONS Defines that must be set to compile
# opm-autodiff_CONFIG_VARS List of defines that should be in config.h
# HAVE_OPM_AUTODIFF Binary value to use in config.h
# opm-simulators_INCLUDE_DIRS Directory of header files
# opm-simulators_LIBRARIES Directory of shared object files
# opm-simulators_DEFINITIONS Defines that must be set to compile
# opm-simulators_CONFIG_VARS List of defines that should be in config.h
# HAVE_OPM_SIMULATORS Binary value to use in config.h
# Copyright (C) 2012 Uni Research AS
# This code is licensed under The GNU General Public License v3.0
# use the generic find routine
include (opm-autodiff-prereqs)
include (opm-simulators-prereqs)
include (OpmPackage)
find_opm_package (
# module name
"opm-autodiff"
"opm-simulators"
# dependencies
"${opm-autodiff_DEPS}"
"${opm-simulators_DEPS}"
# header to search for
"opm/autodiff/AutoDiff.hpp"
# library to search for
"opmautodiff"
"opmsimulators"
# defines to be added to compilations
""
@@ -38,7 +38,7 @@ int main (void) {
}
"
# config variables
"${opm-autodiff_CONFIG_VAR}"
"${opm-simulators_CONFIG_VAR}"
)
include (UseDynamicBoost)
#debug_find_vars ("opm-autodiff")
#debug_find_vars ("opm-simulators")

View File

@@ -2,6 +2,10 @@
# compiler/linker. first parameter is the name of the variable that will
# receive this list, the rest is considered the list of libraries
function (linker_cmdline what INTO outvar FROM)
if (NOT (UNIX OR MSYS OR MINGW))
return ()
endif (NOT (UNIX OR MSYS OR MINGW))
# if we are going to put these in regexps, we must escape period
string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}")
string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}")

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,27 +13,51 @@ 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})
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}"
)
target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES})
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
)
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
@@ -63,7 +64,7 @@ set (_opm_proj_exemptions
)
# although a DUNE module, it is delivered in the OPM suite
set (dune-cornerpoint_SUITE "opm")
set (opm-core_SUITE "opm")
set (ewoms_SUITE "opm")
# insert this boilerplate whenever we are going to find a new package
@@ -87,7 +88,7 @@ macro (find_and_append_package_to prefix name)
# module is part of a suite if it has name with the pattern xxx-yyy
if (("${name}" MATCHES "[^-]+-.+") OR ${name}_SUITE)
# allow to override if the module doesn't quite fit the convention
# e.g. dune-cornerpoint
# e.g. dune-cornerpoint (since renamed to opm-grid)
if (NOT DEFINED ${name}_SUITE)
# extract suite name from module
string (REGEX REPLACE "([^-]+)-.+" "\\1" ${name}_SUITE "${name}")
@@ -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

@@ -69,7 +69,7 @@ function (opm_grid_type)
endfunction (opm_grid_type)
# write the grid type for dune-cornerpoint
# write the grid type for opm-grid
function (opm_cornerpoint_grid config_h)
opm_grid_type (
FILENAME ${CONFIG_H}

View File

@@ -25,19 +25,19 @@ set (KNOWN_VARS
)
set (KNOWN_opm_PKGS
autodiff
core
material
common
parser
polymer
porsol
material
core
grid
output
simulators
upscaling
verteq
)
set (KNOWN_dune_PKGS
common
cornerpoint
geometry
grid
istl

View File

@@ -28,6 +28,12 @@ if (POLICY CMP0048)
cmake_policy(SET CMP0048 OLD)
endif()
# set the behavior of the policy 0054 to NEW. (i.e. do not implicitly
# expand variables in if statements)
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
# include special
if (CMAKE_VERSION VERSION_LESS "2.8.3")
message (STATUS "Enabling compatibility modules for CMake 2.8.3")
@@ -37,7 +43,7 @@ endif (CMAKE_VERSION VERSION_LESS "2.8.3")
if (CMAKE_VERSION VERSION_LESS "2.8.5")
message (STATUS "Enabling compatibility modules for CMake 2.8.5")
list (APPEND CMAKE_MODULE_PATH "${OPM_MACROS_ROOT}/cmake/Modules/compat-2.8.5")
endif (CMAKE_VERSION VERSION_LESS "2.8.5")
endif (CMAKE_VERSION VERSION_LESS "2.8.5")
if (CMAKE_VERSION VERSION_LESS "2.8.7")
message (STATUS "Enabling compatibility modules for CMake 2.8.7")
@@ -93,6 +99,18 @@ endif (NOT USE_MPI)
# parallel programming
include (UseOpenMP)
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)
@@ -277,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,188 +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
if (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
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 (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
# 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 (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
# 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/.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 ".")
@@ -299,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
@@ -325,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

@@ -0,0 +1,7 @@
function (opm_add_python_test TEST_NAME TEST_SCRIPT)
add_test(NAME ${TEST_NAME}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND ${TEST_SCRIPT} ${ARGN})
set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "PYTHONPATH=${ERT_PYTHON_PATH}:${CWRAP_PYTHON_PATH}:${PYTHONPATH}")
endfunction(opm_add_python_test)

View File

@@ -1,4 +1,8 @@
# - Build satellites that are dependent of main library
option(ADD_DISABLED_CTESTS "Add the tests which are disabled due to failed preconditions to the ctest output (this makes ctest return an error if such a test is present)" ON)
mark_as_advanced(ADD_DISABLED_CTESTS)
#
# Enumerate all source code in a "satellite" directory such as tests/,
# compile each of them and optionally set them as a test for CTest to
@@ -68,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)
@@ -84,6 +89,11 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
endif ("${_sat_NAME}" MATCHES "${_regexp}")
endforeach (_regexp)
get_target_property (_sat_LOC ${_sat_NAME} LOCATION)
# Run tests through mpi-run. Ubuntu 14.04 provided mpi libs will crash
# in the MPI_Finalize() call otherwise.
if(MPI_FOUND)
set(_sat_LOC ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${_sat_LOC})
endif()
if (CMAKE_VERSION VERSION_LESS "2.8.4")
add_test (
NAME ${_sat_FANCY}
@@ -160,6 +170,10 @@ macro (opm_data satellite target dirname)
DEPENDS ${${satellite}_INPUT_FILES}
COMMENT "Making \"${satellite}\" data available in output tree"
)
if(NOT TARGET test-suite)
add_custom_target(test-suite)
endif()
add_dependencies(test-suite ${${satellite}_DATAFILES})
endmacro (opm_data satellite target dirname files)
# Add a single unit test (can be orchestrated by the 'ctest' command)
@@ -289,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
@@ -323,12 +332,19 @@ 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
# CDash dashboard. it this is removed, the test is just silently
# ignored.
if (NOT CURTEST_ONLY_COMPILE)
if (NOT CURTEST_ONLY_COMPILE AND ADD_DISABLED_CTESTS)
add_test(${TestName} skip_test_dummy)
endif()
endif()

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

@@ -92,13 +92,12 @@ opm_static_add_dependencies(dune-geometry dune-common)
opm_static_add_dependencies(dune-grid dune-geometry)
# OPM
foreach(opm_repo opm-common opm-parser opm-core dune-cornerpoint opm-material
opm-porsol opm-upscaling)
foreach(opm_repo opm-common opm-parser opm-core opm-output opm-grid opm-material
opm-upscaling)
opm_from_git(https://github.com/OPM/${opm_repo} ${opm_repo} ${OPM_BENCHMARK_VERSION})
endforeach()
opm_static_add_dependencies(opm-parser opm-common ert)
opm_static_add_dependencies(opm-core opm-parser dune-istl)
opm_static_add_dependencies(dune-cornerpoint opm-core dune-grid)
opm_static_add_dependencies(opm-grid opm-core dune-grid)
opm_static_add_dependencies(opm-material opm-core)
opm_static_add_dependencies(opm-porsol dune-cornerpoint opm-material)
opm_static_add_dependencies(opm-upscaling opm-porsol)
opm_static_add_dependencies(opm-upscaling opm-grid opm-material)

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

@@ -0,0 +1,53 @@
# - Use PThread features
#
# Synopsis:
#
# find_threads (module)
#
# where:
#
# module Name of the module to which Threads support
# etc. should be added, e.g. "opm-core".
#
# Note: Compiler flags are always added globally, to avoid ABI
# incompatibility problems.
#
# It is assumed that the following variables are available
#
# ${module}_QUIET Verbosity level of the parent's find module
# ${module}_LIBRARIES List of libraries to which Thread support will be added
#
# Example:
# find_threads (opm-core)
include (AddOptions)
include (UseCompVer)
is_compiler_gcc_compatible ()
macro(find_threads opm)
# default is that Threads are added
option(USE_PTHREAD "Use pthreads" ON)
# if USE_PTHREAD is enabled then check and set HAVE_PTHREAD
if( USE_PTHREAD )
# threading library
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package (Threads ${${opm}_QUIET})
if (CMAKE_USE_PTHREADS_INIT)
list (APPEND ${opm}_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
if (CXX_COMPAT_GCC)
check_cxx_accepts_flag ("-pthread" HAVE_PTHREAD)
if(HAVE_PTHREAD)
add_options (ALL_LANGUAGES ALL_BUILDS "-pthread")
set(HAVE_PTHREAD "1")
endif(HAVE_PTHREAD)
endif (CXX_COMPAT_GCC)
else(CMAKE_USE_PTHREADS_INIT)
set(USE_PTHREAD OFF)
endif (CMAKE_USE_PTHREADS_INIT)
else( USE_PTHREAD )
# reset HAVE_PTHREAD
set(HAVE_PTHREAD "")
endif( USE_PTHREAD )
endmacro(find_threads opm)

View File

@@ -13,10 +13,17 @@
# information as it gets tiresome to rebuild the project everytime one
# makes changes to any of the unit tests.
message("-- Writing version information to local header project-version.h")
string (TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_upper_)
if (cmake_build_type_upper_ MATCHES DEBUG)
file (WRITE "${PROJECT_BINARY_DIR}/project-version.h"
"#define PROJECT_VERSION \"${${project}_LABEL} (debug)\"\n"
"#ifndef OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
"#define OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
"#define PROJECT_VERSION_NAME \"${${project}_LABEL}\"\n"
"#define PROJECT_VERSION_HASH \"debug\"\n"
"#define PROJECT_VERSION \"${${project}_LABEL} (debug)\"\n"
"#endif // OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
)
else ()
if (NOT GIT_FOUND)
@@ -29,8 +36,13 @@ else ()
# above.
if (NOT GIT_FOUND)
file (WRITE "${PROJECT_BINARY_DIR}/project-version.h"
"#define PROJECT_VERSION \"${${project}_LABEL}\"\n"
)
"#ifndef OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
"#define OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
"#define PROJECT_VERSION_NAME \"${${project}_LABEL}\"\n"
"#define PROJECT_VERSION_HASH \"unknown git version\"\n"
"#define PROJECT_VERSION \"${${project}_LABEL} (unknown git version)\"\n"
"#endif // OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
)
else ()
add_custom_target (update-version ALL
COMMAND ${CMAKE_COMMAND}

View File

@@ -9,6 +9,13 @@ set(DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING 1)
set (ewoms_CONFIG_VAR
HAVE_QUAD
HAVE_VALGRIND
HAVE_DUNE_COMMON
HAVE_DUNE_GEOMETRY
HAVE_DUNE_GRID
HAVE_DUNE_LOCALFUNCTIONS
HAVE_DUNE_ISTL
HAVE_DUNE_ALUGRID
HAVE_DUNE_FEM
DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING
)
@@ -18,14 +25,17 @@ set (ewoms_DEPS
"CXX11Features REQUIRED"
# DUNE prerequisites
"dune-common REQUIRED"
"dune-localfunctions REQUIRED"
"dune-geometry REQUIRED"
"dune-grid REQUIRED"
"dune-istl REQUIRED"
"opm-common REQUIRED"
"opm-material REQUIRED"
"dune-localfunctions"
"dune-alugrid"
"dune-fem"
"dune-cornerpoint"
"opm-parser"
"opm-grid"
"opm-core"
# librt (on some systems necessary for clock_gettime())
"librt REQUIRED"
# valgrind client requests

View File

@@ -1,26 +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-autodiff_CONFIG_VAR
HAVE_DUNE_CORNERPOINT
)
# dependencies
set (opm-autodiff_DEPS
# Compile with C99 support if available
"C99"
# Compile with C++0x/11 support if available
"CXX11Features"
# Various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
# DUNE prerequisites
"dune-common REQUIRED;
dune-istl REQUIRED;
dune-cornerpoint;
opm-common REQUIRED;
opm-core REQUIRED"
# Eigen
"Eigen3 3.2.0"
)

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
@@ -12,5 +12,6 @@ set (opm-common_DEPS
# compile with C++0x/11 support if available
"CXX11Features REQUIRED"
# various runtime library enhancements
""
"Boost 1.44.0
COMPONENTS system unit_test_framework REQUIRED"
)

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
@@ -18,7 +21,7 @@ set (opm-core_DEPS
"CXX11Features REQUIRED"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
# matrix library
"BLAS REQUIRED"
"LAPACK REQUIRED"
@@ -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,4 +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

@@ -2,24 +2,20 @@
# 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-porsol_CONFIG_VAR
set (opm-flowdiagnostics-applications_CONFIG_VAR
)
# dependencies
set (opm-porsol_DEPS
set (opm-flowdiagnostics-applications_DEPS
# compile with C99 support if available
"C99"
# compile with C++0x/11 support if available
"CXX11Features"
# various runtime library enhancements
"CXX11Features REQUIRED"
"Boost 1.44.0
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
# DUNE dependency
"dune-common REQUIRED;
dune-istl REQUIRED;
dune-grid REQUIRED;
opm-common;
opm-core REQUIRED;
opm-material REQUIRED;
dune-cornerpoint REQUIRED"
COMPONENTS filesystem regex system unit_test_framework REQUIRED"
"ecl REQUIRED"
# prerequisite OPM modules
"opm-common REQUIRED;
opm-flowdiagnostics REQUIRED;
opm-core REQUIRED"
)

View File

@@ -2,18 +2,17 @@
# 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
set (opm-flowdiagnostics_CONFIG_VAR
)
# dependencies
set (opm-benchmarks_DEPS
set (opm-flowdiagnostics_DEPS
# compile with C99 support if available
"C99"
# compile with C++0x/11 support if available
"CXX11Features REQUIRED"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
# OPM dependency
"opm-common"
"opm-core REQUIRED"
"opm-upscaling REQUIRED"
COMPONENTS unit_test_framework REQUIRED"
# prerequisite OPM modules
"opm-common REQUIRED"
)

View File

@@ -2,31 +2,35 @@
# 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 (dune-cornerpoint_CONFIG_VAR
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
HAVE_DUNE_ISTL
HAVE_MPI
HAVE_ZOLTAN
)
# dependencies
set (dune-cornerpoint_DEPS
set (opm-grid_DEPS
# compile with C99 support if available
"C99"
# compile with C++0x/11 support if available
"CXX11Features"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
# DUNE dependency
"dune-common REQUIRED;
dune-grid REQUIRED;
dune-geometry REQUIRED"
# OPM dependency
"opm-common REQUIRED;
opm-core REQUIRED"
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
"MPI"
"dune-common"
"dune-grid REQUIRED"
"dune-istl"
"opm-common REQUIRED"
"opm-parser REQUIRED"
"ZOLTAN"
)

View File

@@ -16,8 +16,10 @@ set (opm-material_DEPS
# compile with C++0x/11 support if available
"CXX11Features REQUIRED"
# prerequisite OPM modules
"opm-common"
"opm-parser"
"opm-common REQUIRED"
# DUNE dependency
"dune-common REQUIRED"
# valgrind client requests
"Valgrind"
)

View File

@@ -2,24 +2,23 @@
# 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-polymer_CONFIG_VAR
set (opm-output_CONFIG_VAR
HAVE_ERT
)
# dependencies
set (opm-polymer_DEPS
set (opm-output_DEPS
# compile with C99 support if available
"C99"
# compile with C++0x/11 support if available
"CXX11Features"
"CXX11Features REQUIRED"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
# Ensembles-based Reservoir Tools
"ERT"
# OPM dependency
"opm-autodiff REQUIRED;
opm-common;
opm-core REQUIRED"
# Eigen
"Eigen3 3.1 REQUIRED"
COMPONENTS unit_test_framework REQUIRED"
# Ensembles-based Reservoir Tools (ERT)
"ecl REQUIRED"
# Look for MPI support
"opm-common REQUIRED"
# Parser library for ECL-type simulation models
"opm-parser REQUIRED"
)

View File

@@ -0,0 +1,39 @@
# -*- 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-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
set (opm-simulators_DEPS
# Compile with C99 support if available
"C99"
# Compile with C++0x/11 support if available
"CXX11Features"
# Various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
# DUNE prerequisites
"dune-common REQUIRED;
dune-istl REQUIRED"
"ERTPython"
# Tim Davis' SuiteSparse archive
"SuiteSparse COMPONENTS umfpack REQUIRED"
# OPM dependency
"opm-common REQUIRED;
opm-parser REQUIRED;
opm-grid REQUIRED;
opm-core REQUIRED;
opm-output REQUIRED;
ewoms REQUIRED"
# Eigen
"Eigen3 3.2.0"
)

View File

@@ -25,8 +25,8 @@ set (opm-upscaling_DEPS
dune-istl REQUIRED;
dune-geometry REQUIRED;
dune-grid REQUIRED;
opm-common;
opm-common REQUIRED;
opm-grid REQUIRED;
opm-core REQUIRED;
dune-cornerpoint REQUIRED;
opm-porsol REQUIRED"
opm-output REQUIRED"
)

View File

@@ -13,7 +13,7 @@ set (opm-verteq_DEPS
"CXX11Features"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
# OPM dependency
"opm-common;
opm-core REQUIRED"

View File

@@ -45,15 +45,17 @@ if (sha1)
if (dirty OR staged)
set (sha1 "${sha1}*")
endif ()
# make a formatted version that can be appended to the label
set (sha1 " (${sha1})")
endif ()
# write the content to a temporary file in a C compatible format
file (WRITE "${PROJECT_BINARY_DIR}/project-version.tmp"
"#define PROJECT_VERSION \"${PROJECT_LABEL}${sha1}\"\n"
)
"#ifndef OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
"#define OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
"#define PROJECT_VERSION_NAME \"${PROJECT_LABEL}\"\n"
"#define PROJECT_VERSION_HASH \"${sha1}\"\n"
"#define PROJECT_VERSION \"${PROJECT_LABEL} (${sha1})\"\n"
"#endif // OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
)
# only commit this to source code if it actually changed. here
# we use execute_process instead of exec_program to avoid having

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-rc1-1~xenial) xenial; urgency=medium
* New release

13
debian/control vendored
View File

@@ -4,19 +4,30 @@ Maintainer: Arne Morten Kvarving <arne.morten.kvarving@sintef.no>
Build-Depends: build-essential, debhelper (>= 9),
pkg-config, cmake, git, libtool, doxygen,
texlive-latex-extra, texlive-latex-recommended,
ghostscript
ghostscript, libboost-system-dev, libboost-test-dev
Standards-Version: 3.9.2
Section: libs
Homepage: http://opm-project.org
Vcs-Git: git://github.com/OPM/opm-common.git
Vcs-Browser: https://github.com/OPM/opm-common
Package: libopm-common1
Section: libs
Pre-Depends: ${misc:Pre-Depends}, multiarch-support
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}
Provides: libopm-common
Description: OPM common library
The OPM common library contains generic code shared across all OPM modules.
Package: libopm-common1-dev
Section: libdevel
Architecture: any
Multi-Arch: foreign
Provides: libopm-common-dev
Suggests: libopm-common1-doc
Depends: libopm-common1 (= ${binary:Version})
Description: OPM common library -- development files
The OPM common library contains the shared buildsystem
and helpers shared across all OPM modules.

View File

@@ -1,5 +1,6 @@
usr/include/*
usr/lib/dunecontrol/*
usr/lib/pkgconfig/*
usr/lib/*/pkgconfig/*
usr/share/cmake/*
usr/share/opm/*
usr/lib/*/lib*.so

1
debian/libopm-common1.install vendored Normal file
View File

@@ -0,0 +1 @@
usr/lib/*/lib*.so.*

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

@@ -1,4 +1,12 @@
####################################################################
# Dune module information file: This file gets parsed by dunecontrol
# and by the CMake build scripts.
####################################################################
Module: opm-common
Description: Open Porous Media Initiative shared infrastructure
Version: 2015.10
Version: 2017.10-rc1
Label: 2017.10-rc1
Maintainer: opm@opm-project.org
MaintainerName: OPM community
Url: http://opm-project.org

11
jenkins/README.md Normal file
View File

@@ -0,0 +1,11 @@
# opm-common jenkins build scripts:
**build-opm-module.sh**:
This is a helper script which contains functions for building,
testing and cloning modules.
**build.sh**:
This expects to run on a jenkins instance with opm-common as the 'origin' remote.
It will build and test opm-common. It can be used both for post-merge builds
of the master branch and for a github pull request builder job.

233
jenkins/build-opm-module.sh Executable file
View File

@@ -0,0 +1,233 @@
#!/bin/bash
declare -A configurations
# Parse revisions from trigger comment and setup arrays
# Depends on: 'upstreams', upstreamRev',
# 'downstreams', 'downstreamRev',
# 'ghprbCommentBody',
# 'CONFIGURATIONS', 'TOOLCHAINS'
function parseRevisions {
for upstream in ${upstreams[*]}
do
if grep -qi "$upstream=" <<< $ghprbCommentBody
then
upstreamRev[$upstream]=pull/`echo $ghprbCommentBody | sed -r "s/.*${upstream,,}=([0-9]+).*/\1/g"`/merge
fi
done
if grep -q "with downstreams" <<< $ghprbCommentBody
then
for downstream in ${downstreams[*]}
do
if grep -qi "$downstream=" <<< $ghprbCommentBody
then
downstreamRev[$downstream]=pull/`echo $ghprbCommentBody | sed -r "s/.*${downstream,,}=([0-9]+).*/\1/g"`/merge
fi
done
fi
# Default to a serial build if no types are given
if test -z "$BTYPES"
then
BTYPES="serial"
fi
# Convert to arrays for easy looping
declare -a BTYPES_ARRAY
for btype in $BTYPES
do
BTYPES_ARRAY=($BTYPES_ARRAY $btype)
done
TOOLCHAIN_ARRAY=($CMAKE_TOOLCHAIN_FILES)
for index in ${!BTYPES_ARRAY[*]}
do
key=${BTYPES_ARRAY[$index]}
data=${TOOLCHAIN_ARRAY[$index]}
configurations[$key]=$data
done
}
# Print revisions and configurations
# $1 = Name of main module
# Depends on: 'upstreams', upstreamRev',
# 'downstreams', 'downstreamRev',
# 'ghprbCommentBody',
# 'configurations', 'sha1'
function printHeader {
echo -e "Repository revisions:"
for upstream in ${upstreams[*]}
do
echo -e "\t [upstream] $upstream=${upstreamRev[$upstream]}"
done
echo -e "\t[main module] $1=$sha1"
if grep -q "with downstreams" <<< $ghprbCommentBody
then
for downstream in ${downstreams[*]}
do
echo -e "\t [downstream] $downstream=${downstreamRev[$downstream]}"
done
fi
echo "Configurations to process:"
for conf in ${!configurations[@]}
do
echo -e "\t$conf=${configurations[$conf]}"
done
}
# $1 = Additional cmake parameters
# $2 = 0 to build and install module, 1 to build and test module
# $3 = Source root of module to build
function build_module {
cmake $3 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=$2 -DCMAKE_TOOLCHAIN_FILE=${configurations[$configuration]} $1
test $? -eq 0 || exit 1
if test $2 -eq 1
then
if [ ! -z $BUILDTHREADS ]
then
cmake --build . -- -j$BUILDTHREADS
else
cmake --build .
fi
test $? -eq 0 || exit 2
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
if ! grep -q "with downstreams" <<< $ghprbCommentBody
then
# Add configuration name
sed -e "s/classname=\"TestSuite\"/classname=\"${configuration}\"/g" testoutput.xml > $WORKSPACE/$configuration/testoutput.xml
fi
else
if [ ! -z $BUILDTHREADS ]
then
cmake --build . --target install -- -j$BUILDTHREADS
else
cmake --build . --target install
fi
fi
}
# $1 = Name of module
# $2 = git-rev to use for module
function clone_module {
# Already cloned by an earlier configuration
test -d $WORKSPACE/deps/$1 && return 0
pushd .
mkdir -p $WORKSPACE/deps/$1
cd $WORKSPACE/deps/$1
git init .
if [ "$1" == "libecl" ]
then
git remote add origin https://github.com/Statoil/$1
else
git remote add origin https://github.com/OPM/$1
fi
git fetch --depth 1 origin $2:branch_to_build
git checkout branch_to_build
test $? -eq 0 || exit 1
popd
}
# $1 = Module to clone
# $2 = Additional cmake parameters
# $3 = git-rev to use for module
# $4 = Build root
function clone_and_build_module {
clone_module $1 $3
pushd .
mkdir -p $4/build-$1
cd $4/build-$1
test_build=0
if test -n "$5"
then
test_build=$5
fi
build_module "$2" $test_build $WORKSPACE/deps/$1
test $? -eq 0 || exit 1
popd
}
# Uses pre-filled arrays upstreams, and associativ array upstreamRev
# which holds the revisions to use for upstreams.
function build_upstreams {
for upstream in ${upstreams[*]}
do
echo "Building upstream $upstream=${upstreamRev[$upstream]} configuration=$configuration"
# Build upstream and execute installation
clone_and_build_module $upstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install" ${upstreamRev[$upstream]} $WORKSPACE/$configuration
test $? -eq 0 || exit 1
done
test $? -eq 0 || exit 1
}
# $1 - name of the module we are called from
# Uses pre-filled arrays downstreams, and associativ array downstreamRev
# which holds the default revisions to use for downstreams
function build_downstreams {
pushd .
cd $WORKSPACE/$configuration/build-$1
cmake --build . --target install
popd
egrep_cmd="xml_grep --wrap testsuites --cond testsuite $WORKSPACE/$configuration/build-$1/testoutput.xml"
for downstream in ${downstreams[*]}
do
echo "Building downstream $downstream=${downstreamRev[$downstream]} configuration=$configuration"
# Build downstream and execute installation
clone_and_build_module $downstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_DATA_ROOT=$OPM_DATA_ROOT" ${downstreamRev[$downstream]} $WORKSPACE/$configuration 1
test $? -eq 0 || exit 1
# Installation for downstream
pushd .
cd $WORKSPACE/$configuration/build-$downstream
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
$egrep_cmd > $WORKSPACE/$configuration/testoutput.xml
# Add testsuite name
sed -e "s/classname=\"TestSuite\"/classname=\"${configuration}\"/g" -i $WORKSPACE/$configuration/testoutput.xml
test $? -eq 0 || exit 1
}
# $1 = Name of main module
function build_module_full {
for configuration in ${!configurations[@]}
do
# Build upstream modules
build_upstreams
# Build main module
pushd .
mkdir -p $configuration/build-$1
cd $configuration/build-$1
echo "Building main module $1=$sha1 configuration=$configuration"
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_DATA_ROOT=$OPM_DATA_ROOT" 1 $WORKSPACE
test $? -eq 0 || exit 1
popd
# If no downstream builds we are done
if grep -q "with downstreams" <<< $ghprbCommentBody
then
build_downstreams $1
test $? -eq 0 || exit 1
fi
done
}

42
jenkins/build.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
source `dirname $0`/build-opm-module.sh
# Create symlink so build_module can find the test result converter
mkdir deps
ln -sf $WORKSPACE deps/opm-common
# Downstreams and revisions
declare -a downstreams
downstreams=(libecl
opm-parser
opm-output
opm-material
opm-grid
opm-core
ewoms
opm-simulators
opm-upscaling
)
declare -A downstreamRev
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
parseRevisions
printHeader opm-common
# Setup opm-data if necessary
if grep -q "with downstreams" <<< $ghprbCommentBody
then
source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh
fi
build_module_full opm-common

116
jenkins/conv.xsl Normal file
View File

@@ -0,0 +1,116 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/Site">
<testsuite>
<xsl:variable name="BuildName"><xsl:value-of select="@BuildName"/></xsl:variable>
<xsl:variable name="BuildStamp"><xsl:value-of select="@BuildStamp"/></xsl:variable>
<xsl:variable name="Name"><xsl:value-of select="@Name"/></xsl:variable>
<xsl:variable name="Generator"><xsl:value-of select="@Generator"/></xsl:variable>
<xsl:variable name="CompilerName"><xsl:value-of select="@CompilerName"/></xsl:variable>
<xsl:variable name="OSName"><xsl:value-of select="@OSName"/></xsl:variable>
<xsl:variable name="Hostname"><xsl:value-of select="@Hostname"/></xsl:variable>
<xsl:variable name="OSRelease"><xsl:value-of select="@OSRelease"/></xsl:variable>
<xsl:variable name="OSVersion"><xsl:value-of select="@OSVersion"/></xsl:variable>
<xsl:variable name="OSPlatform"><xsl:value-of select="@OSPlatform"/></xsl:variable>
<xsl:variable name="Is64Bits"><xsl:value-of select="@Is64Bits"/></xsl:variable>
<xsl:variable name="VendorString"><xsl:value-of select="@VendorString"/></xsl:variable>
<xsl:variable name="VendorID"><xsl:value-of select="@VendorID"/></xsl:variable>
<xsl:variable name="FamilyID"><xsl:value-of select="@FamilyID"/></xsl:variable>
<xsl:variable name="ModelID"><xsl:value-of select="@ModelID"/></xsl:variable>
<xsl:variable name="ProcessorCacheSize"><xsl:value-of select="@ProcessorCacheSize"/></xsl:variable>
<xsl:variable name="NumberOfLogicalCPU"><xsl:value-of select="@NumberOfLogicalCPU"/></xsl:variable>
<xsl:variable name="NumberOfPhysicalCPU"><xsl:value-of select="@NumberOfPhysicalCPU"/></xsl:variable>
<xsl:variable name="TotalVirtualMemory"><xsl:value-of select="@TotalVirtualMemory"/></xsl:variable>
<xsl:variable name="TotalPhysicalMemory"><xsl:value-of select="@TotalPhysicalMemory"/></xsl:variable>
<xsl:variable name="LogicalProcessorsPerPhysical"><xsl:value-of select="@LogicalProcessorsPerPhysical"/></xsl:variable>
<xsl:variable name="ProcessorClockFrequency"><xsl:value-of select="@ProcessorClockFrequency"/></xsl:variable>
<properties>
<property name="BuildName" value="{$BuildName}" />
<property name="BuildStamp" value="{$BuildStamp}" />
<property name="Name" value="{$Name}" />
<property name="Generator" value="{$Generator}" />
<property name="CompilerName" value="{$CompilerName}" />
<property name="OSName" value="{$OSName}" />
<property name="Hostname" value="{$Hostname}" />
<property name="OSRelease" value="{$OSRelease}" />
<property name="OSVersion" value="{$OSVersion}" />
<property name="OSPlatform" value="{$OSPlatform}" />
<property name="Is64Bits" value="{$Is64Bits}" />
<property name="VendorString" value="{$VendorString}" />
<property name="VendorID" value="{$VendorID}" />
<property name="FamilyID" value="{$FamilyID}" />
<property name="ModelID" value="{$ModelID}" />
<property name="ProcessorCacheSize" value="{$ProcessorCacheSize}" />
<property name="NumberOfLogicalCPU" value="{$NumberOfLogicalCPU}" />
<property name="NumberOfPhysicalCPU" value="{$NumberOfPhysicalCPU}" />
<property name="TotalVirtualMemory" value="{$TotalVirtualMemory}" />
<property name="TotalPhysicalMemory" value="{$TotalPhysicalMemory}" />
<property name="LogicalProcessorsPerPhysical" value="{$LogicalProcessorsPerPhysical}" />
<property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
</properties>
<xsl:apply-templates select="Testing/Test"/>
<system-out>
BuildName: <xsl:value-of select="$BuildName" />
BuildStamp: <xsl:value-of select="$BuildStamp" />
Name: <xsl:value-of select="$Name" />
Generator: <xsl:value-of select="$Generator" />
CompilerName: <xsl:value-of select="$CompilerName" />
OSName: <xsl:value-of select="$OSName" />
Hostname: <xsl:value-of select="$Hostname" />
OSRelease: <xsl:value-of select="$OSRelease" />
OSVersion: <xsl:value-of select="$OSVersion" />
OSPlatform: <xsl:value-of select="$OSPlatform" />
Is64Bits: <xsl:value-of select="$Is64Bits" />
VendorString: <xsl:value-of select="$VendorString" />
VendorID: <xsl:value-of select="$VendorID" />
FamilyID: <xsl:value-of select="$FamilyID" />
ModelID: <xsl:value-of select="$ModelID" />
ProcessorCacheSize: <xsl:value-of select="$ProcessorCacheSize" />
NumberOfLogicalCPU: <xsl:value-of select="$NumberOfLogicalCPU" />
NumberOfPhysicalCPU: <xsl:value-of select="$NumberOfPhysicalCPU" />
TotalVirtualMemory: <xsl:value-of select="$TotalVirtualMemory" />
TotalPhysicalMemory: <xsl:value-of select="$TotalPhysicalMemory" />
LogicalProcessorsPerPhysical: <xsl:value-of select="$LogicalProcessorsPerPhysical" />
ProcessorClockFrequency: <xsl:value-of select="$ProcessorClockFrequency" />
</system-out>
</testsuite>
</xsl:template>
<xsl:template match="Testing/Test">
<xsl:variable name="testcasename"><xsl:value-of select= "Name"/></xsl:variable>
<xsl:variable name="exectime">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Execution Time'">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<testcase name="{$testcasename}" classname="TestSuite" time="{$exectime}">
<xsl:if test="@Status = 'passed'">
</xsl:if>
<xsl:if test="@Status = 'failed'">
<xsl:variable name="failtype">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Code'">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="failcode">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Value'">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<error message="{$failtype} ({$failcode})"><xsl:value-of select="Results/Measurement/Value/text()" /></error>
</xsl:if>
<xsl:if test="@Status = 'notrun'">
<skipped><xsl:value-of select="Results/Measurement/Value/text()" /></skipped>
</xsl:if>
</testcase>
</xsl:template>
</xsl:stylesheet>

74
jenkins/convert.py Executable file
View File

@@ -0,0 +1,74 @@
#!/usr/bin/env python
# coding: utf-8
# originally from:
# http://www.warp1337.com/content/how-use-ctest-jenkins-xunit-or-junit-plugin
# improved by:
# Jorge Araya Navarro <elcorreo@deshackra.com>
# Veni, Sancte Spiritus.
from lxml import etree
import argparse
from os.path import expanduser
from os.path import join
import logging
# configure logging
logging.basicConfig(format="%(levelname)s: %(message)s",
level=logging.ERROR)
desc = ("Converts ctest XML file to xUnit/JUnit XML "
"compatible file to use with Jenkins-CI. "
"Did you found any bug? please report it on: "
"https://bitbucket.org/shackra/ctest-jenkins/issues")
# configure argument parser.
parser = argparse.ArgumentParser(description=desc)
parser.add_argument("-x", "--xslt", help="the XSLT file to use", required=True)
parser.add_argument("-t", "--tag", help=("the directory where 'Testing/TAG'"
"file is. Remember to call ctest with"
" '-T test' option to generate it"),
required=True)
parsed = parser.parse_args()
# expanding user symbol "~"
parsed.xsl = expanduser(parsed.xslt)
parsed.tag = expanduser(parsed.tag)
# opening the TAG file
directory = None
try:
with open(join(parsed.tag, "Testing", "TAG")) as tagfile:
directory = tagfile.readline().strip()
except NotADirectoryError:
logging.error(
"'Testing/TAG' wasn't found on directory '{}'.".format(parsed.tag))
exit(1)
except FileNotFoundError:
logging.error(
"File '{}' not found.".format(join(parsed.tag, "Testing", "TAG")))
exit(1)
xmldoc = None
transform = None
try:
with open(join(parsed.tag, "Testing", directory, "Test.xml"))\
as testxmlfile:
xmldoc = etree.parse(testxmlfile)
except FileNotFoundError:
logging.error("File {} not found. Was it deleted or moved?".format(
join(parsed.tag, "Testing", directory, "Test.xml")))
exit(1)
try:
with open(parsed.xslt) as xsltfile:
xslt_root = etree.XML(xsltfile.read())
transform = etree.XSLT(xslt_root)
except FileNotFoundError:
logging.error("File {} not found.".format(parsed.xslt))
exit(1)
result_tree = transform(xmldoc)
print(result_tree)

29
jenkins/setup-opm-data.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Predefined by environment
if test -z "$OPM_DATA_ROOT"
then
OPM_DATA_REVISION="master"
if grep -q "opm-data=" <<< $ghprbCommentBody
then
OPM_DATA_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-data=([0-9]+).*/\1/g'`/merge
fi
# Not specified in trigger, use shared copy
if [[ "$OPM_DATA_REVISION" = "master" ]] && [[ ! "$OPM_DATA_ROOT_PREDEFINED" = "" ]]
then
if ! test -d $WORKSPACE/deps/opm-data
then
cp $OPM_DATA_ROOT_PREDEFINED $WORKSPACE/deps/opm-data -R
fi
else
# Specified in trigger, download it
source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh
clone_module opm-data $OPM_DATA_REVISION
fi
else
if ! test -d $WORKSPACE/deps/opm-data
then
cp $OPM_DATA_ROOT $WORKSPACE/deps/opm-data -R
fi
fi
OPM_DATA_ROOT=$WORKSPACE/deps/opm-data

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

@@ -21,11 +21,12 @@
#ifndef OPM_ERRORMACROS_HPP
#define OPM_ERRORMACROS_HPP
#include <opm/common/OpmLog/OpmLog.hpp>
#include <string>
#include <sstream>
#include <exception>
#include <stdexcept>
#include <cassert>
// macros for reporting to stderr
@@ -52,7 +53,17 @@
do { \
std::ostringstream oss__; \
oss__ << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
OPM_MESSAGE(message); \
Opm::OpmLog::error(oss__.str()); \
throw Exception(oss__.str()); \
} while (false)
// Same as OPM_THROW, except for not making an OpmLog::error() call.
//
// Usage: OPM_THROW_NOLOG(ExceptionClass, "Error message " << value);
#define OPM_THROW_NOLOG(Exception, message) \
do { \
std::ostringstream oss__; \
oss__ << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
throw Exception(oss__.str()); \
} while (false)

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

@@ -0,0 +1,63 @@
/*
Copyright 2014 Andreas Lauser
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/>.
*/
#include <stdexcept>
#include <sstream>
#include <cassert>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
#include <opm/common/OpmLog/CounterLog.hpp>
namespace Opm {
CounterLog::CounterLog(int64_t messageTypes) : LogBackend(messageTypes)
{ }
CounterLog::CounterLog() : LogBackend(Log::DefaultMessageTypes)
{ }
size_t CounterLog::numMessages(int64_t messageType) const {
if (Log::isPower2( messageType )) {
auto iter = m_count.find( messageType );
if (iter == m_count.end())
return 0;
else
return (*iter).second;
} else
throw std::invalid_argument("The messageType ID must be 2^n");
}
void CounterLog::addMessageUnconditionally(int64_t messageType, const std::string& ) {
m_count[messageType]++;
}
void CounterLog::clear()
{
m_count.clear();
}
} // namespace Opm

View File

@@ -0,0 +1,53 @@
/*
Copyright 2014 Andreas Lauser
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/>.
*/
#ifndef OPM_COUNTERLOG_HPP
#define OPM_COUNTERLOG_HPP
#include <string>
#include <memory>
#include <map>
#include <opm/common/OpmLog/LogBackend.hpp>
namespace Opm {
/*!
* \brief Provides a simple sytem for log message which are found by the
* Parser/Deck/EclipseState classes during processing the deck.
*/
class CounterLog : public LogBackend
{
public:
explicit CounterLog(int64_t messageMask);
CounterLog();
size_t numMessages(int64_t messageType) const;
void clear();
protected:
void addMessageUnconditionally(int64_t messageFlag,
const std::string& message) override;
private:
std::map<int64_t , size_t> m_count;
};
} // namespace Opm
#endif

View File

@@ -0,0 +1,77 @@
/*
Copyright 2016 Statoil ASA.
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/>.
*/
#include <opm/common/OpmLog/EclipsePRTLog.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
namespace Opm {
void EclipsePRTLog::addMessageUnconditionally(int64_t messageType, const std::string& message)
{
StreamLog::addMessageUnconditionally(messageType, message);
m_count[messageType]++;
}
size_t EclipsePRTLog::numMessages(int64_t messageType) const
{
if (Log::isPower2( messageType )) {
auto iter = m_count.find( messageType );
if (iter == m_count.end())
return 0;
else
return (*iter).second;
} else
throw std::invalid_argument("The messageType ID must be 2^n");
}
EclipsePRTLog::~EclipsePRTLog()
{
if( ! print_summary_ )
{
return;
}
//output summary.
const std::string summary_msg = "\n\nError summary:" +
std::string("\nWarnings " + std::to_string(numMessages(Log::MessageType::Warning))) +
std::string("\nInfo " + std::to_string(numMessages(Log::MessageType::Info))) +
std::string("\nErrors " + std::to_string(numMessages(Log::MessageType::Error))) +
std::string("\nBugs " + std::to_string(numMessages(Log::MessageType::Bug))) +
std::string("\nDebug " + std::to_string(numMessages(Log::MessageType::Debug))) +
std::string("\nProblems " + std::to_string(numMessages(Log::MessageType::Problem))) +"\n";
StreamLog::addTaggedMessage(Log::MessageType::Info, "", summary_msg);
}
EclipsePRTLog::EclipsePRTLog(const std::string& logFile,
int64_t messageMask,
bool append,
bool print_summary)
: StreamLog(logFile, messageMask, append),
print_summary_(print_summary)
{}
EclipsePRTLog::EclipsePRTLog(std::ostream& os,
int64_t messageMask,
bool print_summary)
: StreamLog(os, messageMask), print_summary_(print_summary)
{}
}

View File

@@ -0,0 +1,65 @@
/*
Copyright 2016 Statoil ASA.
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/>.
*/
#ifndef ECLIPSEPRTLOG_H
#define ECLIPSEPRTLOG_H
#include <map>
#include <string>
#include <opm/common/OpmLog/StreamLog.hpp>
namespace Opm {
class EclipsePRTLog : public StreamLog {
public:
using StreamLog::StreamLog;
size_t numMessages(int64_t messageType) const;
~EclipsePRTLog();
/// \brief Construct a logger to the <MODLE>.PRT file
/// \param logFile The name of the logfile to use.
/// \param messageMask ????
/// \param append If true then we append messages to the file.
/// Otherwise a new file is created.
/// \param print_summary If true print a summary to the PRT file.
EclipsePRTLog(const std::string& logFile , int64_t messageMask,
bool append, bool print_summary);
/// \brief Construct a logger to the <MODLE>.PRT file
/// \param logFile The name of the logfile to use.
/// \param messageMask ????
/// \param append If true then we append messages to the file.
/// Otherwise a new file is created.
/// \param print_summary If true print a summary to the PRT file.
EclipsePRTLog(std::ostream& os , int64_t messageMask,
bool print_summary);
protected:
void addMessageUnconditionally(int64_t messageType, const std::string& message) override;
private:
std::map<int64_t, size_t> m_count;
/// \brief Whether to print a summary to the log file.
bool print_summary_ = true;
};
}
#endif // ECLIPSEPRTLOG_H

View File

@@ -0,0 +1,98 @@
/*
Copyright 2015 Statoil ASA.
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/>.
*/
#include <opm/common/OpmLog/LogBackend.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
namespace Opm {
LogBackend::LogBackend( int64_t mask ) :
m_mask(mask)
{
}
LogBackend::~LogBackend()
{
}
void LogBackend::setMessageFormatter(std::shared_ptr<MessageFormatterInterface> formatter)
{
m_formatter = formatter;
}
void LogBackend::setMessageLimiter(std::shared_ptr<MessageLimiter> limiter)
{
m_limiter = limiter;
}
void LogBackend::addMessage(int64_t messageFlag, const std::string& message)
{
// Forward the call to the tagged version.
addTaggedMessage(messageFlag, "", message);
}
void LogBackend::addTaggedMessage(int64_t messageType, const std::string& messageTag, const std::string& message) {
if (includeMessage( messageType, messageTag )) {
addMessageUnconditionally(messageType, message);
}
}
int64_t LogBackend::getMask() const
{
return m_mask;
}
bool LogBackend::includeMessage(int64_t messageFlag, const std::string& messageTag)
{
// Check mask.
const bool included = ((messageFlag & m_mask) == messageFlag) && (messageFlag > 0);
if (!included) {
return false;
}
// Use the message limiter (if any).
MessageLimiter::Response res = m_limiter
? m_limiter->handleMessageLimits(messageTag, messageFlag)
: MessageLimiter::Response::PrintMessage;
if (res == MessageLimiter::Response::JustOverTagLimit) {
// Special case: add a message to this backend about limit being reached.
std::string msg = "Message limit reached for message tag: " + messageTag;
addMessageUnconditionally(messageFlag, msg);
}
if (res == MessageLimiter::Response::JustOverCategoryLimit) {
// Special case: add a message to this backend about limit being reached.
std::string prefix = Log::prefixMessage(messageFlag, "");
std::string msg = "Message limit reached for message category: " + prefix.substr(0, prefix.size()-2);
addMessageUnconditionally(messageFlag, msg);
}
return res == MessageLimiter::Response::PrintMessage;
}
std::string LogBackend::formatMessage(int64_t messageFlag, const std::string& message)
{
if (m_formatter) {
return m_formatter->format(messageFlag, message);
} else {
return message;
}
}
}

View File

@@ -0,0 +1,86 @@
/*
Copyright 2015, 2016 Statoil ASA.
Copyright 2016 SINTEF ICT, Applied Mathematics.
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/>.
*/
#ifndef OPM_LOGBACKEND_HPP
#define OPM_LOGBACKEND_HPP
#include <opm/common/OpmLog/MessageFormatter.hpp>
#include <opm/common/OpmLog/MessageLimiter.hpp>
#include <cstdint>
#include <string>
#include <memory>
namespace Opm
{
/// Abstract interface class for log backends.
class LogBackend
{
public:
/// Construct with given message mask.
explicit LogBackend(int64_t mask);
/// Virtual destructor to enable inheritance.
virtual ~LogBackend();
/// Configure how formatMessage() will modify message strings.
void setMessageFormatter(std::shared_ptr<MessageFormatterInterface> formatter);
/// Configure how message tags will be used to limit messages.
void setMessageLimiter(std::shared_ptr<MessageLimiter> limiter);
/// Add a message to the backend if accepted by the message limiter.
void addMessage(int64_t messageFlag, const std::string& message);
/// Add a tagged message to the backend if accepted by the message limiter.
void addTaggedMessage(int64_t messageFlag,
const std::string& messageTag,
const std::string& message);
/// The message mask types are specified in the
/// Opm::Log::MessageType namespace, in file LogUtils.hpp.
int64_t getMask() const;
protected:
/// This is the method subclasses should override.
///
/// Typically a subclass may filter, change, and output
/// messages based on configuration and the messageFlag.
virtual void addMessageUnconditionally(int64_t messageFlag,
const std::string& message) = 0;
/// Return decorated version of message depending on configureDecoration() arguments.
std::string formatMessage(int64_t messageFlag, const std::string& message);
private:
/// Return true if all bits of messageFlag are also set in our mask,
/// and the message limiter returns a PrintMessage response.
bool includeMessage(int64_t messageFlag, const std::string& messageTag);
int64_t m_mask;
std::shared_ptr<MessageFormatterInterface> m_formatter;
std::shared_ptr<MessageLimiter> m_limiter;
};
} // namespace LogBackend
#endif

View File

@@ -0,0 +1,99 @@
/*
Copyright 2015 Statoil ASA.
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/>.
*/
#include <sstream>
#include <stdexcept>
#include <opm/common/OpmLog/LogUtil.hpp>
namespace Opm {
namespace Log {
bool isPower2(int64_t x) {
return ((x != 0) && !(x & (x - 1)));
}
std::string fileMessage(const std::string& filename , int line , const std::string& message) {
std::ostringstream oss;
oss << message << "\n" << "In file " << filename << ", line " << line << "\n";
return oss.str();
}
std::string fileMessage(int64_t messageType , const std::string& filename , int line , const std::string& message) {
return fileMessage( filename , line , prefixMessage( messageType , message ));
}
std::string prefixMessage(int64_t messageType, const std::string& message) {
std::string prefix;
switch (messageType) {
case MessageType::Debug:
prefix = "Debug";
break;
case MessageType::Note:
prefix = "Note";
break;
case MessageType::Info:
prefix = "Info";
break;
case MessageType::Warning:
prefix = "\nWarning";
break;
case MessageType::Error:
prefix = "\nError";
break;
case MessageType::Problem:
prefix = "\nProblem";
break;
case MessageType::Bug:
prefix = "\nBug";
break;
default:
throw std::invalid_argument("Unhandled messagetype");
}
return prefix + ": " + message;
}
std::string colorCodeMessage(int64_t messageType, const std::string& message) {
switch (messageType) {
case MessageType::Debug:
case MessageType::Note:
case MessageType::Info:
return message; // No color coding, not even the code for default color.
case MessageType::Warning:
return AnsiTerminalColors::blue_strong + message + AnsiTerminalColors::none;
case MessageType::Problem:
return AnsiTerminalColors::magenta_strong + message + AnsiTerminalColors::none;
case MessageType::Error:
case MessageType::Bug:
return AnsiTerminalColors::red_strong + message + AnsiTerminalColors::none;
default:
throw std::invalid_argument("Unhandled messagetype");
}
}
}
}

View File

@@ -0,0 +1,67 @@
/*
Copyright 2015 Statoil ASA.
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/>.
*/
#ifndef OPM_LOG_UTIL_HPP
#define OPM_LOG_UTIL_HPP
#include <cstdint>
#include <string>
namespace Opm {
namespace Log {
namespace MessageType {
const int64_t Debug = 1; /* Excessive information */
const int64_t Note = 2; /* Information that should only go into print file.*/
const int64_t Info = 4; /* Normal status information */
const int64_t Warning = 8; /* Input anomaly - possible error */
const int64_t Error = 16; /* Error in the input data - should probably exit. */
const int64_t Problem = 32; /* Calculation problems - e.g. convergence failure. */
const int64_t Bug = 64; /* An inconsistent state has been encountered in the simulator - should probably exit. */
}
const int64_t DefaultMessageTypes = MessageType::Debug + MessageType::Note + MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug;
const int64_t NoDebugMessageTypes = MessageType::Info + MessageType::Note + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug;
const int64_t StdoutMessageTypes = MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug;
/// Terminal codes for ANSI/vt100 compatible terminals.
/// See for example http://ascii-table.com/ansi-escape-sequences.php
namespace AnsiTerminalColors {
const std::string none = "\033[0m";
const std::string red = "\033[31m";
const std::string red_strong = "\033[31;1m";
const std::string yellow = "\033[33m";
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";
}
bool isPower2(int64_t x);
std::string fileMessage(const std::string& path, int line , const std::string& msg);
std::string fileMessage(int64_t messageType , const std::string& path, int line , const std::string& msg);
std::string prefixMessage(int64_t messageType , const std::string& msg);
std::string colorCodeMessage(int64_t messageType , const std::string& msg);
}
}
#endif

View File

@@ -0,0 +1,124 @@
/*
Copyright 2015 Statoil ASA.
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/>.
*/
#include <sstream>
#include <stdexcept>
#include <iostream>
#include <opm/common/OpmLog/LogBackend.hpp>
#include <opm/common/OpmLog/Logger.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
namespace Opm {
Logger::Logger()
: m_globalMask(0),
m_enabledTypes(0)
{
addMessageType( Log::MessageType::Debug , "debug");
addMessageType( Log::MessageType::Info , "info");
addMessageType( Log::MessageType::Warning , "warning");
addMessageType( Log::MessageType::Error , "error");
addMessageType( Log::MessageType::Problem , "problem");
addMessageType( Log::MessageType::Bug , "bug");
addMessageType( Log::MessageType::Note , "note");
}
void Logger::addTaggedMessage(int64_t messageType, const std::string& tag, const std::string& message) const {
if ((m_enabledTypes & messageType) == 0)
throw std::invalid_argument("Tried to issue message with unrecognized message ID");
if (m_globalMask & messageType) {
for (auto iter : m_backends) {
LogBackend& backend = *(iter.second);
backend.addTaggedMessage( messageType, tag, message );
}
}
}
void Logger::addMessage(int64_t messageType , const std::string& message) const {
addTaggedMessage(messageType, "", message);
}
void Logger::updateGlobalMask( int64_t mask ) {
m_globalMask |= mask;
}
bool Logger::hasBackend(const std::string& name) {
if (m_backends.find( name ) == m_backends.end())
return false;
else
return true;
}
void Logger::removeAllBackends() {
m_backends.clear();
m_globalMask = 0;
}
bool Logger::removeBackend(const std::string& name) {
size_t eraseCount = m_backends.erase( name );
if (eraseCount == 1)
return true;
else
return false;
}
void Logger::addBackend(const std::string& name , std::shared_ptr<LogBackend> backend) {
updateGlobalMask( backend->getMask() );
m_backends[ name ] = backend;
}
int64_t Logger::enabledMessageTypes() const {
return m_enabledTypes;
}
//static:
bool Logger::enabledMessageType( int64_t enabledTypes , int64_t messageType) {
if (Log::isPower2( messageType)) {
if ((messageType & enabledTypes) == 0)
return false;
else
return true;
} else
throw std::invalid_argument("The message type id must be ~ 2^n");
}
//static:
bool Logger::enabledDefaultMessageType( int64_t messageType) {
return enabledMessageType( Log::DefaultMessageTypes , messageType );
}
bool Logger::enabledMessageType( int64_t messageType) const {
return enabledMessageType( m_enabledTypes , messageType );
}
void Logger::addMessageType( int64_t messageType , const std::string& /* prefix */) {
if (Log::isPower2( messageType)) {
m_enabledTypes |= messageType;
} else
throw std::invalid_argument("The message type id must be ~ 2^n");
}
}

View File

@@ -0,0 +1,82 @@
/*
Copyright 2015 Statoil ASA.
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/>.
*/
#ifndef OPM_LOGGER_HPP
#define OPM_LOGGER_HPP
#include <stdexcept>
#include <cstdint>
#include <map>
#include <memory>
#include <string>
namespace Opm {
class LogBackend;
class Logger {
public:
Logger();
void addMessage(int64_t messageType , const std::string& message) const;
void addTaggedMessage(int64_t messageType, const std::string& tag, const std::string& message) const;
static bool enabledDefaultMessageType( int64_t messageType);
bool enabledMessageType( int64_t messageType) const;
void addMessageType( int64_t messageType , const std::string& prefix);
int64_t enabledMessageTypes() const;
void addBackend(const std::string& name , std::shared_ptr<LogBackend> backend);
bool hasBackend(const std::string& name);
bool removeBackend(const std::string& name);
void removeAllBackends();
template <class BackendType>
std::shared_ptr<BackendType> getBackend(const std::string& name) const {
auto pair = m_backends.find( name );
if (pair == m_backends.end())
throw std::invalid_argument("Invalid backend name: " + name);
else
return std::static_pointer_cast<BackendType>(m_backends.find(name)->second);
}
template <class BackendType>
std::shared_ptr<BackendType> popBackend(const std::string& name) {
auto pair = m_backends.find( name );
if (pair == m_backends.end())
throw std::invalid_argument("Invalid backend name: " + name);
else {
std::shared_ptr<LogBackend> backend = (*pair).second;
removeBackend( name );
return std::static_pointer_cast<BackendType>(backend);
}
}
private:
void updateGlobalMask( int64_t mask );
static bool enabledMessageType( int64_t enabledTypes , int64_t messageType);
int64_t m_globalMask;
int64_t m_enabledTypes;
std::map<std::string , std::shared_ptr<LogBackend> > m_backends;
};
}
#endif

View File

@@ -0,0 +1,95 @@
/*
Copyright 2016 SINTEF ICT, Applied Mathematics.
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/>.
*/
#ifndef OPM_MESSAGEFORMATTER_HEADER_INCLUDED
#define OPM_MESSAGEFORMATTER_HEADER_INCLUDED
#include <opm/common/OpmLog/LogUtil.hpp>
#include <string>
namespace Opm
{
/// Abstract interface for message formatting classes.
class MessageFormatterInterface
{
public:
/// Virtual destructor to enable inheritance.
virtual ~MessageFormatterInterface() = default;
/// Should return a possibly modified/decorated version of the
/// input string, the formatting applied depending on the
/// message_flag.
virtual std::string format(const int64_t message_flag, const std::string& message) = 0;
};
/// A simple formatter capable of adding message prefixes and colors.
class SimpleMessageFormatter : public MessageFormatterInterface
{
public:
/// Constructor controlling formatting to be applied.
SimpleMessageFormatter(const bool use_prefix, const bool use_color_coding)
: use_color_coding_(use_color_coding)
{
if (use_prefix) {
prefix_flag_ = Log::DefaultMessageTypes;
}
}
SimpleMessageFormatter(const int64_t prefix_flag, const bool use_color_coding)
: use_color_coding_(use_color_coding),
prefix_flag_(prefix_flag)
{
}
explicit SimpleMessageFormatter(const bool use_color_coding)
: use_color_coding_(use_color_coding)
{
prefix_flag_ = Log::MessageType::Warning + Log::MessageType::Error
+ Log::MessageType::Problem + Log::MessageType::Bug;
}
/// Returns a copy of the input string with a flag-dependant
/// prefix (if use_prefix) and the entire message in a
/// flag-dependent color (if use_color_coding).
virtual std::string format(const int64_t message_flag, const std::string& message) override
{
std::string msg = message;
if (message_flag & prefix_flag_) {
msg = Log::prefixMessage(message_flag, msg);
}
if (use_color_coding_) {
msg = Log::colorCodeMessage(message_flag, msg);
}
return msg;
}
private:
bool use_color_coding_ = false;
int64_t prefix_flag_ = 0;
};
} // namespace Opm
#endif // OPM_MESSAGEFORMATTER_HEADER_INCLUDED

View File

@@ -0,0 +1,187 @@
/*
Copyright 2016 SINTEF ICT, Applied Mathematics.
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/>.
*/
#ifndef OPM_MESSAGELIMITER_HEADER_INCLUDED
#define OPM_MESSAGELIMITER_HEADER_INCLUDED
#include <opm/common/OpmLog/LogUtil.hpp>
#include <cassert>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
namespace Opm
{
/// Handles limiting the number of messages with the same tag.
class MessageLimiter
{
public:
/// Used to indicate no message number limit.
enum { NoLimit = -1 };
/// Default constructor, no limit to the number of messages.
MessageLimiter()
: MessageLimiter(NoLimit)
{
}
/// Construct with given limit to number of messages with the
/// same tag.
///
/// Negative limits (including NoLimit) are interpreted as
/// NoLimit, but the default constructor is the preferred way
/// to obtain that behaviour.
explicit MessageLimiter(const int tag_limit)
: tag_limit_(tag_limit < 0 ? NoLimit : tag_limit),
category_limits_({{Log::MessageType::Note, NoLimit},
{Log::MessageType::Info, NoLimit},
{Log::MessageType::Warning, NoLimit},
{Log::MessageType::Error, NoLimit},
{Log::MessageType::Problem, NoLimit},
{Log::MessageType::Bug, NoLimit}})
{
}
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)
{
// Must ensure NoLimit for categories that are not
// explicitly specified in the input.
for (auto category : { Log::MessageType::Note,
Log::MessageType::Info,
Log::MessageType::Warning,
Log::MessageType::Error,
Log::MessageType::Problem,
Log::MessageType::Bug }) {
if (category_limits_.find(category) == category_limits_.end()) {
category_limits_[category] = NoLimit;
}
}
}
/// The tag message limit (same for all tags).
int tagMessageLimit() const
{
return tag_limit_;
}
/// The category message limits.
const std::map<int64_t, int>& categoryMessageLimits() const
{
return category_limits_;
}
/// The category message counts.
const std::map<int64_t, int>& categoryMessageCounts() const
{
return category_counts_;
}
/// Used for handleMessageLimits() return type (see that
/// function).
enum class Response
{
PrintMessage, JustOverTagLimit, JustOverCategoryLimit, OverTagLimit, OverCategoryLimit
};
/// If (tag count == tag limit + 1) for the passed tag, respond JustOverTagLimit.
/// If (tag count > tag limit + 1), respond OverTagLimit.
/// If a tag is empty, there is no tag message limit or for that tag
/// (tag count <= tag limit), consider the category limits:
/// If (category count == category limit + 1) for the passed messageMask, respond JustOverCategoryLimit.
/// If (category count > category limit + 1), respond OverCategoryLimit.
/// If (category count <= category limit), or there is no limit for that category, respond PrintMessage.
Response handleMessageLimits(const std::string& tag, const int64_t messageMask)
{
Response res = Response::PrintMessage;
// Deal with tag limits.
if (!tag.empty() && tag_limit_ != NoLimit) {
// See if tag already encountered.
auto it = tag_counts_.find(tag);
if (it != tag_counts_.end()) {
// Already encountered this tag. Increment its count.
const int count = ++it->second;
res = countBasedResponseTag(count);
} else {
// First encounter of this tag. Insert 1.
tag_counts_.insert({tag, 1});
res = countBasedResponseTag(1);
}
}
// If tag count reached the limit, the message is not counted
// towards the category limits.
if (res == Response::PrintMessage) {
// We are *not* above the tag limit, consider category limit.
const int count = ++category_counts_[messageMask];
if (category_limits_[messageMask] != NoLimit) {
res = countBasedResponseCategory(count, messageMask);
}
}
return res;
}
private:
Response countBasedResponseTag(const int count) const
{
if (count <= tag_limit_) {
return Response::PrintMessage;
} else if (count == tag_limit_ + 1) {
return Response::JustOverTagLimit;
} else {
return Response::OverTagLimit;
}
}
Response countBasedResponseCategory(const int count, const int64_t messageMask) const
{
const int limit = category_limits_.at(messageMask);
if (count <= limit) {
return Response::PrintMessage;
} else if (count == limit + 1) {
return Response::JustOverCategoryLimit;
} else {
return Response::OverCategoryLimit;
}
}
int tag_limit_;
std::unordered_map<std::string, int> tag_counts_;
std::map<int64_t, int> category_limits_;
std::map<int64_t, int> category_counts_ = {{Log::MessageType::Note, 0},
{Log::MessageType::Info, 0},
{Log::MessageType::Warning, 0},
{Log::MessageType::Error, 0},
{Log::MessageType::Problem, 0},
{Log::MessageType::Bug, 0}};
};
} // namespace Opm
#endif // OPM_MESSAGELIMITER_HEADER_INCLUDED

View File

@@ -0,0 +1,209 @@
/*
Copyright 2014 Statoil ASA.
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/>.
*/
#include <opm/common/OpmLog/OpmLog.hpp>
#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)
m_logger.reset( new Logger() );
return m_logger;
}
void OpmLog::addMessage(int64_t messageFlag , const std::string& message) {
if (m_logger)
m_logger->addMessage( messageFlag , message );
}
void OpmLog::addTaggedMessage(int64_t messageFlag, const std::string& tag, const std::string& message) {
if (m_logger)
m_logger->addTaggedMessage( messageFlag, tag, message );
}
void OpmLog::info(const std::string& message)
{
addMessage(Log::MessageType::Info, message);
}
void OpmLog::warning(const std::string& message)
{
addMessage(Log::MessageType::Warning, message);
}
void OpmLog::problem(const std::string& message)
{
addMessage(Log::MessageType::Problem, message);
}
void OpmLog::error(const std::string& message)
{
addMessage(Log::MessageType::Error, message);
}
void OpmLog::bug(const std::string& message)
{
addMessage(Log::MessageType::Bug, message);
}
void OpmLog::debug(const std::string& message)
{
addMessage(Log::MessageType::Debug, message);
}
void OpmLog::note(const std::string& message)
{
addMessage(Log::MessageType::Note, message);
}
void OpmLog::info(const std::string& tag, const std::string& message)
{
addTaggedMessage(Log::MessageType::Info, tag, message);
}
void OpmLog::warning(const std::string& tag, const std::string& message)
{
addTaggedMessage(Log::MessageType::Warning, tag, message);
}
void OpmLog::problem(const std::string& tag, const std::string& message)
{
addTaggedMessage(Log::MessageType::Problem, tag, message);
}
void OpmLog::error(const std::string& tag, const std::string& message)
{
addTaggedMessage(Log::MessageType::Error, tag, message);
}
void OpmLog::bug(const std::string& tag, const std::string& message)
{
addTaggedMessage(Log::MessageType::Bug, tag, message);
}
void OpmLog::debug(const std::string& tag, const std::string& message)
{
addTaggedMessage(Log::MessageType::Debug, tag, message);
}
void OpmLog::note(const std::string& tag, const std::string& message)
{
addTaggedMessage(Log::MessageType::Note, tag, message);
}
bool OpmLog::enabledMessageType( int64_t messageType ) {
if (m_logger)
return m_logger->enabledMessageType( messageType );
else
return Logger::enabledDefaultMessageType( messageType );
}
bool OpmLog::hasBackend(const std::string& name) {
if (m_logger)
return m_logger->hasBackend( name );
else
return false;
}
bool OpmLog::removeBackend(const std::string& name) {
if (m_logger)
return m_logger->removeBackend( name );
else
return false;
}
void OpmLog::removeAllBackends() {
if (m_logger) {
m_logger->removeAllBackends();
}
}
void OpmLog::addMessageType( int64_t messageType , const std::string& prefix) {
auto logger = OpmLog::getLogger();
logger->addMessageType( messageType , prefix );
}
void OpmLog::addBackend(const std::string& name , std::shared_ptr<LogBackend> backend) {
auto logger = OpmLog::getLogger();
return logger->addBackend( name , backend );
}
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>(message_limit));
streamLog->setMessageFormatter(std::make_shared<SimpleMessageFormatter>(use_prefix, use_color_coding && stdoutIsTerminal()));
}
/******************************************************************/
std::shared_ptr<Logger> OpmLog::m_logger;
}

View File

@@ -0,0 +1,102 @@
/*
Copyright 2014 Statoil ASA.
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/>.
*/
#ifndef OPMLOG_HPP
#define OPMLOG_HPP
#include <memory>
#include <cstdint>
#include <opm/common/OpmLog/Logger.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
namespace Opm {
class LogBackend;
/*
The OpmLog class is a fully static class which manages a proper
Logger instance.
*/
class OpmLog {
public:
static void addMessage(int64_t messageFlag , const std::string& message);
static void addTaggedMessage(int64_t messageFlag, const std::string& tag, const std::string& message);
static void info(const std::string& message);
static void warning(const std::string& message);
static void error(const std::string& message);
static void problem(const std::string& message);
static void bug(const std::string& message);
static void debug(const std::string& message);
static void note(const std::string& message);
static void info(const std::string& tag, const std::string& message);
static void warning(const std::string& tag, const std::string& message);
static void error(const std::string& tag, const std::string& message);
static void problem(const std::string& tag, const std::string& message);
static void bug(const std::string& tag, const std::string& message);
static void debug(const std::string& tag, const std::string& message);
static void note(const std::string& tag, const std::string& message);
static bool hasBackend( const std::string& backendName );
static void addBackend(const std::string& name , std::shared_ptr<LogBackend> backend);
static bool removeBackend(const std::string& name);
static void removeAllBackends();
static bool enabledMessageType( int64_t messageType );
static void addMessageType( int64_t messageType , const std::string& 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 = getLogger();
return logger->getBackend<BackendType>(name);
}
template <class BackendType>
static std::shared_ptr<BackendType> popBackend(const std::string& name) {
auto logger = getLogger();
return logger->popBackend<BackendType>(name);
}
private:
static std::shared_ptr<Logger> getLogger();
static std::shared_ptr<Logger> m_logger;
};
}
#endif

View File

@@ -0,0 +1,64 @@
/*
Copyright 2015 Statoil ASA.
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/>.
*/
#include <stdexcept>
#include <opm/common/OpmLog/StreamLog.hpp>
namespace Opm {
StreamLog::StreamLog(const std::string& logFile , int64_t messageMask, bool append) : LogBackend(messageMask)
{
if (append) {
m_ofstream.open( logFile.c_str() , std::ofstream::app );
} else {
m_ofstream.open( logFile.c_str() , std::ofstream::out );
}
m_streamOwner = true;
m_ostream = &m_ofstream;
}
StreamLog::StreamLog(std::ostream& os , int64_t messageMask) : LogBackend(messageMask)
{
m_ostream = &os;
m_streamOwner = false;
}
void StreamLog::close() {
if (m_streamOwner && m_ofstream.is_open()) {
m_ofstream.close();
m_ostream = NULL;
}
}
void StreamLog::addMessageUnconditionally(int64_t messageType, const std::string& message)
{
(*m_ostream) << formatMessage(messageType, message) << std::endl;
if (m_ofstream.is_open()) {
m_ofstream.flush();
}
}
StreamLog::~StreamLog() {
close();
}
} // namespace Opm

View File

@@ -0,0 +1,50 @@
/*
Copyright 2015 Statoil ASA.
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/>.
*/
#ifndef STREAMLOG_H
#define STREAMLOG_H
#include <fstream>
#include <iostream>
#include <cstdint>
#include <opm/common/OpmLog/LogBackend.hpp>
namespace Opm {
class StreamLog : public LogBackend {
public:
StreamLog(const std::string& logFile , int64_t messageMask, bool append = false);
StreamLog(std::ostream& os , int64_t messageMask);
~StreamLog();
protected:
virtual void addMessageUnconditionally(int64_t messageType, const std::string& message) override;
private:
void close();
std::ofstream m_ofstream;
std::ostream * m_ostream;
bool m_streamOwner;
};
}
#endif

View File

@@ -0,0 +1,62 @@
/*
Copyright 2014 Statoil ASA.
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/>.
*/
#include <stdexcept>
#include <cassert>
#include <iomanip>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
#include <opm/common/OpmLog/TimerLog.hpp>
#include <opm/common/OpmLog/StreamLog.hpp>
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;
}
void TimerLog::addMessageUnconditionally(int64_t messageType, const std::string& msg ) {
if (messageType == StopTimer) {
clock_t stop = clock();
double secondsElapsed = 1.0 * (m_start - stop) / CLOCKS_PER_SEC ;
m_work.str("");
m_work << std::fixed << msg << ": " << secondsElapsed << " seconds ";
StreamLog::addMessageUnconditionally( messageType, m_work.str());
} else {
if (messageType == StartTimer)
m_start = clock();
}
}
} // namespace Opm

View File

@@ -0,0 +1,61 @@
/*
Copyright 2014 Statoil ASA.
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/>.
*/
#ifndef OPM_TIMERLOG_HPP
#define OPM_TIMERLOG_HPP
#include <time.h>
#include <memory>
#include <sstream>
#include <string>
#include <opm/common/OpmLog/StreamLog.hpp>
/*
This class is a simple demonstration of how the logging framework
can be used to create a simple very special case logging facility.
*/
namespace Opm {
class TimerLog : public StreamLog {
public:
static const int64_t StartTimer = 4096;
static const int64_t StopTimer = 8192;
explicit TimerLog(const std::string& logFile);
explicit TimerLog(std::ostream& os);
void clear();
~TimerLog() {};
protected:
void addMessageUnconditionally(int64_t messageFlag,
const std::string& message) override;
private:
clock_t m_start;
std::ostringstream m_work;
};
typedef std::shared_ptr<TimerLog> TimerLogPtr;
typedef std::shared_ptr<const TimerLog> TimerLogConstPtr;
} // namespace Opm
#endif

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

Some files were not shown because too many files have changed in this diff Show More