1
2
3set(BLAS_FOUND TRUE)
4set(LAPACK_FOUND TRUE)
5set(BLAS_LIBRARIES eigen_blas_static)
6set(LAPACK_LIBRARIES eigen_lapack_static)
7
8set(SPARSE_LIBS "")
9
10# find_library(PARDISO_LIBRARIES pardiso412-GNU450-X86-64)
11# if(PARDISO_LIBRARIES)
12#   add_definitions("-DEIGEN_PARDISO_SUPPORT")
13#   set(SPARSE_LIBS ${SPARSE_LIBS} ${PARDISO_LIBRARIES})
14# endif(PARDISO_LIBRARIES)
15
16find_package(Cholmod)
17if(CHOLMOD_FOUND AND BLAS_FOUND AND LAPACK_FOUND)
18  add_definitions("-DEIGEN_CHOLMOD_SUPPORT")
19  include_directories(${CHOLMOD_INCLUDES})
20  set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
21  set(CHOLMOD_ALL_LIBS  ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
22endif()
23
24find_package(Umfpack)
25if(UMFPACK_FOUND AND BLAS_FOUND)
26  add_definitions("-DEIGEN_UMFPACK_SUPPORT")
27  include_directories(${UMFPACK_INCLUDES})
28  set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
29  set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
30endif()
31
32find_package(SuperLU 4.0)
33if(SUPERLU_FOUND AND BLAS_FOUND)
34  add_definitions("-DEIGEN_SUPERLU_SUPPORT")
35  include_directories(${SUPERLU_INCLUDES})
36  set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
37  set(SUPERLU_ALL_LIBS ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
38endif()
39
40
41find_package(Pastix)
42find_package(Scotch)
43find_package(Metis)
44if(PASTIX_FOUND AND BLAS_FOUND)
45  add_definitions("-DEIGEN_PASTIX_SUPPORT")
46  include_directories(${PASTIX_INCLUDES})
47  if(SCOTCH_FOUND)
48    include_directories(${SCOTCH_INCLUDES})
49    set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES})
50  elseif(METIS_FOUND)
51    include_directories(${METIS_INCLUDES})
52    set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES})
53  endif(SCOTCH_FOUND)
54  set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES} ${ORDERING_LIBRARIES} ${BLAS_LIBRARIES})
55  set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES} ${BLAS_LIBRARIES})
56endif(PASTIX_FOUND AND BLAS_FOUND)
57
58if(METIS_FOUND)
59  include_directories(${METIS_INCLUDES})
60  set (SPARSE_LIBS ${SPARSE_LIBS} ${METIS_LIBRARIES})
61  add_definitions("-DEIGEN_METIS_SUPPORT")
62endif(METIS_FOUND)
63
64find_library(RT_LIBRARY rt)
65if(RT_LIBRARY)
66  set(SPARSE_LIBS ${SPARSE_LIBS} ${RT_LIBRARY})
67endif(RT_LIBRARY)
68
69add_executable(spbenchsolver spbenchsolver.cpp)
70target_link_libraries (spbenchsolver ${SPARSE_LIBS})
71
72add_executable(spsolver sp_solver.cpp)
73target_link_libraries (spsolver ${SPARSE_LIBS})
74
75
76add_executable(test_sparseLU test_sparseLU.cpp)
77target_link_libraries (test_sparseLU ${SPARSE_LIBS})
78
79