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.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. )
  18. endif ()
  19. # crashing on travis cl with an error code suggesting resource not found
  20. if (NOT MSVC)
  21. set(OpenBLAS_utest_src
  22. ${OpenBLAS_utest_src}
  23. test_dotu.c
  24. )
  25. endif ()
  26. # known to hang with the native Windows and Android threads
  27. # FIXME needs checking if this works on any of the other platforms
  28. if (OS_CYGWIN_NT OR OS_LINUX)
  29. if (NOT USE_OPENMP)
  30. set(OpenBLAS_utest_src
  31. ${OpenBLAS_utest_src}
  32. test_fork.c
  33. )
  34. endif()
  35. set(OpenBLAS_utest_src
  36. ${OpenBLAS_utest_src}
  37. test_post_fork.c
  38. )
  39. endif()
  40. if (NOT NO_LAPACK)
  41. set(OpenBLAS_utest_src
  42. ${OpenBLAS_utest_src}
  43. test_potrs.c
  44. )
  45. if (NOT NO_CBLAS AND NOT NO_LAPACKE)
  46. set(OpenBLAS_utest_src
  47. ${OpenBLAS_utest_src}
  48. test_kernel_regress.c
  49. )
  50. endif()
  51. endif()
  52. set(OpenBLAS_utest_bin openblas_utest)
  53. add_executable(${OpenBLAS_utest_bin} ${OpenBLAS_utest_src})
  54. target_link_libraries(${OpenBLAS_utest_bin} ${OpenBLAS_LIBNAME})
  55. if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "QNX" )
  56. target_link_libraries(${OpenBLAS_utest_bin} m)
  57. endif()
  58. if (${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
  59. set_target_properties( ${OpenBLAS_utest_bin} PROPERTIES COMPILE_DEFINITIONS "_CRT_SECURE_NO_WARNINGS")
  60. endif()
  61. #Set output for utest
  62. set_target_properties( ${OpenBLAS_utest_bin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
  63. foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
  64. string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
  65. set_target_properties( ${OpenBLAS_utest_bin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_CURRENT_BINARY_DIR})
  66. endforeach()
  67. if (MSVC AND BUILD_SHARED_LIBS)
  68. add_custom_command(TARGET ${OpenBLAS_utest_bin}
  69. POST_BUILD
  70. COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}/${OpenBLAS_LIBNAME}.dll ${CMAKE_CURRENT_BINARY_DIR}/.
  71. )
  72. endif()
  73. add_test(${OpenBLAS_utest_bin} ${CMAKE_CURRENT_BINARY_DIR}/${OpenBLAS_utest_bin})