Updated to opm-core/master
This commit is contained in:
parent
c47f8a42df
commit
65d49ef35a
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Sets the follwing variable:
|
||||
#
|
||||
# HAVE_FINAL True if the compiler supports the "final" quantifier
|
||||
# HAVE_TYPE_TRAITS True if the <type_traits> header is available and implements sufficient functionality
|
||||
# HAVE_SHARED_PTR True if std::shared_ptr is available
|
||||
# HAVE_UNIQUE_PTR True if std::unique_ptr is available
|
||||
@ -70,6 +71,22 @@ endif (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
|
||||
# perform tests
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# the "final" method specifier
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
struct Base {
|
||||
virtual void foo() = 0;
|
||||
};
|
||||
struct Derived : public Base {
|
||||
virtual void foo() final {};
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
" HAVE_FINAL
|
||||
)
|
||||
|
||||
# std::is_convertible, std::is_base_of
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <type_traits>
|
||||
|
148
cmake/Modules/FindPETSc.cmake
Normal file
148
cmake/Modules/FindPETSc.cmake
Normal file
@ -0,0 +1,148 @@
|
||||
# - Try to find Petsc lib
|
||||
#
|
||||
# This module supports requiring a minimum version, e.g. you can do
|
||||
# find_package(Petsc)
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# PETSC_FOUND - system has Petsc lib with correct version
|
||||
# PETSC_INCLUDE_DIRS - the Petsc include directory
|
||||
# PETSC_LIBRARIES - the Petsc library.
|
||||
|
||||
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
|
||||
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
|
||||
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
|
||||
|
||||
# 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 (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# if PETSC_ROOT is set, then this is the only place searched for petsc headers
|
||||
# and includes
|
||||
set(_no_default_path "")
|
||||
if(PETSC_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
endif()
|
||||
|
||||
# look for a system-wide BLAS library
|
||||
set(PETSC_BLAS_LIBRARY "")
|
||||
find_package(BLAS QUIET)
|
||||
list(APPEND PETSC_BLAS_LIBRARY "${BLAS_LIBRARIES}")
|
||||
|
||||
# if BLAS wasn't found, look for it in PETSC_ROOT. Won't search if
|
||||
# PETSC_BLAS_LIBRARY is set.
|
||||
find_library(PETSC_BLAS_LIBRARY
|
||||
NAME "blas"
|
||||
PATH ${PETSC_ROOT}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
# print message if there was still no blas found!
|
||||
if(NOT BLAS_FOUND AND NOT PETSC_BLAS_LIBRARY)
|
||||
message(STATUS "BLAS not found but required for PETSc")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(PETSC_LAPACK_LIBRARY "")
|
||||
find_package(LAPACK QUIET)
|
||||
list(APPEND PETSC_LAPACK_LIBRARY "${LAPACK_LIBRARIES}")
|
||||
|
||||
# if LAPACK wasn't found, look for it in PETSC_ROOT
|
||||
find_library(PETSC_LAPACK_LIBRARY
|
||||
NAME "lapack"
|
||||
PATH ${PETSC_ROOT}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
# print message if there was still no blas found!
|
||||
if(NOT LAPACK_FOUND AND NOT PETSC_LAPACK_LIBRARY)
|
||||
message(STATUS "LAPACK not found but required for PETSc")
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(X11 QUIET)
|
||||
if (X11_FOUND)
|
||||
list(APPEND PETSC_X11_LIBRARY "${X11_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
# these variables must exist. Since not finding MPI, both the header and the
|
||||
# object file , may not be an error, we want the option of concatenating the
|
||||
# empty variable onto the PETSC_LIBRARIES/INCLUDE_DIRS lists
|
||||
set(PETSC_MPI_LIBRARY "")
|
||||
set(PETSC_MPI_INCLUDE_DIRS "")
|
||||
|
||||
find_package(MPI)
|
||||
if(MPI_FOUND)
|
||||
list(APPEND PETSC_MPI_LIBRARY "${MPI_LIBRARIES}")
|
||||
set(PETSC_MPI_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
|
||||
|
||||
else(MPI_FOUND)
|
||||
# if a system MPI wasn't found, look for PETSc's serial implementation. This
|
||||
# won't be available if PETSc was compiled with --with-mpi=0, so not finding
|
||||
# this won't be an error. This only needs to find the header, as the MPI
|
||||
# implementation should be already be compiled into PETSc.
|
||||
message(STATUS "Could not find a system provided MPI. Searching for PETSc provided mpiuni fallback implementation.")
|
||||
find_path(PETSC_MPI_INCLUDE_DIRS
|
||||
NAMES "mpi.h"
|
||||
PATHS ${PETSC_ROOT}/include
|
||||
PATH_SUFFIXES "mpiuni"
|
||||
${_no_default_path}
|
||||
)
|
||||
endif(MPI_FOUND)
|
||||
|
||||
if(NOT PETSC_MPI_INCLUDE_DIRS)
|
||||
message(WARNING "Could not find any MPI implementation. If PETSc is compiled with --with-mpi=0 this is ok. Otherwise you will get linker errors or (possibly subtle) runtime errors. Continuing.")
|
||||
if(NOT USE_MPI)
|
||||
message("To build with MPI support, pass -DUSE_MPI=ON to CMake.")
|
||||
endif(NOT USE_MPI)
|
||||
endif(NOT PETSC_MPI_INCLUDE_DIRS)
|
||||
|
||||
# only probe if we haven't a path in our cache
|
||||
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}
|
||||
)
|
||||
|
||||
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}
|
||||
)
|
||||
|
||||
if(NOT PETSC_LIBRARY)
|
||||
message(STATUS "Could not find the PETSc library")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Petsc DEFAULT_MSG PETSC_INCLUDE_DIR PETSC_LIBRARY)
|
||||
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})
|
||||
list(APPEND PETSC_INCLUDE_DIRS ${PETSC_MPI_INCLUDE_DIRS})
|
||||
|
||||
set(PETSC_LIBRARIES ${PETSC_LIBRARY})
|
||||
|
||||
list(APPEND PETSC_LIBRARIES ${PETSC_BLAS_LIBRARY})
|
||||
list(APPEND PETSC_LIBRARIES ${PETSC_LAPACK_LIBRARY})
|
||||
list(APPEND PETSC_LIBRARIES ${PETSC_X11_LIBRARY})
|
||||
list(APPEND PETSC_LIBRARIES ${PETSC_MPI_LIBRARY})
|
||||
endif()
|
@ -35,10 +35,8 @@ find_opm_package (
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/alugrid/grid.hh>
|
||||
"#include <dune/alugrid/2d/indexsets.hh>
|
||||
int main (void) {
|
||||
Dune::ALUGrid</*dim=*/2, /*dimWorld=*/2, Dune::simplex, Dune::nonconforming> grid;
|
||||
grid.leafGridView().size(/*codim=*/0);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
|
@ -1,5 +1,7 @@
|
||||
# - Compile main library target
|
||||
|
||||
option (STRIP_DEBUGGING_SYMBOLS "use separate files for the executable code and the debugging symbols" OFF)
|
||||
|
||||
macro (opm_compile opm)
|
||||
# some CMake properties do not do list expansion
|
||||
string (REPLACE ";" " " ${opm}_LINKER_FLAGS_STR "${${opm}_LINKER_FLAGS}")
|
||||
@ -28,8 +30,10 @@ macro (opm_compile opm)
|
||||
)
|
||||
target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES})
|
||||
|
||||
# queue this executable to be stripped
|
||||
strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG)
|
||||
if (STRIP_DEBUGGING_SYMBOLS)
|
||||
# queue this executable to be stripped
|
||||
strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG)
|
||||
endif()
|
||||
else (${opm}_SOURCES)
|
||||
# unset this variable to signal that no library is generated
|
||||
set (${opm}_TARGET)
|
||||
|
@ -70,8 +70,10 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||
set (_test_lib "")
|
||||
endif (NOT "${test_regexp}" STREQUAL "")
|
||||
target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib})
|
||||
strip_debug_symbols (${_sat_NAME} _sat_DEBUG)
|
||||
list (APPEND ${satellite}_DEBUG ${_sat_DEBUG})
|
||||
if (STRIP_DEBUGGING_SYMBOLS)
|
||||
strip_debug_symbols (${_sat_NAME} _sat_DEBUG)
|
||||
list (APPEND ${satellite}_DEBUG ${_sat_DEBUG})
|
||||
endif()
|
||||
|
||||
# variable with regular expression doubles as a flag for
|
||||
# whether tests should be setup or not
|
||||
|
@ -18,12 +18,10 @@ if (CXX_COMPAT_GCC)
|
||||
# default debug level, if not specified by the user
|
||||
set_default_option (CXX _dbg_flag "-ggdb3" "(^|\ )-g")
|
||||
|
||||
# add debug symbols to *all* targets, regardless. there WILL come a
|
||||
# time when you need to find a bug which only manifests itself in a
|
||||
# release target on a production system!
|
||||
# add debug symbols to *all* targets if the build mode is either "Debug" or "RelWithDebInfo"
|
||||
if (_dbg_flag)
|
||||
message (STATUS "Generating debug symbols: ${_dbg_flag}")
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "${_dbg_flag}")
|
||||
add_options (ALL_LANGUAGES "Debug;RelWithDebInfo" "${_dbg_flag}")
|
||||
endif (_dbg_flag)
|
||||
|
||||
# extracting the debug info is done by a separate utility in the GNU
|
||||
|
@ -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 "-O3" "(^|\ )-O")
|
||||
set_default_option (CXX _opt_rel "-O2" "(^|\ )-O")
|
||||
|
||||
# use these options for debug builds - no optimizations
|
||||
add_options (ALL_LANGUAGES "${_prof_DEBUG}" ${_opt_dbg} "-DDEBUG")
|
||||
|
@ -21,5 +21,5 @@ set (opm-autodiff_DEPS
|
||||
dune-cornerpoint;
|
||||
opm-core REQUIRED"
|
||||
# Eigen
|
||||
"Eigen3 3.1.2 "
|
||||
"Eigen3 3.2.0"
|
||||
)
|
||||
|
@ -26,13 +26,14 @@ set (opm-core_DEPS
|
||||
"SuiteSparse COMPONENTS umfpack"
|
||||
# solver
|
||||
"SuperLU"
|
||||
"Petsc"
|
||||
# xml processing (for config parsing)
|
||||
"TinyXML"
|
||||
# Ensembles-based Reservoir Tools (ERT)
|
||||
"ERT REQUIRED"
|
||||
# Look for MPI support
|
||||
"MPI"
|
||||
# PETSc numerical backend
|
||||
"PETSc"
|
||||
# DUNE dependency
|
||||
"dune-common"
|
||||
"dune-istl"
|
||||
|
@ -5,6 +5,7 @@
|
||||
set (opm-material_CONFIG_VAR
|
||||
HAVE_MPI
|
||||
HAVE_VALGRIND
|
||||
HAVE_FINAL
|
||||
)
|
||||
|
||||
# dependencies
|
||||
|
@ -17,8 +17,5 @@ set (opm-polymer_DEPS
|
||||
# Ensembles-based Reservoir Tools
|
||||
"ERT"
|
||||
# OPM dependency
|
||||
"opm-autodiff REQUIRED"
|
||||
"opm-core REQUIRED"
|
||||
# Eigen
|
||||
"Eigen3 3.1 REQUIRED"
|
||||
"opm-core"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user