CMakeLists.txt 729 字节
Newer Older
1 2 3 4 5 6 7 8 9 10
file (GLOB_RECURSE CUDA_STUB src/libcuda.cpp)
file (GLOB_RECURSE NVRTC_STUB src/libnvrtc.cpp)

if(MGE_WITH_CUDA_STUB)
    list(APPEND STUB_SRC ${CUDA_STUB})
endif()

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

12
if(MSVC OR WIN32)
13
    add_library (cuda-stub STATIC ${STUB_SRC})
14
else()
15
    add_library (cuda-stub SHARED ${STUB_SRC})
16
endif()
17 18

set_target_properties(cuda-stub PROPERTIES OUTPUT_NAME cuda_stub)
19
target_compile_definitions(cuda-stub PRIVATE __CUDA_API_VERSION_INTERNAL)
20 21 22 23 24
if (MSVC OR WIN32)
    target_link_libraries(cuda-stub PRIVATE -Wl,--no-undefined)
else()
    target_link_libraries(cuda-stub PRIVATE dl -Wl,--no-undefined)
endif()
25
install (TARGETS cuda-stub EXPORT ${MGE_EXPORT_TARGETS})