Lemma is an Electromagnetics API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Umfpack lib usually requires linking to a blas library.
  2. # It is up to the user of this module to find a BLAS and link to it.
  3. if (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
  4. set(SUPERLU_FIND_QUIETLY TRUE)
  5. endif (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
  6. find_path(SUPERLU_INCLUDES
  7. NAMES
  8. supermatrix.h
  9. PATHS
  10. $ENV{SUPERLUDIR}
  11. ${INCLUDE_INSTALL_DIR}
  12. PATH_SUFFIXES
  13. superlu
  14. SRC
  15. )
  16. find_library(SUPERLU_LIBRARIES
  17. 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"
  18. PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR}
  19. PATH_SUFFIXES lib)
  20. if(SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
  21. include(CheckCXXSourceCompiles)
  22. include(CMakePushCheckState)
  23. cmake_push_check_state()
  24. set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SUPERLU_INCLUDES})
  25. # check whether struct mem_usage_t is globally defined
  26. check_cxx_source_compiles("
  27. typedef int int_t;
  28. #include <supermatrix.h>
  29. #include <slu_util.h>
  30. int main() {
  31. mem_usage_t mem;
  32. return 0;
  33. }"
  34. SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
  35. check_cxx_source_compiles("
  36. typedef int int_t;
  37. #include <supermatrix.h>
  38. #include <superlu_enum_consts.h>
  39. int main() {
  40. return SLU_SINGLE;
  41. }"
  42. SUPERLU_HAS_CLEAN_ENUMS)
  43. check_cxx_source_compiles("
  44. typedef int int_t;
  45. #include <supermatrix.h>
  46. #include <slu_util.h>
  47. int main(void)
  48. {
  49. GlobalLU_t glu;
  50. return 0;
  51. }"
  52. SUPERLU_HAS_GLOBALLU_T)
  53. if(SUPERLU_HAS_GLOBALLU_T)
  54. # at least 5.0
  55. set(SUPERLU_VERSION_VAR "5.0")
  56. elseif(SUPERLU_HAS_CLEAN_ENUMS)
  57. # at least 4.3
  58. set(SUPERLU_VERSION_VAR "4.3")
  59. elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
  60. # at least 4.0
  61. set(SUPERLU_VERSION_VAR "4.0")
  62. else()
  63. set(SUPERLU_VERSION_VAR "3.0")
  64. endif()
  65. cmake_pop_check_state()
  66. if(SuperLU_FIND_VERSION)
  67. if(${SUPERLU_VERSION_VAR} VERSION_LESS ${SuperLU_FIND_VERSION})
  68. set(SUPERLU_VERSION_OK FALSE)
  69. else()
  70. set(SUPERLU_VERSION_OK TRUE)
  71. endif()
  72. else()
  73. set(SUPERLU_VERSION_OK TRUE)
  74. endif()
  75. endif()
  76. include(FindPackageHandleStandardArgs)
  77. find_package_handle_standard_args(SUPERLU
  78. REQUIRED_VARS SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK
  79. VERSION_VAR SUPERLU_VERSION_VAR)
  80. mark_as_advanced(SUPERLU_INCLUDES SUPERLU_LIBRARIES)