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

CMakeLists.txt 2.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. include_directories(${PROJECT_SOURCE_DIR})
  2. include_directories(${PROJECT_BINARY_DIR})
  3. if (MSVC AND "${CMAKE_C_COMPILER_ID}" MATCHES Clang)
  4. set(OpenBLAS_utest_src utest_main2.c)
  5. else ()
  6. set(OpenBLAS_utest_src
  7. utest_main.c
  8. test_min.c
  9. test_amax.c
  10. test_ismin.c
  11. test_rotmg.c
  12. test_rot.c
  13. test_axpy.c
  14. test_dsdot.c
  15. test_dnrm2.c
  16. test_swap.c
  17. test_zscal.c
  18. test_amin.c
  19. test_axpby.c
  20. )
  21. endif ()
  22. # crashing on travis cl with an error code suggesting resource not found
  23. if (NOT MSVC)
  24. set(OpenBLAS_utest_src
  25. ${OpenBLAS_utest_src}
  26. test_dotu.c
  27. )
  28. endif ()
  29. # known to hang with the native Windows and Android threads
  30. # FIXME needs checking if this works on any of the other platforms
  31. if (OS_CYGWIN_NT OR OS_LINUX)
  32. if (NOT USE_OPENMP)
  33. set(OpenBLAS_utest_src
  34. ${OpenBLAS_utest_src}
  35. test_fork.c
  36. )
  37. endif()
  38. set(OpenBLAS_utest_src
  39. ${OpenBLAS_utest_src}
  40. test_post_fork.c
  41. )
  42. endif()
  43. if (NOT NO_LAPACK)
  44. set(OpenBLAS_utest_src
  45. ${OpenBLAS_utest_src}
  46. test_potrs.c
  47. )
  48. if (NOT NO_CBLAS AND NOT NO_LAPACKE)
  49. set(OpenBLAS_utest_src
  50. ${OpenBLAS_utest_src}
  51. test_kernel_regress.c
  52. )
  53. endif()
  54. endif()
  55. set(OpenBLAS_utest_bin openblas_utest)
  56. add_executable(${OpenBLAS_utest_bin} ${OpenBLAS_utest_src})
  57. target_link_libraries(${OpenBLAS_utest_bin} ${OpenBLAS_LIBNAME})
  58. if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "QNX" )
  59. target_link_libraries(${OpenBLAS_utest_bin} m)
  60. endif()
  61. if (${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
  62. set_target_properties( ${OpenBLAS_utest_bin} PROPERTIES COMPILE_DEFINITIONS "_CRT_SECURE_NO_WARNINGS")
  63. endif()
  64. #Set output for utest
  65. set_target_properties( ${OpenBLAS_utest_bin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
  66. foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
  67. string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
  68. set_target_properties( ${OpenBLAS_utest_bin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_CURRENT_BINARY_DIR})
  69. endforeach()
  70. if (MSVC AND BUILD_SHARED_LIBS)
  71. add_custom_command(TARGET ${OpenBLAS_utest_bin}
  72. POST_BUILD
  73. COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}/${OpenBLAS_LIBNAME}.dll ${CMAKE_CURRENT_BINARY_DIR}/.
  74. )
  75. endif()
  76. add_test(${OpenBLAS_utest_bin} ${CMAKE_CURRENT_BINARY_DIR}/${OpenBLAS_utest_bin})