NVIDIA-CUDA.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE True)
  2. set(CMAKE_CUDA_VERBOSE_FLAG "-v")
  3. set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
  4. if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
  5. set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
  6. set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
  7. set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
  8. # CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we
  9. # don't need to forward it through nvcc.
  10. set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
  11. string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
  12. string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
  13. string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
  14. string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG")
  15. string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
  16. endif()
  17. set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
  18. set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=)
  19. if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
  20. set(CMAKE_CUDA_STANDARD_DEFAULT "")
  21. else()
  22. set(CMAKE_CUDA_STANDARD_DEFAULT 98)
  23. set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "")
  24. set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
  25. set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
  26. set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
  27. if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
  28. set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "-std=c++03")
  29. set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "-std=c++03")
  30. set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
  31. set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
  32. endif()
  33. endif()
  34. # FIXME: investigate use of --options-file.
  35. # Tell Makefile generator that nvcc does not support @<rspfile> syntax.
  36. set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0)
  37. set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
  38. set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0)
  39. if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0")
  40. set(CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG "--options-file ")
  41. set(CMAKE_CUDA_RESPONSE_FILE_FLAG "--options-file ")
  42. endif()