forked from Chia-Network/bladebit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.cmake
175 lines (150 loc) · 3.76 KB
/
Config.cmake
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Base interface configuration project
add_library(bladebit_config INTERFACE)
target_compile_definitions(bladebit_config INTERFACE
$<${is_release}:
_NDEBUG=1
NDEBUG=1
>
$<${is_debug}:
_DEBUG=1
DEBUG=1
>
$<$<CXX_COMPILER_ID:MSVC>:
UNICODE=1
WIN32_LEAN_AND_MEAN=1
NOMINMAX=1
_CRT_SECURE_NO_WARNINGS=1
_HAS_EXCEPTIONS=0
>
)
target_compile_options(bladebit_config INTERFACE
# GCC or Clang
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:
-Wall
-Wno-comment
-Wno-unknown-pragmas
-g
$<${is_release}:
-O3
>
$<${is_debug}:
-O0
>
>
# GCC
$<$<CXX_COMPILER_ID:GNU>:
-fmax-errors=5
>
# Clang
$<$<CXX_COMPILER_ID:Clang,AppleClang>:
-ferror-limit=5
-fdeclspec
-Wno-empty-body
>
# MSVC
$<${is_msvc_c_cpp}:
/Zc:__cplusplus
/MP
/Zi
# /EHsc-
# /Wall
/W3
/WX
/wd4068
/wd4464
/wd4668
/wd4820
/wd4514
/wd4626
/wd5027
$<${is_release}:
/Oi /O2 /Gy /GL
>
$<${is_debug}:
/Od
>
>
$<${is_x86}:
>
$<${is_arm}:
>
)
target_link_options(bladebit_config INTERFACE
# GCC or Clang
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:
-g
-rdynamic
>
# MSVC
$<${is_msvc_c_cpp}:
/SUBSYSTEM:CONSOLE
/STACK:33554432,1048576
$<${is_release}:
/DEBUG:FULL
/LTCG
/OPT:REF,ICF,LBR
>
$<${is_debug}:
# /DEBUG:FASTLINK
# /OPT:NOREF,NOICF,NOLBR
# /INCREMENTAL
>
>
)
set_property(DIRECTORY . PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
set_property(DIRECTORY . PROPERTY CUDA_SEPARABLE_COMPILATION ON)
set_property(DIRECTORY . PROPERTY CUDA_RESOLVE_DEVICE_SYMBOLS ON)
set(preinclude_pch
$<${is_cuda}:--pre-include pch.h>
$<${is_c_cpp}:
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:--include=pch.h>
>
$<${is_msvc_c_cpp}:/FIpch.h>
)
# See: https://gitlab.kitware.com/cmake/cmake/-/issues/18265
cmake_policy(SET CMP0105 NEW)
set(cuda_archs
$<${is_cuda_release}:
## Maxwell
## Tesla/Quadro M series
-gencode=arch=compute_50,code=sm_50
## Quadro M6000 , GeForce 900, GTX-970, GTX-980, GTX Titan X
-gencode=arch=compute_52,code=sm_52
## Tegra (Jetson) TX1 / Tegra X1, Drive CX, Drive PX, Jetson Nano
-gencode=arch=compute_53,code=sm_53
## Pascal
## GeForce 1000 series
-gencode=arch=compute_60,code=sm_60
## GeForce GTX 1050Ti, GTX 1060, GTX 1070, GTX 1080
-gencode=arch=compute_61,code=sm_61
## Drive Xavier, Jetson AGX Xavier, Jetson Xavier NX
-gencode=arch=compute_62,code=sm_62
## Volta
## GV100, Tesla V100, Titan V
-gencode=arch=compute_70,code=sm_70
## Tesla V100
-gencode=arch=compute_72,code=sm_72
## Turing
-gencode=arch=compute_75,code=sm_75
## Ampere
## NVIDIA A100, DGX-A100
-gencode=arch=compute_80,code=sm_80
## GeForce RTX 3000 series, NVIDIA A100
-gencode=arch=compute_86,code=sm_86
## Jetson Orin
-gencode=arch=compute_87,code=sm_87
## Lovelace
## NVIDIA GeForce RTX 4090, RTX 4080, RTX 6000, Tesla L40
-gencode=arch=compute_89,code=sm_89
## Future proofing
-gencode=arch=compute_89,code=compute_89
## Hopper
## NVIDIA H100 (GH100)
# -gencode=arch=compute_90,code=sm_90
# -gencode=arch=compute_90a,code=sm_90a
>
$<${is_cuda_debug}:
-arch=native
# -gencode=arch=compute_52,code=sm_52 # Maxwell
>
)