1
2# generate split test header file
3message(STATUS ${CMAKE_CURRENT_BINARY_DIR})
4file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h "")
5foreach(i RANGE 1 999)
6  file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h
7    "#ifdef EIGEN_TEST_PART_${i}\n"
8    "#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n"
9    "#else\n"
10    "#define CALL_SUBTEST_${i}(FUNC)\n"
11    "#endif\n\n"
12    )
13endforeach()
14
15# configure blas/lapack (use Eigen's ones)
16set(BLAS_FOUND TRUE)
17set(LAPACK_FOUND TRUE)
18set(BLAS_LIBRARIES eigen_blas)
19set(LAPACK_LIBRARIES eigen_lapack)
20
21set(EIGEN_TEST_MATRIX_DIR "" CACHE STRING "Enable testing of realword sparse matrices contained in the specified path")
22if(EIGEN_TEST_MATRIX_DIR)
23  if(NOT WIN32)
24    message(STATUS "Test realworld sparse matrices: ${EIGEN_TEST_MATRIX_DIR}")
25    add_definitions( -DTEST_REAL_CASES="${EIGEN_TEST_MATRIX_DIR}" )
26  else(NOT WIN32)
27    message(STATUS "REAL CASES CAN NOT BE CURRENTLY TESTED ON WIN32")
28  endif(NOT WIN32)
29endif(EIGEN_TEST_MATRIX_DIR)
30
31set(SPARSE_LIBS " ")
32
33find_package(Cholmod)
34if(CHOLMOD_FOUND AND BLAS_FOUND AND LAPACK_FOUND)
35  add_definitions("-DEIGEN_CHOLMOD_SUPPORT")
36  include_directories(${CHOLMOD_INCLUDES})
37  set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
38  set(CHOLMOD_ALL_LIBS  ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
39  ei_add_property(EIGEN_TESTED_BACKENDS "Cholmod, ")
40else()
41  ei_add_property(EIGEN_MISSING_BACKENDS "Cholmod, ")
42endif()
43
44find_package(Umfpack)
45if(UMFPACK_FOUND AND BLAS_FOUND)
46  add_definitions("-DEIGEN_UMFPACK_SUPPORT")
47  include_directories(${UMFPACK_INCLUDES})
48  set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
49  set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
50  ei_add_property(EIGEN_TESTED_BACKENDS "UmfPack, ")
51else()
52  ei_add_property(EIGEN_MISSING_BACKENDS "UmfPack, ")
53endif()
54
55find_package(SuperLU)
56if(SUPERLU_FOUND AND BLAS_FOUND)
57  add_definitions("-DEIGEN_SUPERLU_SUPPORT")
58  include_directories(${SUPERLU_INCLUDES})
59  set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
60  set(SUPERLU_ALL_LIBS ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
61  ei_add_property(EIGEN_TESTED_BACKENDS  "SuperLU, ")
62else()
63  ei_add_property(EIGEN_MISSING_BACKENDS  "SuperLU, ")
64endif()
65
66
67find_package(Pastix)
68find_package(Scotch)
69find_package(Metis 5.0 REQUIRED)
70if(PASTIX_FOUND AND BLAS_FOUND)
71  add_definitions("-DEIGEN_PASTIX_SUPPORT")
72  include_directories(${PASTIX_INCLUDES})
73  if(SCOTCH_FOUND)
74    include_directories(${SCOTCH_INCLUDES})
75    set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES})
76  elseif(METIS_FOUND)
77    include_directories(${METIS_INCLUDES})
78    set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES})
79  else(SCOTCH_FOUND)
80    ei_add_property(EIGEN_MISSING_BACKENDS  "PaStiX, ")
81  endif(SCOTCH_FOUND)
82  set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES} ${ORDERING_LIBRARIES} ${BLAS_LIBRARIES})
83  set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES} ${BLAS_LIBRARIES})
84  ei_add_property(EIGEN_TESTED_BACKENDS  "PaStiX, ")
85else()
86  ei_add_property(EIGEN_MISSING_BACKENDS  "PaStiX, ")
87endif()
88
89if(METIS_FOUND)
90  add_definitions("-DEIGEN_METIS_SUPPORT")
91  include_directories(${METIS_INCLUDES})
92  ei_add_property(EIGEN_TESTED_BACKENDS "METIS, ")
93else()
94  ei_add_property(EIGEN_MISSING_BACKENDS "METIS, ")
95endif()
96
97find_package(SPQR)
98if(SPQR_FOUND AND BLAS_FOUND AND LAPACK_FOUND)
99  if(CHOLMOD_FOUND)
100    add_definitions("-DEIGEN_SPQR_SUPPORT")
101    include_directories(${SPQR_INCLUDES})
102    set(SPQR_ALL_LIBS ${SPQR_LIBRARIES} ${CHOLMOD_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
103    set(SPARSE_LIBS ${SPARSE_LIBS} ${SPQR_ALL_LIBS})
104    ei_add_property(EIGEN_TESTED_BACKENDS "SPQR, ")
105  else(CHOLMOD_FOUND)
106    ei_add_property(EIGEN_MISSING_BACKENDS "SPQR, ")
107  endif(CHOLMOD_FOUND)
108endif()
109
110option(EIGEN_TEST_NOQT "Disable Qt support in unit tests" OFF)
111if(NOT EIGEN_TEST_NOQT)
112  find_package(Qt4)
113  if(QT4_FOUND)
114    include(${QT_USE_FILE})
115    ei_add_property(EIGEN_TESTED_BACKENDS  "Qt4 support, ")
116  else()
117    ei_add_property(EIGEN_MISSING_BACKENDS  "Qt4 support, ")
118  endif()
119endif(NOT EIGEN_TEST_NOQT)
120
121if(TEST_LIB)
122  add_definitions("-DEIGEN_EXTERN_INSTANTIATIONS=1")
123endif(TEST_LIB)
124
125set_property(GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT "Official")
126add_custom_target(BuildOfficial)
127
128ei_add_test(meta)
129ei_add_test(sizeof)
130ei_add_test(dynalloc)
131ei_add_test(nomalloc)
132ei_add_test(first_aligned)
133ei_add_test(mixingtypes)
134ei_add_test(packetmath)
135ei_add_test(unalignedassert)
136ei_add_test(vectorization_logic)
137ei_add_test(basicstuff)
138ei_add_test(linearstructure)
139ei_add_test(integer_types)
140ei_add_test(cwiseop)
141ei_add_test(unalignedcount)
142ei_add_test(exceptions)
143ei_add_test(redux)
144ei_add_test(visitor)
145ei_add_test(block)
146ei_add_test(corners)
147ei_add_test(product_small)
148ei_add_test(product_large)
149ei_add_test(product_extra)
150ei_add_test(diagonalmatrices)
151ei_add_test(adjoint)
152ei_add_test(diagonal)
153ei_add_test(miscmatrices)
154ei_add_test(commainitializer)
155ei_add_test(smallvectors)
156ei_add_test(mapped_matrix)
157ei_add_test(mapstride)
158ei_add_test(mapstaticmethods)
159ei_add_test(array)
160ei_add_test(array_for_matrix)
161ei_add_test(array_replicate)
162ei_add_test(array_reverse)
163ei_add_test(ref)
164ei_add_test(triangular)
165ei_add_test(selfadjoint)
166ei_add_test(product_selfadjoint)
167ei_add_test(product_symm)
168ei_add_test(product_syrk)
169ei_add_test(product_trmv)
170ei_add_test(product_trmm)
171ei_add_test(product_trsolve)
172ei_add_test(product_mmtr)
173ei_add_test(product_notemporary)
174ei_add_test(stable_norm)
175ei_add_test(bandmatrix)
176ei_add_test(cholesky)
177ei_add_test(lu)
178ei_add_test(determinant)
179ei_add_test(inverse)
180ei_add_test(qr)
181ei_add_test(qr_colpivoting)
182ei_add_test(qr_fullpivoting)
183ei_add_test(upperbidiagonalization)
184ei_add_test(hessenberg)
185ei_add_test(schur_real)
186ei_add_test(schur_complex)
187ei_add_test(eigensolver_selfadjoint)
188ei_add_test(eigensolver_generic)
189ei_add_test(eigensolver_complex)
190ei_add_test(real_qz)
191ei_add_test(eigensolver_generalized_real)
192ei_add_test(jacobi)
193ei_add_test(jacobisvd)
194ei_add_test(geo_orthomethods)
195ei_add_test(geo_homogeneous)
196ei_add_test(geo_quaternion)
197ei_add_test(geo_transformations)
198ei_add_test(geo_eulerangles)
199ei_add_test(geo_hyperplane)
200ei_add_test(geo_parametrizedline)
201ei_add_test(geo_alignedbox)
202ei_add_test(stdvector)
203ei_add_test(stdvector_overload)
204ei_add_test(stdlist)
205ei_add_test(stddeque)
206ei_add_test(resize)
207ei_add_test(sparse_vector)
208ei_add_test(sparse_basic)
209ei_add_test(sparse_product)
210ei_add_test(sparse_solvers)
211ei_add_test(umeyama)
212ei_add_test(householder)
213ei_add_test(swap)
214ei_add_test(conservative_resize)
215ei_add_test(permutationmatrices)
216ei_add_test(sparse_permutations)
217ei_add_test(nullary)
218ei_add_test(nesting_ops "${CMAKE_CXX_FLAGS_DEBUG}")
219ei_add_test(zerosized)
220ei_add_test(dontalign)
221ei_add_test(sizeoverflow)
222ei_add_test(prec_inverse_4x4)
223ei_add_test(vectorwiseop)
224ei_add_test(special_numbers)
225
226ei_add_test(simplicial_cholesky)
227ei_add_test(conjugate_gradient)
228ei_add_test(bicgstab)
229ei_add_test(sparselu)
230ei_add_test(sparseqr)
231
232# ei_add_test(denseLM)
233
234if(QT4_FOUND)
235  ei_add_test(qtvector "" "${QT_QTCORE_LIBRARY}")
236endif(QT4_FOUND)
237
238ei_add_test(eigen2support)
239
240if(UMFPACK_FOUND)
241  ei_add_test(umfpack_support "" "${UMFPACK_ALL_LIBS}")
242endif()
243
244if(SUPERLU_FOUND)
245  ei_add_test(superlu_support "" "${SUPERLU_ALL_LIBS}")
246endif()
247
248if(CHOLMOD_FOUND)
249  ei_add_test(cholmod_support "" "${CHOLMOD_ALL_LIBS}")
250endif()
251
252if(PARDISO_FOUND)
253  ei_add_test(pardiso_support "" "${PARDISO_ALL_LIBS}")
254endif()
255
256if(PASTIX_FOUND AND (SCOTCH_FOUND OR METIS_FOUND))
257  ei_add_test(pastix_support "" "${PASTIX_ALL_LIBS}")
258endif()
259
260if(SPQR_FOUND AND CHOLMOD_FOUND)
261  ei_add_test(spqr_support "" "${SPQR_ALL_LIBS}")
262endif()
263
264if(METIS_FOUND)
265ei_add_test(metis_support "" "${METIS_LIBRARIES}")
266endif()
267
268string(TOLOWER "${CMAKE_CXX_COMPILER}" cmake_cxx_compiler_tolower)
269if(cmake_cxx_compiler_tolower MATCHES "qcc")
270  set(CXX_IS_QCC "ON")
271endif()
272
273ei_add_property(EIGEN_TESTING_SUMMARY "CXX:               ${CMAKE_CXX_COMPILER}\n")
274if(CMAKE_COMPILER_IS_GNUCXX AND NOT CXX_IS_QCC)
275  execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version COMMAND head -n 1 OUTPUT_VARIABLE EIGEN_CXX_VERSION_STRING OUTPUT_STRIP_TRAILING_WHITESPACE)
276  ei_add_property(EIGEN_TESTING_SUMMARY "CXX_VERSION:       ${EIGEN_CXX_VERSION_STRING}\n")
277endif()
278ei_add_property(EIGEN_TESTING_SUMMARY "CXX_FLAGS:         ${CMAKE_CXX_FLAGS}\n")
279ei_add_property(EIGEN_TESTING_SUMMARY "Sparse lib flags:  ${SPARSE_LIBS}\n")
280
281option(EIGEN_TEST_EIGEN2 "Run whole Eigen2 test suite against EIGEN2_SUPPORT" OFF)
282mark_as_advanced(EIGEN_TEST_EIGEN2)
283if(EIGEN_TEST_EIGEN2)
284  add_subdirectory(eigen2)
285endif()
286