1 # core_files list contains the headers shared by all platforms.
2 # Please consider adding new platform specific headers
3 # to platform specific lists below.
16 __stddef_max_align_t.h
25 # Headers shared by Arm and AArch64
34 set(aarch64_only_files
40 __clang_cuda_builtin_vars.h
43 __clang_cuda_complex_builtins.h
44 __clang_cuda_device_functions.h
45 __clang_cuda_intrinsics.h
46 __clang_cuda_texture_intrinsics.h
47 __clang_cuda_libdevice_declares.h
48 __clang_cuda_math_forward_declares.h
49 __clang_cuda_runtime_wrapper.h
53 hexagon_circ_brev_intrinsics.h
60 __clang_hip_libdevice_declares.h
64 __clang_hip_runtime_wrapper.h
71 hlsl/hlsl_basic_types.h
72 hlsl/hlsl_intrinsics.h
120 set(webassembly_files
147 avx512vlbitalgintrin.h
153 avx512vlvbmi2intrin.h
155 avx512vlvp2intersectintrin.h
157 avx512vp2intersectintrin.h
158 avx512vpopcntdqintrin.h
159 avx512vpopcntdqvlintrin.h
233 set(windows_only_files
246 ${aarch64_only_files}
261 ${windows_only_files}
265 set(cuda_wrapper_files
266 cuda_wrappers/algorithm
268 cuda_wrappers/complex
272 set(cuda_wrapper_bits_files
273 cuda_wrappers/bits/shared_ptr_base.h
276 set(ppc_wrapper_files
277 ppc_wrappers/mmintrin.h
278 ppc_wrappers/xmmintrin.h
279 ppc_wrappers/mm_malloc.h
280 ppc_wrappers/emmintrin.h
281 ppc_wrappers/pmmintrin.h
282 ppc_wrappers/tmmintrin.h
283 ppc_wrappers/smmintrin.h
284 ppc_wrappers/bmiintrin.h
285 ppc_wrappers/bmi2intrin.h
286 ppc_wrappers/immintrin.h
287 ppc_wrappers/x86intrin.h
288 ppc_wrappers/x86gprintrin.h
291 set(openmp_wrapper_files
292 openmp_wrappers/math.h
293 openmp_wrappers/cmath
294 openmp_wrappers/complex.h
295 openmp_wrappers/complex
296 openmp_wrappers/__clang_openmp_device_functions.h
297 openmp_wrappers/complex_cmath.h
301 include(GetClangResourceDir)
302 get_clang_resource_dir(output_dir PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. SUBDIR include)
306 set(arm_common_generated_files)
307 set(arm_only_generated_files)
308 set(aarch64_only_generated_files)
309 set(riscv_generated_files)
311 function(copy_header_to_output_dir src_dir file)
312 set(src ${src_dir}/${file})
313 set(dst ${output_dir}/${file})
314 add_custom_command(OUTPUT ${dst}
316 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
317 COMMENT "Copying clang's ${file}...")
318 list(APPEND out_files ${dst})
319 set(out_files ${out_files} PARENT_SCOPE)
320 endfunction(copy_header_to_output_dir)
322 function(clang_generate_header td_option td_file out_file)
323 clang_tablegen(${out_file} ${td_option}
324 -I ${CLANG_SOURCE_DIR}/include/clang/Basic/
325 SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/${td_file})
327 copy_header_to_output_dir(${CMAKE_CURRENT_BINARY_DIR} ${out_file})
328 set(out_files ${out_files} PARENT_SCOPE)
329 list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${out_file}")
330 set(generated_files ${generated_files} PARENT_SCOPE)
331 endfunction(clang_generate_header)
334 # Copy header files from the source directory to the build directory
335 foreach( f ${files} ${cuda_wrapper_files} ${cuda_wrapper_bits_files}
336 ${ppc_wrapper_files} ${openmp_wrapper_files} ${hlsl_files})
337 copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR} ${f})
340 # Generate header files and copy them to the build directory
341 if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST LLVM_TARGETS_TO_BUILD)
342 # Generate arm_neon.h
343 clang_generate_header(-gen-arm-neon arm_neon.td arm_neon.h)
344 # Generate arm_fp16.h
345 clang_generate_header(-gen-arm-fp16 arm_fp16.td arm_fp16.h)
347 clang_generate_header(-gen-arm-sve-header arm_sve.td arm_sve.h)
348 # Generate arm_sme_draft_spec_subject_to_change.h
349 clang_generate_header(-gen-arm-sme-header arm_sme.td arm_sme_draft_spec_subject_to_change.h)
350 # Generate arm_bf16.h
351 clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
353 clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
355 clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
357 # Add headers to target specific lists
358 list(APPEND arm_common_generated_files
359 "${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h"
360 "${CMAKE_CURRENT_BINARY_DIR}/arm_fp16.h"
363 list(APPEND arm_only_generated_files
364 "${CMAKE_CURRENT_BINARY_DIR}/arm_mve.h"
365 "${CMAKE_CURRENT_BINARY_DIR}/arm_cde.h"
368 list(APPEND aarch64_only_generated_files
369 "${CMAKE_CURRENT_BINARY_DIR}/arm_sve.h"
370 "${CMAKE_CURRENT_BINARY_DIR}/arm_sme_draft_spec_subject_to_change.h"
371 "${CMAKE_CURRENT_BINARY_DIR}/arm_bf16.h"
374 if(RISCV IN_LIST LLVM_TARGETS_TO_BUILD)
375 # Generate riscv_vector.h
376 clang_generate_header(-gen-riscv-vector-header riscv_vector.td riscv_vector.h)
377 list(APPEND riscv_generated_files
378 "${CMAKE_CURRENT_BINARY_DIR}/riscv_vector.h"
383 # Check if the generated headers are included in a target specific lists
384 # Currently, all generated headers are target specific.
385 set(all_target_specific_generated_files
386 ${arm_common_generated_files}
387 ${arm_only_generated_files}
388 ${aarch64_only_generated_files}
389 ${riscv_generated_files})
390 foreach( f ${generated_files} )
391 if (NOT ${f} IN_LIST all_target_specific_generated_files)
392 message(WARNING "${f} is a generated header but it is not included in any "
393 "target specific header lists! The resource-headers "
394 "distribtion target will be incorrect!")
398 function(add_header_target target_name file_list)
399 add_custom_target(${target_name} DEPENDS ${file_list})
400 set_target_properties(${target_name} PROPERTIES
402 RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
405 # The catch-all clang-resource-headers target
406 add_custom_target("clang-resource-headers" ALL DEPENDS ${out_files})
407 set_target_properties("clang-resource-headers" PROPERTIES
409 RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
410 add_dependencies("clang-resource-headers"
411 "core-resource-headers"
412 "arm-common-resource-headers"
413 "arm-resource-headers"
414 "aarch64-resource-headers"
415 "cuda-resource-headers"
416 "hexagon-resource-headers"
417 "hip-resource-headers"
418 "hlsl-resource-headers"
419 "loongarch-resource-headers"
420 "mips-resource-headers"
421 "ppc-resource-headers"
422 "ppc-htm-resource-headers"
423 "riscv-resource-headers"
424 "systemz-resource-headers"
425 "ve-resource-headers"
426 "webassembly-resource-headers"
427 "x86-resource-headers"
428 "opencl-resource-headers"
429 "openmp-resource-headers"
430 "windows-resource-headers"
431 "utility-resource-headers")
433 # Core/common headers
434 add_header_target("core-resource-headers" ${core_files})
435 add_header_target("arm-common-resource-headers" "${arm_common_files};${arm_common_generated_files}")
437 # Architecture/platform specific targets
438 add_header_target("arm-resource-headers" "${arm_only_files};${arm_only_generated_files}")
439 add_header_target("aarch64-resource-headers" "${aarch64_only_files};${aarch64_only_generated_files}")
440 add_header_target("cuda-resource-headers" "${cuda_files};${cuda_wrapper_files};${cuda_wrapper_bits_files}")
441 add_header_target("hexagon-resource-headers" "${hexagon_files}")
442 add_header_target("hip-resource-headers" "${hip_files}")
443 add_header_target("loongarch-resource-headers" "${loongarch_files}")
444 add_header_target("mips-resource-headers" "${mips_msa_files}")
445 add_header_target("ppc-resource-headers" "${ppc_files};${ppc_wrapper_files}")
446 add_header_target("ppc-htm-resource-headers" "${ppc_htm_files}")
447 add_header_target("riscv-resource-headers" "${riscv_files};${riscv_generated_files}")
448 add_header_target("systemz-resource-headers" "${systemz_files}")
449 add_header_target("ve-resource-headers" "${ve_files}")
450 add_header_target("webassembly-resource-headers" "${webassembly_files}")
451 add_header_target("x86-resource-headers" "${x86_files}")
453 # Other header groupings
454 add_header_target("hlsl-resource-headers" ${hlsl_files})
455 add_header_target("opencl-resource-headers" ${opencl_files})
456 add_header_target("openmp-resource-headers" ${openmp_wrapper_files})
457 add_header_target("windows-resource-headers" ${windows_only_files})
458 add_header_target("utility-resource-headers" ${utility_files})
460 get_clang_resource_dir(header_install_dir SUBDIR include)
462 #############################################################
463 # Install rules for the catch-all clang-resource-headers target
465 FILES ${files} ${generated_files}
466 DESTINATION ${header_install_dir}
467 COMPONENT clang-resource-headers)
470 FILES ${cuda_wrapper_files}
471 DESTINATION ${header_install_dir}/cuda_wrappers
472 COMPONENT clang-resource-headers)
475 FILES ${cuda_wrapper_bits_files}
476 DESTINATION ${header_install_dir}/cuda_wrappers/bits
477 COMPONENT clang-resource-headers)
480 FILES ${ppc_wrapper_files}
481 DESTINATION ${header_install_dir}/ppc_wrappers
482 COMPONENT clang-resource-headers)
485 FILES ${openmp_wrapper_files}
486 DESTINATION ${header_install_dir}/openmp_wrappers
487 COMPONENT clang-resource-headers)
489 #############################################################
490 # Install rules for separate header lists
493 DESTINATION ${header_install_dir}
495 COMPONENT core-resource-headers)
498 FILES ${arm_common_files} ${arm_common_generated_files}
499 DESTINATION ${header_install_dir}
501 COMPONENT arm-common-resource-headers)
504 FILES ${arm_only_files} ${arm_only_generated_files}
505 DESTINATION ${header_install_dir}
507 COMPONENT arm-resource-headers)
510 FILES ${aarch64_only_files} ${aarch64_only_generated_files}
511 DESTINATION ${header_install_dir}
513 COMPONENT aarch64-resource-headers)
516 FILES ${cuda_wrapper_files}
517 DESTINATION ${header_install_dir}/cuda_wrappers
519 COMPONENT cuda-resource-headers)
522 FILES ${cuda_wrapper_bits_files}
523 DESTINATION ${header_install_dir}/cuda_wrappers/bits
525 COMPONENT cuda-resource-headers)
529 DESTINATION ${header_install_dir}
531 COMPONENT cuda-resource-headers)
534 FILES ${hexagon_files}
535 DESTINATION ${header_install_dir}
537 COMPONENT hexagon-resource-headers)
541 DESTINATION ${header_install_dir}
543 COMPONENT hip-resource-headers)
546 FILES ${loongarch_files}
547 DESTINATION ${header_install_dir}
549 COMPONENT loongarch-resource-headers)
552 FILES ${mips_msa_files}
553 DESTINATION ${header_install_dir}
555 COMPONENT mips-resource-headers)
558 FILES ${ppc_wrapper_files}
559 DESTINATION ${header_install_dir}/ppc_wrappers
561 COMPONENT ppc-resource-headers)
565 DESTINATION ${header_install_dir}
567 COMPONENT ppc-resource-headers)
570 FILES ${ppc_htm_files}
571 DESTINATION ${header_install_dir}
573 COMPONENT ppc-htm-resource-headers)
576 FILES ${riscv_generated_files}
577 DESTINATION ${header_install_dir}
579 COMPONENT riscv-resource-headers)
583 DESTINATION ${header_install_dir}
585 COMPONENT riscv-resource-headers)
588 FILES ${systemz_files}
589 DESTINATION ${header_install_dir}
591 COMPONENT systemz-resource-headers)
595 DESTINATION ${header_install_dir}
597 COMPONENT ve-resource-headers)
600 FILES ${webassembly_files}
601 DESTINATION ${header_install_dir}
603 COMPONENT webassembly-resource-headers)
607 DESTINATION ${header_install_dir}
609 COMPONENT x86-resource-headers)
611 if(NOT CLANG_ENABLE_HLSL)
612 set(EXCLUDE_HLSL EXCLUDE_FROM_ALL)
617 DESTINATION ${header_install_dir}
619 COMPONENT hlsl-resource-headers)
622 FILES ${hlsl_subdir_files}
623 DESTINATION ${header_install_dir}/hlsl
625 COMPONENT hlsl-resource-headers)
628 FILES ${opencl_files}
629 DESTINATION ${header_install_dir}
631 COMPONENT opencl-resource-headers)
634 FILES ${openmp_wrapper_files}
635 DESTINATION ${header_install_dir}/openmp_wrappers
637 COMPONENT openmp-resource-headers)
640 FILES ${utility_files}
641 DESTINATION ${header_install_dir}
643 COMPONENT utility-resource-headers)
646 FILES ${windows_only_files}
647 DESTINATION ${header_install_dir}
649 COMPONENT windows-resource-headers)
650 #############################################################
652 if (NOT LLVM_ENABLE_IDE)
653 add_llvm_install_targets(install-clang-resource-headers
654 DEPENDS clang-resource-headers
655 COMPONENT clang-resource-headers)
657 add_llvm_install_targets(install-core-resource-headers
658 DEPENDS core-resource-headers
659 COMPONENT core-resource-headers)
660 add_llvm_install_targets(install-arm-common-resource-headers
661 DEPENDS arm-common-resource-headers
662 COMPONENT arm-common-resource-headers)
663 add_llvm_install_targets(install-arm-resource-headers
664 DEPENDS arm-resource-headers
665 COMPONENT arm-resource-headers)
666 add_llvm_install_targets(install-aarch64-resource-headers
667 DEPENDS aarch64-resource-headers
668 COMPONENT aarch64-resource-headers)
669 add_llvm_install_targets(install-cuda-resource-headers
670 DEPENDS cuda-resource-headers
671 COMPONENT cuda-resource-headers)
672 add_llvm_install_targets(install-hexagon-resource-headers
673 DEPENDS hexagon-resource-headers
674 COMPONENT hexagon-resource-headers)
675 add_llvm_install_targets(install-hip-resource-headers
676 DEPENDS hip-resource-headers
677 COMPONENT hip-resource-headers)
678 add_llvm_install_targets(install-mips-resource-headers
679 DEPENDS mips-resource-headers
680 COMPONENT mips-resource-headers)
681 add_llvm_install_targets(install-ppc-resource-headers
682 DEPENDS ppc-resource-headers
683 COMPONENT ppc-resource-headers)
684 add_llvm_install_targets(install-ppc-htm-resource-headers
685 DEPENDS ppc-htm-resource-headers
686 COMPONENT ppc-htm-resource-headers)
687 add_llvm_install_targets(install-riscv-resource-headers
688 DEPENDS riscv-resource-headers
689 COMPONENT riscv-resource-headers)
690 add_llvm_install_targets(install-systemz-resource-headers
691 DEPENDS systemz-resource-headers
692 COMPONENT systemz-resource-headers)
693 add_llvm_install_targets(install-ve-resource-headers
694 DEPENDS ve-resource-headers
695 COMPONENT ve-resource-headers)
696 add_llvm_install_targets(install-x86-resource-headers
697 DEPENDS x86-resource-headers
698 COMPONENT x86-resource-headers)
699 add_llvm_install_targets(install-webassembly-resource-headers
700 DEPENDS webassembly-resource-headers
701 COMPONENT webassembly-resource-headers)
703 add_llvm_install_targets(install-hlsl-resource-headers
704 DEPENDS hlsl-resource-headers
705 COMPONENT hlsl-resource-headers)
706 add_llvm_install_targets(install-opencl-resource-headers
707 DEPENDS opencl-resource-headers
708 COMPONENT opencl-resource-headers)
709 add_llvm_install_targets(install-openmp-resource-headers
710 DEPENDS openmp-resource-headers
711 COMPONENT openmp-resource-headers)
712 add_llvm_install_targets(install-windows-resource-headers
713 DEPENDS windows-resource-headers
714 COMPONENT windows-resource-headers)
715 add_llvm_install_targets(install-utility-resource-headers
716 DEPENDS utility-resource-headers
717 COMPONENT utility-resource-headers)
720 source_group("Clang Runtime Headers" FILES ${files})