CheckHIPSourceCompiles.cmake 626 B

123456789101112131415161718192021222324252627
  1. enable_language (HIP)
  2. include(CheckSourceCompiles)
  3. check_source_compiles(HIP "I don't build" SHOULD_FAIL)
  4. if(SHOULD_FAIL)
  5. message(SEND_ERROR "invalid HIP source didn't fail.")
  6. endif()
  7. check_source_compiles(HIP [=[
  8. #include <vector>
  9. __device__ int d_func() { }
  10. int main() {
  11. return 0;
  12. }
  13. ]=]
  14. SHOULD_BUILD)
  15. if(NOT SHOULD_BUILD)
  16. message(SEND_ERROR "Test fail for valid HIP source.")
  17. endif()
  18. check_source_compiles(HIP "void l(char const (&x)[2]){}; int main() { l(\"\\n\"); return 0;}"
  19. SHOULD_BUILD_COMPLEX)
  20. if(NOT SHOULD_BUILD_COMPLEX)
  21. message(SEND_ERROR "Test fail for valid HIP complex source.")
  22. endif()