-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathBaseCMake.cmake
More file actions
72 lines (66 loc) · 2.72 KB
/
BaseCMake.cmake
File metadata and controls
72 lines (66 loc) · 2.72 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
if(WIN32)
set(BOOST_DIR "C:/dependencies/boost_1_66_0")
include_directories(${BOOST_DIR})
endif()
##########################################################################
# Choose for which CC to build and if to enable Debug
option(CC50 "Build with compute capability 5.0 support" FALSE)
option(CC52 "Build with compute capability 5.2 support" FALSE)
option(CC61 "Build with compute capability 6.1 support" FALSE)
option(CC70_SYNC "Build with compute capability 7.0 support - SYNC" FALSE)
option(CC70_ASYNC "Build with compute capability 7.0 support - ASYNC" FALSE)
option(CC75_SYNC "Build with compute capability 7.5 support - SYNC" FALSE)
option(CC75_ASYNC "Build with compute capability 7.5 support - ASYNC" FALSE)
option(CC80_SYNC "Build with compute capability 8.0 support - SYNC" FALSE)
option(CC80_ASYNC "Build with compute capability 8.0 support - ASYNC" FALSE)
option(CUDA_BUILD_INFO "Build with kernel statistics and line numbers" TRUE)
option(CUDA_BUILD_DEBUG "Build with kernel debug" FALSE)
option(SYNC_BUILD "Set to true to disable ITS" OFF)
##########################################################################
# CUDA Flags
if (CC50)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_50,code=sm_50")
endif ()
if (CC52)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_52,code=sm_52")
endif ()
if (CC61)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_61,code=sm_61")
endif ()
if (CC70_SYNC)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_61,code=sm_70")
endif ()
if (CC70_ASYNC)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_70,code=sm_70")
endif ()
if (CC75_SYNC)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_61,code=sm_75")
endif ()
if (CC75_ASYNC)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_75,code=sm_75")
endif ()
if (CC80_SYNC)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_61,code=sm_80")
endif ()
if (CC80_ASYNC)
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_80,code=sm_80")
endif ()
string(APPEND CMAKE_CUDA_FLAGS " -Xcompiler -Wall -D_FORCE_INLINES -DVERBOSE --expt-extended-lambda -use_fast_math --expt-relaxed-constexpr")
if (CUDA_BUILD_INFO)
string(APPEND CMAKE_CUDA_FLAGS " -keep --ptxas-options=-v -lineinfo")
endif ()
if (CUDA_BUILD_DEBUG)
string(APPEND CMAKE_CUDA_FLAGS " -G")
endif ()
##########################################################################
# CXX Flags
if(WIN32)
set(CUDA_PROPAGATE_HOST_FLAGS ON)
if(MSVC)
string(APPEND CMAKE_CXX_FLAGS "/wd4464 /wd4514 /wd4820 /wd4668 /wd4574 /wd4571 /wd4324 /wd4710 /wd4711 /wd4365 /wd4515 /wd4201 /wd4267 /wd5027 /wd4626")
endif()
else()
set(CUDA_PROPAGATE_HOST_FLAGS ON)
SET(GCC_COVERAGE_LINK_FLAGS "-lstdc++fs")
string(APPEND CMAKE_CXX_FLAGS "-std=c++14 -mlzcnt -Wno-unknown-pragmas")
endif()