-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
59 lines (47 loc) · 1.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 3.10)
# Set the project name
project(CudaSmartPointers LANGUAGES CXX CUDA)
find_package(CUDA REQUIRED QUIET)
include_directories(${CUDA_INCLUDE_DIRS})
if (CUDA_VERSION VERSION_LESS "11.0")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++11 -Wno-deprecated-gpu-targets)
else ()
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++14 -Wno-deprecated-gpu-targets)
endif ()
# Set the CUDA standard
set(CMAKE_CUDA_STANDARD 11)
# Add the library
add_library(CudaSmartPointers SHARED
src/CudaUniquePointer.cpp
src/CudaSharedPointer.cpp
src/CudaMemUtils.cpp
)
# Specify include directories for the library
target_include_directories(CudaSmartPointers PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(CudaSmartPointers ${CUDA_LIBRARIES})
# example
add_executable(example example/main.cu)
target_link_libraries(example PRIVATE CudaSmartPointers ${CUDA_LIBRARIES})
# testing
# add_subdirectory(test)
# install
set_target_properties(CudaSmartPointers PROPERTIES
PUBLIC_HEADER "include/CudaMem/CudaUniquePointer.h;include/CudaMem/CudaSharedPointer.h;include/CudaMem/CudaMemUtils.h"
)
install(TARGETS CudaSmartPointers
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/CudaMem
)
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
endif()