From e3ff47dd9fa24b7483e40cbb17f9d2d81a0eb2a5 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 21 Aug 2017 16:49:47 +0200 Subject: [PATCH] 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 --- cmake/Modules/FindSuperLU.cmake | 28 ++++++++++++++++++++++++++++ cmake/Modules/OpmLibMain.cmake | 3 +++ 2 files changed, 31 insertions(+) diff --git a/cmake/Modules/FindSuperLU.cmake b/cmake/Modules/FindSuperLU.cmake index 94072ea9bf5..1cd3163708c 100644 --- a/cmake/Modules/FindSuperLU.cmake +++ b/cmake/Modules/FindSuperLU.cmake @@ -15,6 +15,10 @@ # SUPERLU_LIBRARIES Name to the SuperLU library. # +if(NOT USE_SUPERLU) + return() +endif() + include(CheckIncludeFiles) include(CMakePushCheckState) include(CheckCSourceCompiles) @@ -118,6 +122,19 @@ int main(void) return 0; }" SUPERLU_POST_2005_VERSION) + +# check whether version is at least 5.0 +CHECK_C_SOURCE_COMPILES(" +typedef int int_t; +#include +#include +int main(void) +{ + GlobalLU_t glu; + return 0; +}" +SUPERLU_MIN_VERSION_5) + cmake_pop_check_state() if(SUPERLU_MIN_VERSION_4_3) @@ -128,6 +145,17 @@ else() "Human readable string containing SuperLU version information.") endif() +if(SUPERLU_MIN_VERSION_5) + include(UseDuneVer) + find_dune_version("dune" "istl") + set(DUNE_ISTL_VERSION ${DUNE_ISTL_VERSION_MAJOR}.${DUNE_ISTL_VERSION_MINOR}.${DUNE_ISTL_VERSION_REVISION}) + if(DUNE_ISTL_VERSION VERSION_LESS 2.5) + message(STATUS "SuperLU requested, but version found not compatible with dune-istl ${DUNE_ISTL_VERSION}") + set(SUPERLU_LIBRARY "") + set(SUPERLU_INCLUDE_DIR "") + endif() +endif() + # behave like a CMake module is supposed to behave include(FindPackageHandleStandardArgs) find_package_handle_standard_args( diff --git a/cmake/Modules/OpmLibMain.cmake b/cmake/Modules/OpmLibMain.cmake index 6f02085bef3..b478dfed827 100644 --- a/cmake/Modules/OpmLibMain.cmake +++ b/cmake/Modules/OpmLibMain.cmake @@ -102,6 +102,9 @@ find_openmp (${project}) include (UseThreads) find_threads (${project}) +# SuperLU is optional +option (USE_SUPERLU "Use SuperLU direct solvers" OFF) + # static code analysis include(UseStaticAnalysis) setup_static_analysis_tools()