CMakeLists.txt
5.54 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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
set(files
adxintrin.h
altivec.h
ammintrin.h
amxintrin.h
arm_acle.h
arm_cmse.h
armintr.h
arm64intr.h
avx2intrin.h
avx512bf16intrin.h
avx512bwintrin.h
avx512bitalgintrin.h
avx512vlbitalgintrin.h
avx512cdintrin.h
avx512vpopcntdqintrin.h
avx512dqintrin.h
avx512erintrin.h
avx512fintrin.h
avx512ifmaintrin.h
avx512ifmavlintrin.h
avx512pfintrin.h
avx512vbmiintrin.h
avx512vbmivlintrin.h
avx512vbmi2intrin.h
avx512vlvbmi2intrin.h
avx512vlbf16intrin.h
avx512vlbwintrin.h
avx512vlcdintrin.h
avx512vldqintrin.h
avx512vlintrin.h
avx512vp2intersectintrin.h
avx512vlvp2intersectintrin.h
avx512vpopcntdqvlintrin.h
avx512vnniintrin.h
avx512vlvnniintrin.h
avxintrin.h
bmi2intrin.h
bmiintrin.h
__clang_cuda_builtin_vars.h
__clang_cuda_math.h
__clang_cuda_cmath.h
__clang_cuda_complex_builtins.h
__clang_cuda_device_functions.h
__clang_cuda_intrinsics.h
__clang_cuda_libdevice_declares.h
__clang_cuda_math_forward_declares.h
__clang_cuda_runtime_wrapper.h
__clang_hip_libdevice_declares.h
__clang_hip_math.h
__clang_hip_runtime_wrapper.h
cetintrin.h
cet.h
cldemoteintrin.h
clzerointrin.h
cpuid.h
clflushoptintrin.h
clwbintrin.h
emmintrin.h
enqcmdintrin.h
f16cintrin.h
float.h
fma4intrin.h
fmaintrin.h
fxsrintrin.h
gfniintrin.h
htmintrin.h
htmxlintrin.h
ia32intrin.h
immintrin.h
intrin.h
inttypes.h
invpcidintrin.h
iso646.h
keylockerintrin.h
limits.h
lwpintrin.h
lzcntintrin.h
mm3dnow.h
mmintrin.h
mm_malloc.h
module.modulemap
movdirintrin.h
msa.h
mwaitxintrin.h
nmmintrin.h
opencl-c.h
opencl-c-base.h
pkuintrin.h
pmmintrin.h
pconfigintrin.h
popcntintrin.h
prfchwintrin.h
ptwriteintrin.h
rdseedintrin.h
rtmintrin.h
serializeintrin.h
sgxintrin.h
s390intrin.h
shaintrin.h
smmintrin.h
stdalign.h
stdarg.h
stdatomic.h
stdbool.h
stddef.h
__stddef_max_align_t.h
stdint.h
stdnoreturn.h
tbmintrin.h
tgmath.h
tmmintrin.h
tsxldtrkintrin.h
unwind.h
vadefs.h
vaesintrin.h
varargs.h
vecintrin.h
vpclmulqdqintrin.h
waitpkgintrin.h
wasm_simd128.h
wbnoinvdintrin.h
wmmintrin.h
__wmmintrin_aes.h
__wmmintrin_pclmul.h
x86intrin.h
xmmintrin.h
xopintrin.h
xsavecintrin.h
xsaveintrin.h
xsaveoptintrin.h
xsavesintrin.h
xtestintrin.h
)
set(cuda_wrapper_files
cuda_wrappers/algorithm
cuda_wrappers/complex
cuda_wrappers/new
)
set(ppc_wrapper_files
ppc_wrappers/mmintrin.h
ppc_wrappers/xmmintrin.h
ppc_wrappers/mm_malloc.h
ppc_wrappers/emmintrin.h
ppc_wrappers/pmmintrin.h
ppc_wrappers/tmmintrin.h
ppc_wrappers/smmintrin.h
)
set(openmp_wrapper_files
openmp_wrappers/math.h
openmp_wrappers/cmath
openmp_wrappers/complex.h
openmp_wrappers/complex
openmp_wrappers/__clang_openmp_device_functions.h
openmp_wrappers/complex_cmath.h
openmp_wrappers/new
)
set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
set(out_files)
set(generated_files)
function(copy_header_to_output_dir src_dir file)
set(src ${src_dir}/${file})
set(dst ${output_dir}/${file})
add_custom_command(OUTPUT ${dst}
DEPENDS ${src}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
COMMENT "Copying clang's ${file}...")
list(APPEND out_files ${dst})
set(out_files ${out_files} PARENT_SCOPE)
endfunction(copy_header_to_output_dir)
function(clang_generate_header td_option td_file out_file)
clang_tablegen(${out_file} ${td_option}
-I ${CLANG_SOURCE_DIR}/include/clang/Basic/
SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/${td_file})
copy_header_to_output_dir(${CMAKE_CURRENT_BINARY_DIR} ${out_file})
set(out_files ${out_files} PARENT_SCOPE)
list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${out_file}")
set(generated_files ${generated_files} PARENT_SCOPE)
endfunction(clang_generate_header)
# Copy header files from the source directory to the build directory
foreach( f ${files} ${cuda_wrapper_files} ${ppc_wrapper_files} ${openmp_wrapper_files})
copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR} ${f})
endforeach( f )
# Generate header files and copy them to the build directory
# Generate arm_neon.h
clang_generate_header(-gen-arm-neon arm_neon.td arm_neon.h)
# Generate arm_fp16.h
clang_generate_header(-gen-arm-fp16 arm_fp16.td arm_fp16.h)
# Generate arm_sve.h
clang_generate_header(-gen-arm-sve-header arm_sve.td arm_sve.h)
# Generate arm_bf16.h
clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
# Generate arm_mve.h
clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
# Generate arm_cde.h
clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
add_custom_target(clang-resource-headers ALL DEPENDS ${out_files})
set_target_properties(clang-resource-headers PROPERTIES
FOLDER "Misc"
RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
install(
FILES ${files} ${generated_files}
DESTINATION ${header_install_dir}
COMPONENT clang-resource-headers)
install(
FILES ${cuda_wrapper_files}
DESTINATION ${header_install_dir}/cuda_wrappers
COMPONENT clang-resource-headers)
install(
FILES ${ppc_wrapper_files}
DESTINATION ${header_install_dir}/ppc_wrappers
COMPONENT clang-resource-headers)
install(
FILES ${openmp_wrapper_files}
DESTINATION ${header_install_dir}/openmp_wrappers
COMPONENT clang-resource-headers)
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-clang-resource-headers
DEPENDS clang-resource-headers
COMPONENT clang-resource-headers)
endif()