CMakeLists.txt 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. set(BLAS_FOUND TRUE)
  2. set(LAPACK_FOUND TRUE)
  3. set(BLAS_LIBRARIES eigen_blas_static)
  4. set(LAPACK_LIBRARIES eigen_lapack_static)
  5. set(SPARSE_LIBS "")
  6. # find_library(PARDISO_LIBRARIES pardiso412-GNU450-X86-64)
  7. # if(PARDISO_LIBRARIES)
  8. # add_definitions("-DEIGEN_PARDISO_SUPPORT")
  9. # set(SPARSE_LIBS ${SPARSE_LIBS} ${PARDISO_LIBRARIES})
  10. # endif()
  11. find_package(CHOLMOD)
  12. if(CHOLMOD_FOUND AND BLAS_FOUND AND LAPACK_FOUND)
  13. add_definitions("-DEIGEN_CHOLMOD_SUPPORT")
  14. include_directories(${CHOLMOD_INCLUDES})
  15. set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
  16. set(CHOLMOD_ALL_LIBS ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
  17. endif()
  18. find_package(UMFPACK)
  19. if(UMFPACK_FOUND AND BLAS_FOUND)
  20. add_definitions("-DEIGEN_UMFPACK_SUPPORT")
  21. include_directories(${UMFPACK_INCLUDES})
  22. set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
  23. set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
  24. endif()
  25. find_package(KLU)
  26. if(KLU_FOUND)
  27. add_definitions("-DEIGEN_KLU_SUPPORT")
  28. include_directories(${KLU_INCLUDES})
  29. set(SPARSE_LIBS ${SPARSE_LIBS} ${KLU_LIBRARIES})
  30. endif()
  31. find_package(SuperLU 4.0)
  32. if(SuperLU_FOUND AND BLAS_FOUND)
  33. add_definitions("-DEIGEN_SUPERLU_SUPPORT")
  34. include_directories(${SUPERLU_INCLUDES})
  35. set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
  36. set(SUPERLU_ALL_LIBS ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
  37. endif()
  38. find_package(PASTIX QUIET COMPONENTS METIS SCOTCH)
  39. # check that the PASTIX found is a version without MPI
  40. find_path(PASTIX_pastix_nompi.h_INCLUDE_DIRS
  41. NAMES pastix_nompi.h
  42. HINTS ${PASTIX_INCLUDE_DIRS}
  43. )
  44. if (NOT PASTIX_pastix_nompi.h_INCLUDE_DIRS)
  45. message(STATUS "A version of Pastix has been found but pastix_nompi.h does not exist in the include directory."
  46. " Because Eigen tests require a version without MPI, we disable the Pastix backend.")
  47. endif()
  48. if(PASTIX_FOUND AND PASTIX_pastix_nompi.h_INCLUDE_DIRS AND BLAS_FOUND)
  49. add_definitions("-DEIGEN_PASTIX_SUPPORT")
  50. include_directories(${PASTIX_INCLUDE_DIRS_DEP})
  51. if(SCOTCH_FOUND)
  52. include_directories(${SCOTCH_INCLUDE_DIRS})
  53. set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES})
  54. elseif(METIS_FOUND)
  55. include_directories(${METIS_INCLUDE_DIRS})
  56. set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES})
  57. endif()
  58. set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES_DEP} ${ORDERING_LIBRARIES})
  59. set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES_DEP})
  60. endif()
  61. if(METIS_FOUND)
  62. include_directories(${METIS_INCLUDE_DIRS})
  63. set (SPARSE_LIBS ${SPARSE_LIBS} ${METIS_LIBRARIES})
  64. add_definitions("-DEIGEN_METIS_SUPPORT")
  65. endif()
  66. find_library(RT_LIBRARY rt)
  67. if(RT_LIBRARY)
  68. set(SPARSE_LIBS ${SPARSE_LIBS} ${RT_LIBRARY})
  69. endif()
  70. add_executable(spbenchsolver spbenchsolver.cpp)
  71. target_link_libraries (spbenchsolver ${SPARSE_LIBS})
  72. add_executable(spsolver sp_solver.cpp)
  73. target_link_libraries (spsolver ${SPARSE_LIBS})
  74. add_executable(test_sparseLU test_sparseLU.cpp)
  75. target_link_libraries (test_sparseLU ${SPARSE_LIBS})