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

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