CMakeLists.txt 699 字节
Newer Older
1 2
file(GLOB_RECURSE CUDA_STUB src/libcuda.cpp)
file(GLOB_RECURSE NVRTC_STUB src/libnvrtc.cpp)
3 4

if(MGE_WITH_CUDA_STUB)
5
  list(APPEND STUB_SRC ${CUDA_STUB})
6 7 8
endif()

if(MGE_WITH_NVRTC_STUB)
9
  list(APPEND STUB_SRC ${NVRTC_STUB})
10
endif()
11

12
add_library(cuda-stub OBJECT ${STUB_SRC})
13 14

set_target_properties(cuda-stub PROPERTIES OUTPUT_NAME cuda_stub)
15
target_compile_definitions(cuda-stub PRIVATE __CUDA_API_VERSION_INTERNAL)
16 17
if(MSVC OR WIN32)
  target_link_libraries(cuda-stub PRIVATE -Wl,--no-undefined)
18
else()
19
  target_link_libraries(cuda-stub PRIVATE dl -Wl,--no-undefined)
20
endif()
21 22
target_include_directories(cuda-stub
                           PRIVATE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/genfiles>)