CMakeCUDACompilerId.cu.in 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef __CUDACC__
  2. # error "A C or C++ compiler has been selected for CUDA"
  3. #endif
  4. @CMAKE_CUDA_COMPILER_ID_CONTENT@
  5. /* Construct the string literal in pieces to prevent the source from
  6. getting matched. Store it in a pointer rather than an array
  7. because some compilers will just produce instructions to fill the
  8. array rather than assigning a pointer to a static array. */
  9. char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
  10. #ifdef SIMULATE_ID
  11. char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
  12. #endif
  13. @CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT@
  14. @CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@
  15. const char* info_language_dialect_default = "INFO" ":" "dialect_default["
  16. #if __cplusplus > 201703L
  17. "20"
  18. #elif __cplusplus >= 201703L
  19. "17"
  20. #elif __cplusplus >= 201402L
  21. "14"
  22. #elif __cplusplus >= 201103L
  23. "11"
  24. #else
  25. "98"
  26. #endif
  27. "]";
  28. /*--------------------------------------------------------------------------*/
  29. int main(int argc, char* argv[])
  30. {
  31. int require = 0;
  32. require += info_compiler[argc];
  33. require += info_platform[argc];
  34. #ifdef COMPILER_VERSION_MAJOR
  35. require += info_version[argc];
  36. #endif
  37. #ifdef SIMULATE_ID
  38. require += info_simulate[argc];
  39. #endif
  40. #ifdef SIMULATE_VERSION_MAJOR
  41. require += info_simulate_version[argc];
  42. #endif
  43. require += info_language_dialect_default[argc];
  44. (void)argv;
  45. return require;
  46. }