Merge remote-tracking branch 'upstream/release/2013.03' into combined

This commit is contained in:
Atgeirr Flø Rasmussen 2013-03-18 08:28:36 +01:00
commit 5fba4ca2b3
10 changed files with 118 additions and 78 deletions

View File

@ -36,7 +36,7 @@ set (${project}_DEPS
# Tim Davis' SuiteSparse archive
"SuiteSparse COMPONENTS umfpack"
# solver
"SUPERLU"
"SuperLU"
# xml processing (for config parsing)
"TinyXML"
# Ensembles-based Reservoir Tools (ERT)
@ -97,8 +97,13 @@ include (UseOptimization)
# dependencies, in case they alter the list of warnings
include (UseWarnings)
# parallel computing must be explicitly enabled
option (USE_MPI "Use Message Passing Interface for parallel computing" OFF)
if (NOT USE_MPI)
set (CMAKE_DISABLE_FIND_PACKAGE_MPI TRUE)
endif (NOT USE_MPI)
### --- begin opm-core specific --- ###
# parallel programming
include (UseOpenMP)
find_openmp (${project})
### --- end opm-core specific --- ###

View File

@ -22,23 +22,17 @@ endmacro (remove_duplicate_libraries module)
# headers can be trimmed from the end, since adding a directory to
# the list is an idempotent action
macro (remove_duplicate_headers module)
if (DEFINED ${module}_INCLUDE_DIRS)
list (REMOVE_DUPLICATES ${module}_INCLUDE_DIRS)
endif (DEFINED ${module}_INCLUDE_DIRS)
endmacro (remove_duplicate_headers module)
# linker flags may not be specified at all
macro (remove_duplicate_flags module)
if (DEFINED ${module}_LINKER_FLAGS)
list (REMOVE_DUPLICATES ${module}_LINKER_FLAGS)
endif (DEFINED ${module}_LINKER_FLAGS)
endmacro (remove_duplicate_flags module)
macro (remove_duplicate_var module suffix)
if (DEFINED ${module}_${suffix})
list (REMOVE_DUPLICATES ${module}_${suffix})
endif (DEFINED ${module}_${suffix})
endmacro (remove_duplicate_var module suffix)
# fix up both headers and libraries, in case two dependencies have
# included the same second-level library independently
macro (remove_dup_deps module)
remove_duplicate_headers (${module})
remove_duplicate_var (${module} INCLUDE_DIRS)
remove_duplicate_var (${module} LINKER_FLAGS)
remove_duplicate_var (${module} CONFIG_VARS)
remove_duplicate_libraries (${module})
remove_duplicate_flags (${module})
endmacro (remove_dup_deps module)

View File

@ -18,7 +18,8 @@ find_opm_package (
# dependencies
"CXX11Features REQUIRED;
BLAS REQUIRED;
LAPACK REQUIRED
LAPACK REQUIRED;
MPI
"
# header to search for
"dune/common/fvector.hh"

View File

@ -24,7 +24,7 @@ find_opm_package (
# required dependencies
"dune-common ${_require_dune_common};
SUPERLU
SuperLU
"
# header to search for
"dune/istl/bcrsmatrix.hh"

View File

@ -24,7 +24,7 @@ find_opm_package (
BLAS REQUIRED;
LAPACK REQUIRED;
SuiteSparse COMPONENTS umfpack;
SUPERLU;
SuperLU;
TinyXML;
ERT;
dune-istl

View File

@ -51,6 +51,14 @@ foreach (name IN LISTS _opm_proj_vars)
endif (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name})
endforeach (name)
# these dependencies must always be handled by the find module
set (_opm_proj_exemptions
dune-common
dune-istl
dune-grid
dune-geometry
)
# insert this boilerplate whenever we are going to find a new package
macro (find_and_append_package_to prefix name)
# if we have specified a directory, don't revert to searching the
@ -71,6 +79,28 @@ macro (find_and_append_package_to prefix name)
set (${name}_DIR "${${NAME}_ROOT}")
endif (EXISTS ${${NAME}_ROOT}/${name}-config.cmake OR EXISTS ${${NAME}_ROOT}/${name}Config.cmake)
endif (NOT DEFINED ${name}_DIR AND (DEFINED ${name}_ROOT OR DEFINED ${NAME}_ROOT))
# these libraries need special handling which is not provided in
# the -config.cmake file, but which must be provided by this project,
# something which is done in our find module
list (FIND _opm_proj_exemptions "${name}" _${name}_exempted)
if ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR))
# most often we are given the name to the build directory and this
# is a sub-directory of the source tree
if (${name}_DIR MATCHES "build")
get_filename_component (${name}_ROOT "${${name}_DIR}" PATH)
else (${name}_DIR MATCHES "build")
set (${name}_ROOT "${${name}_DIR}")
endif (${name}_DIR MATCHES "build")
# store this for later, in case we reconfigure
set (${name}_ROOT "${${name}_ROOT}" CACHE LOCATION "Path to ${name}")
# clear this to not use config mode
unset (${name}_DIR)
# variables that are given on the command-line is also put in the cache
# removing the local copy only "unshadows" this one
unset (${name}_DIR CACHE)
endif ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR))
# 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
@ -81,23 +111,40 @@ macro (find_and_append_package_to prefix name)
message (STATUS "Finding package ${name} using module mode")
find_package (${name} ${ARGN})
endif (${name}_DIR)
if (${name}_FOUND)
# the variable "NAME" may be replaced during find_package (as this is
# now a macro, and not a function anymore), so we must reinitialize
string (TOUPPER "${name}" NAME)
string (REPLACE "-" "_" NAME "${NAME}")
if (${name}_FOUND OR ${NAME}_FOUND)
foreach (var IN LISTS _opm_proj_vars)
if (DEFINED ${name}_${var})
list (APPEND ${prefix}_${var} ${${name}_${var}})
# cleanup lists
if ("${var}" STREQUAL "LIBRARIES")
remove_duplicate_libraries (${prefix})
else ("${var}" STREQUAL "LIBRARIES")
list (REMOVE_DUPLICATES ${prefix}_${var})
endif ("${var}" STREQUAL "LIBRARIES")
# some packages define an uppercase version of their own name
elseif (DEFINED ${NAME}_${var})
list (APPEND ${prefix}_${var} ${${NAME}_${var}})
endif (DEFINED ${name}_${var})
# some packages define _PATH instead of _DIRS (Hi, MPI!)
if ("${var}" STREQUAL "INCLUDE_DIRS")
if (DEFINED ${name}_INCLUDE_PATH)
list (APPEND ${prefix}_INCLUDE_DIRS ${${name}_INCLUDE_PATH})
elseif (DEFINED ${NAME}_INCLUDE_PATH)
list (APPEND ${prefix}_INCLUDE_DIRS ${${NAME}_INCLUDE_PATH})
endif (DEFINED ${name}_INCLUDE_PATH)
endif ("${var}" STREQUAL "INCLUDE_DIRS")
# cleanup lists
if ("${var}" STREQUAL "LIBRARIES")
remove_duplicate_libraries (${prefix})
else ("${var}" STREQUAL "LIBRARIES")
remove_duplicate_var (${prefix} ${var})
endif ("${var}" STREQUAL "LIBRARIES")
endforeach (var)
# some libraries only define xxx_FOUND and not a corresponding HAVE_xxx
if (NOT DEFINED HAVE_${NAME})
set (HAVE_${NAME} 1)
endif (NOT DEFINED HAVE_${NAME})
endif (${name}_FOUND)
endif (${name}_FOUND OR ${NAME}_FOUND)
endmacro (find_and_append_package_to prefix name)
# append to the list of variables associated with the project

View File

@ -37,7 +37,8 @@
# <http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries>
include (Duplicates)
include (OpmFind)
# append all items from src into dst; both must be *names* of lists
macro (append_found src dst)
foreach (_item IN LISTS ${src})
@ -47,7 +48,7 @@ macro (append_found src dst)
endforeach (_item)
endmacro (append_found src dst)
function (find_opm_package module deps header lib defs prog conf)
macro (find_opm_package module deps header lib defs prog conf)
# variables to pass on to other packages
if (FIND_QUIETLY)
set (${module}_QUIET "QUIET")
@ -60,16 +61,6 @@ function (find_opm_package module deps header lib defs prog conf)
return ()
endif (${${module}_FOUND})
# dependencies on other packages; underscore version only contains the
# name of the other package
set (_deps)
foreach (_dep IN LISTS deps)
separate_arguments (_args UNIX_COMMAND ${_dep})
find_package (${_args} QUIET)
list (GET _args 0 _name_only)
list (APPEND _deps ${_name_only})
endforeach (_dep)
# see if there is a pkg-config entry for this package, and use those
# settings as a starting point
find_package (PkgConfig)
@ -88,17 +79,22 @@ function (find_opm_package module deps header lib defs prog conf)
# 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
# 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}-build"
"../${_module_lower}"
)
set (_guess_bin_only
"../${module}-build"
"../${_module_lower}-build"
"../../${module}/build-cmake"
"../../${_module_lower}/build-cmake"
)
set (_guess_bin)
foreach (_item IN ITEMS ${_guess})
foreach (_item IN ITEMS ${_guess} ${_guess_bin_only})
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
endforeach (_item)
endif (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
@ -122,7 +118,7 @@ function (find_opm_package module deps header lib defs prog conf)
NAMES "${lib}"
PATHS ${_guess_bin}
HINTS ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_LIBRARY_DIRS}
PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib"
)
else (NOT "${lib}" STREQUAL "")
set (${module}_LIBRARY "")
@ -132,45 +128,31 @@ function (find_opm_package module deps header lib defs prog conf)
# list of necessities to build with the software
set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}")
set (${module}_LIBRARIES "${${module}_LIBRARY}")
foreach (_dep IN LISTS _deps)
# only add those packages we actually found (find_package will show
# an error if it was marked as REQUIRED)
if (${_dep}_FOUND)
list (APPEND ${module}_INCLUDE_DIRS ${${_dep}_INCLUDE_DIRS})
list (APPEND ${module}_LIBRARIES ${${_dep}_LIBRARIES})
list (APPEND ${module}_DEFINITIONS ${${_dep}_DEFINITIONS})
list (APPEND ${module}_CONFIG_VARS ${${_dep}_CONFIG_VARS})
list (APPEND ${module}_LINKER_FLAGS ${${_dep}_LINKER_FLAGS})
endif (${_dep}_FOUND)
set (_deps)
foreach (_dep IN ITEMS ${deps})
separate_arguments (_args UNIX_COMMAND ${_dep})
find_and_append_package_to (${module} ${_args} ${${module}_QUIET})
list (GET _args 0 _name_only)
list (APPEND _deps ${_name_only})
endforeach (_dep)
# compile with this option to avoid avalanche of warnings
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}")
foreach (_def IN LISTS defs)
foreach (_def IN ITEMS ${defs})
list (APPEND ${module}_DEFINITIONS "-D${_def}")
endforeach (_def)
# tidy the lists before returning them
list (REMOVE_DUPLICATES ${module}_INCLUDE_DIRS)
remove_duplicate_libraries (${module})
list (REMOVE_DUPLICATES ${module}_DEFINITIONS)
remove_dup_deps (${module})
# these defines are used in dune/${module} headers, and should be put
# in config.h when we include those
foreach (_var IN LISTS conf)
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})
endforeach (_var)
foreach (_dep in _deps)
if (DEFINED ${_dep}_CONFIG_VARS)
list (APPEND ${module}_CONFIG_VARS ${_dep}_CONFIG_VARS)
endif (DEFINED ${_dep}_CONFIG_VARS)
endforeach (_dep)
if (${module}_CONFIG_VARS)
list (REMOVE_DUPLICATES ${module}_CONFIG_VARS)
endif (${module}_CONFIG_VARS)
# these are the defines that should be set when compiling
# without config.h
@ -209,17 +191,13 @@ function (find_opm_package module deps header lib defs prog conf)
# some genius that coded the FindPackageHandleStandardArgs figured out
# that the module name should be in uppercase (?!)
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}" PARENT_SCOPE)
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}")
# return these variables to the caller
set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIRS}" PARENT_SCOPE)
set (${module}_LIBRARIES "${${module}_LIBRARIES}" PARENT_SCOPE)
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}" PARENT_SCOPE)
set (${module}_CONFIG_VARS "${${module}_CONFIG_VARS}" PARENT_SCOPE)
set (${module}_LINKER_FLAGS "${${module}_LINKER_FLAGS}" PARENT_SCOPE)
set (${module}_QUIET "${${module}_QUIET}" PARENT_SCOPE)
set (HAVE_${MODULE} "${HAVE_${MODULE}}" PARENT_SCOPE)
endfunction (find_opm_package module deps header lib defs prog conf)
# print everything out if we're asked to
if (${module}_DEBUG)
debug_find_vars (${module})
endif (${module}_DEBUG)
endmacro (find_opm_package module deps header lib defs prog conf)
# print all variables defined by the above macro
function (debug_find_vars module)

17
configure vendored
View File

@ -22,6 +22,7 @@ Optional Features:
--disable-silent-rules print every compilation statement as executed
--enable-system-debug put .debug files in global GDB debug dir
[default=yes if prefix=/usr, no otherwise]
--enable-parallel process in parallel using MPI [default=no]
--enable-openmp activate experimental support for OpenMP
--disable-option-checking ignore unrecognized --enable/--with options
@ -93,6 +94,7 @@ buildtype=Debug
pch_use=
#use_openmp=" -DUSE_OPENMP=OFF"
use_openmp=
use_mpi=
#silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=OFF"
silent_rules=
#debug_loc=" -DSYSTEM_DEBUG=OFF"
@ -226,6 +228,10 @@ for OPT in "$@"; do
use_openmp=" -DUSE_OPENMP=OFF"
pkgname=""
;;
parallel)
use_mpi=" -DUSE_MPI=OFF"
pkgname=""
;;
agmg |\
ert |\
superlu)
@ -260,6 +266,15 @@ for OPT in "$@"; do
# special flag; don't set shared/static
shared=""
;;
parallel)
use_openmp=" -DUSE_MPI=ON"
# special flag; don't set shared/static
shared=""
;;
pch)
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
shared=""
;;
# this flag is just for compatibility with the deprecation
# flag in DUNE, so we can build without warnings
fieldvector-size-is-method)
@ -308,7 +323,7 @@ for a in "${VARS[@]}"; do
done
# pass everything on to CMake
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp} ${FEATURES}"
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi} ${FEATURES}"
echo --- calling CMake ---
echo ${CMDLINE}
eval exec ${CMDLINE}

View File

@ -1090,7 +1090,7 @@ void EclipseGridParser::getNumericErtFields(const string& filename)
{
#ifdef HAVE_ERT
// Read file
ecl_file_type * ecl_file = ecl_file_open(filename.c_str());
ecl_file_type * ecl_file = ecl_file_open(filename.c_str() , 0);
if (ecl_file == NULL) {
THROW("Could not open IMPORTed file " << filename);
}