Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. cmake_minimum_required(VERSION 3.7)
  2. project( DelayDeviceLinking CUDA)
  3.  
  4. string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
  5. set(CMAKE_CXX_STANDARD 11)
  6. set(CMAKE_CUDA_STANDARD 11)
  7.  
  8. add_library(StaticA STATIC function1.cu)
  9. add_library(StaticB STATIC function2.cu)
  10. add_library(StaticC STATIC function3.cu)
  11.  
  12. target_link_libraries(StaticB PUBLIC StaticA)
  13. target_link_libraries(StaticC PUBLIC StaticA)
  14.  
  15. set_target_properties(StaticA StaticB StaticC
  16. PROPERTIES
  17. CUDA_SEPARABLE_COMPILATION ON
  18. POSITION_INDEPENDENT_CODE ON)
  19.  
  20. add_executable( DelayDeviceLinkingA main.cu)
  21. target_link_libraries(DelayDeviceLinkingA PRIVATE StaticB)
  22.  
  23. add_executable( DelayDeviceLinkingB main2.cu)
  24. target_link_libraries(DelayDeviceLinkingB PRIVATE StaticB StaticC)
  25.  
  26. if(APPLE)
  27. # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that
  28. # the static cuda runtime can find it at runtime.
  29. target_link_libraries(DelayDeviceLinkingA PRIVATE -Wl,-rpath,/usr/local/cuda/lib)
  30. target_link_libraries(DelayDeviceLinkingB PRIVATE -Wl,-rpath,/usr/local/cuda/lib)
  31. endif()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement