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