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 1.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. include_directories(${PROJECT_SOURCE_DIR})
  2. include_directories(${PROJECT_BINARY_DIR})
  3. enable_language(Fortran)
  4. if (BUILD_SINGLE)
  5. list( APPEND OpenBLAS_Tests sblat1 sblat2 sblat3)
  6. endif()
  7. if (BUILD_DOUBLE)
  8. list (APPEND OpenBLAS_Tests dblat1 dblat2 dblat3)
  9. endif()
  10. if (BUILD_COMPLEX)
  11. list (APPEND OpenBLAS_Tests cblat1 cblat2 cblat3)
  12. endif()
  13. if (BUILD_COMPLEX16)
  14. list (APPEND OpenBLAS_Tests zblat1 zblat2 zblat3)
  15. endif()
  16. foreach(test_bin ${OpenBLAS_Tests})
  17. add_executable(${test_bin} ${test_bin}.f)
  18. target_link_libraries(${test_bin} ${OpenBLAS_LIBNAME})
  19. endforeach()
  20. # $1 exec, $2 input, $3 output_result
  21. FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_helper.sh
  22. "rm -f $3\n"
  23. "$1 < $2\n"
  24. "grep -q FATAL $3\n"
  25. "if [ $? -eq 0 ]; then\n"
  26. "echo Error\n"
  27. "exit 1\n"
  28. "else\n"
  29. "exit 0\n"
  30. "fi\n"
  31. )
  32. #set(float_types s d c z)
  33. if (BUILD_SINGLE)
  34. list (APPEND float_types s)
  35. endif()
  36. if (BUILD_DOUBLE)
  37. list (APPEND float_types d)
  38. endif()
  39. if (BUILD_COMPLEX)
  40. list (APPEND float_types c)
  41. endif()
  42. if (BUILD_COMPLEX16)
  43. list (APPEND float_types z)
  44. endif()
  45. foreach(float_type ${float_types})
  46. string(TOUPPER ${float_type} float_type_upper)
  47. add_test(NAME "${float_type}blas1"
  48. COMMAND "${CMAKE_CURRENT_BINARY_DIR}/${float_type}blat1")
  49. add_test(NAME "${float_type}blas2"
  50. COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/test_helper.sh" "${CMAKE_CURRENT_BINARY_DIR}/${float_type}blat2" "${PROJECT_SOURCE_DIR}/test/${float_type}blat2.dat" ${float_type_upper}BLAT2.SUMM)
  51. add_test(NAME "${float_type}blas3"
  52. COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/test_helper.sh" "${CMAKE_CURRENT_BINARY_DIR}/${float_type}blat3" "${PROJECT_SOURCE_DIR}/test/${float_type}blat3.dat" ${float_type_upper}BLAT3.SUMM)
  53. endforeach()