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

5 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. include_directories(${PROJECT_SOURCE_DIR})
  2. include_directories(${PROJECT_BINARY_DIR})
  3. if (NOT NOFORTRAN)
  4. enable_language(Fortran)
  5. endif()
  6. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DADD${BU} -DCBLAS")
  7. if (CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
  8. set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-tree-vectorize")
  9. endif()
  10. if(WIN32)
  11. FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.ps1
  12. "$ErrorActionPreference = \"Stop\"\n"
  13. "Get-Content $args[1] | & $args[0]\n"
  14. )
  15. set(test_helper powershell -ExecutionPolicy Bypass "${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.ps1")
  16. else()
  17. FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.sh
  18. "$1 < $2\n"
  19. )
  20. set(test_helper sh "${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.sh")
  21. endif()
  22. foreach(float_type ${FLOAT_TYPES})
  23. string(SUBSTRING ${float_type} 0 1 float_char_upper)
  24. string(TOLOWER ${float_char_upper} float_char)
  25. if (${float_char} STREQUAL "b")
  26. continue()
  27. endif()
  28. #level1
  29. if (NOT NOFORTRAN)
  30. add_executable(x${float_char}cblat1
  31. c_${float_char}blat1.f
  32. c_${float_char}blas1.c)
  33. else()
  34. add_executable(x${float_char}cblat1
  35. c_${float_char}blat1c.c
  36. c_${float_char}blas1.c)
  37. endif()
  38. target_link_libraries(x${float_char}cblat1 ${OpenBLAS_LIBNAME})
  39. if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "QNX")
  40. target_link_libraries(x${float_char}cblat1 m)
  41. endif()
  42. add_test(NAME "x${float_char}cblat1"
  43. COMMAND $<TARGET_FILE:x${float_char}cblat1>)
  44. #level2
  45. if (NOT NOFORTRAN)
  46. add_executable(x${float_char}cblat2
  47. c_${float_char}blat2.f
  48. c_${float_char}blas2.c
  49. c_${float_char}2chke.c
  50. auxiliary.c
  51. c_xerbla.c
  52. constant.c)
  53. else()
  54. add_executable(x${float_char}cblat2
  55. c_${float_char}blat2c.c
  56. c_${float_char}blas2.c
  57. c_${float_char}2chke.c
  58. auxiliary.c
  59. c_xerbla.c
  60. constant.c)
  61. endif()
  62. target_link_libraries(x${float_char}cblat2 ${OpenBLAS_LIBNAME})
  63. if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "QNX")
  64. target_link_libraries(x${float_char}cblat2 m)
  65. endif()
  66. add_test(NAME "x${float_char}cblat2"
  67. COMMAND ${test_helper} $<TARGET_FILE:x${float_char}cblat2> "${PROJECT_SOURCE_DIR}/ctest/${float_char}in2")
  68. #level3
  69. if (NOT NOFORTRAN)
  70. add_executable(x${float_char}cblat3
  71. c_${float_char}blat3.f
  72. c_${float_char}blas3.c
  73. c_${float_char}3chke.c
  74. auxiliary.c
  75. c_xerbla.c
  76. constant.c)
  77. else()
  78. add_executable(x${float_char}cblat3
  79. c_${float_char}blat3c.c
  80. c_${float_char}blas3.c
  81. c_${float_char}3chke.c
  82. auxiliary.c
  83. c_xerbla.c
  84. constant.c)
  85. endif()
  86. target_link_libraries(x${float_char}cblat3 ${OpenBLAS_LIBNAME})
  87. if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "QNX")
  88. target_link_libraries(x${float_char}cblat3 m)
  89. endif()
  90. add_test(NAME "x${float_char}cblat3"
  91. COMMAND ${test_helper} $<TARGET_FILE:x${float_char}cblat3> "${PROJECT_SOURCE_DIR}/ctest/${float_char}in3")
  92. endforeach()