2008-10-20 18:43:11 +08:00
|
|
|
|
2011-02-18 18:23:27 +08:00
|
|
|
# Umfpack lib usually requires linking to a blas library.
|
|
|
|
# It is up to the user of this module to find a BLAS and link to it.
|
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
if (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
|
|
|
|
set(SUPERLU_FIND_QUIETLY TRUE)
|
2019-11-01 00:36:27 +08:00
|
|
|
endif ()
|
2008-10-20 18:43:11 +08:00
|
|
|
|
2011-02-18 18:23:27 +08:00
|
|
|
find_path(SUPERLU_INCLUDES
|
|
|
|
NAMES
|
|
|
|
supermatrix.h
|
|
|
|
PATHS
|
|
|
|
$ENV{SUPERLUDIR}
|
|
|
|
${INCLUDE_INSTALL_DIR}
|
|
|
|
PATH_SUFFIXES
|
|
|
|
superlu
|
2013-01-26 01:17:17 +08:00
|
|
|
SRC
|
2011-02-18 18:23:27 +08:00
|
|
|
)
|
2008-10-20 18:43:11 +08:00
|
|
|
|
2016-07-10 08:29:57 +08:00
|
|
|
find_library(SUPERLU_LIBRARIES
|
|
|
|
NAMES "superlu_5.2.1" "superlu_5.2" "superlu_5.1.1" "superlu_5.1" "superlu_5.0" "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"
|
|
|
|
PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR}
|
|
|
|
PATH_SUFFIXES lib)
|
2015-11-30 21:48:11 +08:00
|
|
|
|
|
|
|
if(SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
|
|
|
|
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
include(CMakePushCheckState)
|
|
|
|
cmake_push_check_state()
|
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SUPERLU_INCLUDES})
|
|
|
|
|
|
|
|
# check whether struct mem_usage_t is globally defined
|
|
|
|
check_cxx_source_compiles("
|
|
|
|
typedef int int_t;
|
|
|
|
#include <supermatrix.h>
|
|
|
|
#include <slu_util.h>
|
|
|
|
int main() {
|
|
|
|
mem_usage_t mem;
|
|
|
|
return 0;
|
|
|
|
}"
|
|
|
|
SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
|
|
|
|
|
|
|
|
|
|
|
|
check_cxx_source_compiles("
|
|
|
|
typedef int int_t;
|
|
|
|
#include <supermatrix.h>
|
|
|
|
#include <superlu_enum_consts.h>
|
|
|
|
int main() {
|
|
|
|
return SLU_SINGLE;
|
|
|
|
}"
|
|
|
|
SUPERLU_HAS_CLEAN_ENUMS)
|
|
|
|
|
2016-07-10 08:29:57 +08:00
|
|
|
check_cxx_source_compiles("
|
|
|
|
typedef int int_t;
|
|
|
|
#include <supermatrix.h>
|
|
|
|
#include <slu_util.h>
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
GlobalLU_t glu;
|
|
|
|
return 0;
|
|
|
|
}"
|
|
|
|
SUPERLU_HAS_GLOBALLU_T)
|
|
|
|
|
|
|
|
if(SUPERLU_HAS_GLOBALLU_T)
|
|
|
|
# at least 5.0
|
|
|
|
set(SUPERLU_VERSION_VAR "5.0")
|
|
|
|
elseif(SUPERLU_HAS_CLEAN_ENUMS)
|
2015-11-30 21:48:11 +08:00
|
|
|
# at least 4.3
|
|
|
|
set(SUPERLU_VERSION_VAR "4.3")
|
|
|
|
elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
|
2016-07-10 08:29:57 +08:00
|
|
|
# at least 4.0
|
2015-11-30 21:48:11 +08:00
|
|
|
set(SUPERLU_VERSION_VAR "4.0")
|
|
|
|
else()
|
|
|
|
set(SUPERLU_VERSION_VAR "3.0")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
cmake_pop_check_state()
|
|
|
|
|
2015-12-16 18:37:16 +08:00
|
|
|
if(SuperLU_FIND_VERSION)
|
|
|
|
if(${SUPERLU_VERSION_VAR} VERSION_LESS ${SuperLU_FIND_VERSION})
|
|
|
|
set(SUPERLU_VERSION_OK FALSE)
|
|
|
|
else()
|
|
|
|
set(SUPERLU_VERSION_OK TRUE)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(SUPERLU_VERSION_OK TRUE)
|
|
|
|
endif()
|
|
|
|
|
2015-11-30 21:48:11 +08:00
|
|
|
endif()
|
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2021-02-24 12:16:52 +08:00
|
|
|
find_package_handle_standard_args(SuperLU
|
2015-12-16 18:37:16 +08:00
|
|
|
REQUIRED_VARS SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK
|
2015-11-30 21:48:11 +08:00
|
|
|
VERSION_VAR SUPERLU_VERSION_VAR)
|
2008-10-20 18:43:11 +08:00
|
|
|
|
|
|
|
mark_as_advanced(SUPERLU_INCLUDES SUPERLU_LIBRARIES)
|