-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
53 lines (38 loc) · 1.45 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
PROJECT(gpupsat)
IF (NOT CUDA_COMPUTE_CAPABILITY)
SET(CUDA_COMPUTE_CAPABILITY "30")
MESSAGE("Use flag -DCUDA_COMPUTE_CAPABILITY=XX to set CUDA compute capability.")
MESSAGE("Compute capability was set to minimal required (30).")
ENDIF()
FIND_PACKAGE(CUDA QUIET REQUIRED)
IF (${CUDA_VERSION_MAJOR} LESS 7)
MESSAGE(FATAL_ERROR
"CUDA toolkit v7.0 or newer required (found v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}).")
ENDIF()
FIND_PACKAGE(Boost COMPONENTS program_options REQUIRED)
IF (WIN32)
ADD_DEFINITIONS("-DBOOST_ALL_DYN_LINK")
ENDIF()
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIR} ${CUDA_INCLUDE_DIR})
INCLUDE_DIRECTORIES(.)
SET(SOURCES
sls-cuda/kernel.cu
sls-cuda/main.cpp
sls-cuda/util.cpp
sls-cuda/stopwatch.cuh
)
SET(CMAKE_CXX_STANDARD 11)
INCLUDE(FindCUDA)
SET(CUDA_PROPAGATE_HOST_FLAGS ON)
SET(CUDA_SEPARABLE_COMPILATION ON)
LIST(APPEND CUDA_NVCC_FLAGS "-Wno-deprecated-gpu-targets;")
LIST(APPEND CUDA_NVCC_FLAGS "-gencode=arch=compute_${CUDA_COMPUTE_CAPABILITY},code=sm_${CUDA_COMPUTE_CAPABILITY};")
IF (UNIX)
LIST(APPEND CMAKE_CXX_FLAGS "-std=c++11 -O0 -ggdb3 -Wall")
ENDIF()
CUDA_ADD_EXECUTABLE(gpupsat ${SOURCES})
GET_FILENAME_COMPONENT(CUDA_LIB_PATH ${CUDA_CUDART_LIBRARY} DIRECTORY)
FIND_LIBRARY(CUDA_cudadevrt_LIBRARY cudadevrt PATHS ${CUDA_LIB_PATH})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
TARGET_LINK_LIBRARIES(gpupsat ${Boost_LIBRARIES} ${CUDA_cudadevrt_LIBRARY})