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.
13 __stdarg___gnuc_va_list.h
22 __stddef_max_align_t.h
29 __stddef_unreachable.h
40 # Headers shared by Arm and AArch64
49 set(aarch64_only_files
55 __clang_cuda_builtin_vars.h
58 __clang_cuda_complex_builtins.h
59 __clang_cuda_device_functions.h
60 __clang_cuda_intrinsics.h
61 __clang_cuda_texture_intrinsics.h
62 __clang_cuda_libdevice_declares.h
63 __clang_cuda_math_forward_declares.h
64 __clang_cuda_runtime_wrapper.h
68 hexagon_circ_brev_intrinsics.h
75 __clang_hip_libdevice_declares.h
79 __clang_hip_runtime_wrapper.h
86 hlsl/hlsl_basic_types.h
87 hlsl/hlsl_intrinsics.h
136 set(webassembly_files
164 avx512vlbitalgintrin.h
170 avx512vlvbmi2intrin.h
172 avx512vlvp2intersectintrin.h
174 avx512vp2intersectintrin.h
175 avx512vpopcntdqintrin.h
176 avx512vpopcntdqvlintrin.h
255 set(windows_only_files
268 ${aarch64_only_files}
282 ${windows_only_files}
286 set(cuda_wrapper_files
287 cuda_wrappers/algorithm
289 cuda_wrappers/complex
293 set(cuda_wrapper_bits_files
294 cuda_wrappers/bits/shared_ptr_base.h
295 cuda_wrappers/bits/basic_string.h
296 cuda_wrappers/bits/basic_string.tcc
299 set(ppc_wrapper_files
300 ppc_wrappers/mmintrin.h
301 ppc_wrappers/xmmintrin.h
302 ppc_wrappers/mm_malloc.h
303 ppc_wrappers/emmintrin.h
304 ppc_wrappers/pmmintrin.h
305 ppc_wrappers/tmmintrin.h
306 ppc_wrappers/smmintrin.h
307 ppc_wrappers/nmmintrin.h
308 ppc_wrappers/bmiintrin.h
309 ppc_wrappers/bmi2intrin.h
310 ppc_wrappers/immintrin.h
311 ppc_wrappers/x86intrin.h
312 ppc_wrappers/x86gprintrin.h
315 set(openmp_wrapper_files
316 openmp_wrappers/math.h
317 openmp_wrappers/cmath
318 openmp_wrappers/complex.h
319 openmp_wrappers/complex
320 openmp_wrappers/__clang_openmp_device_functions.h
321 openmp_wrappers/complex_cmath.h
325 set(llvm_libc_wrapper_files
326 llvm_libc_wrappers/assert.h
327 llvm_libc_wrappers/stdio.h
328 llvm_libc_wrappers/stdlib.h
329 llvm_libc_wrappers/string.h
330 llvm_libc_wrappers/ctype.h
331 llvm_libc_wrappers/inttypes.h
332 llvm_libc_wrappers/time.h
335 include(GetClangResourceDir)
336 get_clang_resource_dir(output_dir PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. SUBDIR include)
340 set(arm_common_generated_files)
341 set(arm_only_generated_files)
342 set(aarch64_only_generated_files)
343 set(riscv_generated_files)
345 function(copy_header_to_output_dir src_dir file)
346 set(src ${src_dir}/${file})
347 set(dst ${output_dir}/${file})
348 add_custom_command(OUTPUT ${dst}
350 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
351 COMMENT "Copying clang's ${file}...")
352 list(APPEND out_files ${dst})
353 set(out_files ${out_files} PARENT_SCOPE)
354 endfunction(copy_header_to_output_dir)
356 function(clang_generate_header td_option td_file out_file)
357 clang_tablegen(${out_file} ${td_option}
358 -I ${CLANG_SOURCE_DIR}/include/clang/Basic/
359 SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/${td_file})
361 copy_header_to_output_dir(${CMAKE_CURRENT_BINARY_DIR} ${out_file})
362 set(out_files ${out_files} PARENT_SCOPE)
363 list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${out_file}")
364 set(generated_files ${generated_files} PARENT_SCOPE)
365 endfunction(clang_generate_header)
368 # Copy header files from the source directory to the build directory
369 foreach( f ${files} ${cuda_wrapper_files} ${cuda_wrapper_bits_files}
370 ${ppc_wrapper_files} ${openmp_wrapper_files} ${hlsl_files}
371 ${llvm_libc_wrapper_files})
372 copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR} ${f})
375 # Generate header files and copy them to the build directory
376 if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST LLVM_TARGETS_TO_BUILD)
377 # Generate arm_neon.h
378 clang_generate_header(-gen-arm-neon arm_neon.td arm_neon.h)
379 # Generate arm_fp16.h
380 clang_generate_header(-gen-arm-fp16 arm_fp16.td arm_fp16.h)
382 clang_generate_header(-gen-arm-sve-header arm_sve.td arm_sve.h)
383 # Generate arm_sme_draft_spec_subject_to_change.h
384 clang_generate_header(-gen-arm-sme-header arm_sme.td arm_sme_draft_spec_subject_to_change.h)
385 # Generate arm_bf16.h
386 clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
388 clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
390 clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
391 # Generate arm_vector_types.h
392 clang_generate_header(-gen-arm-vector-type arm_neon.td arm_vector_types.h)
394 # Add headers to target specific lists
395 list(APPEND arm_common_generated_files
396 "${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h"
397 "${CMAKE_CURRENT_BINARY_DIR}/arm_fp16.h"
400 list(APPEND arm_only_generated_files
401 "${CMAKE_CURRENT_BINARY_DIR}/arm_mve.h"
402 "${CMAKE_CURRENT_BINARY_DIR}/arm_cde.h"
405 list(APPEND aarch64_only_generated_files
406 "${CMAKE_CURRENT_BINARY_DIR}/arm_sve.h"
407 "${CMAKE_CURRENT_BINARY_DIR}/arm_sme_draft_spec_subject_to_change.h"
408 "${CMAKE_CURRENT_BINARY_DIR}/arm_bf16.h"
409 "${CMAKE_CURRENT_BINARY_DIR}/arm_vector_types.h"
412 if(RISCV IN_LIST LLVM_TARGETS_TO_BUILD)
413 # Generate riscv_vector.h
414 clang_generate_header(-gen-riscv-vector-header riscv_vector.td riscv_vector.h)
415 list(APPEND riscv_generated_files
416 "${CMAKE_CURRENT_BINARY_DIR}/riscv_vector.h"
421 # Check if the generated headers are included in a target specific lists
422 # Currently, all generated headers are target specific.
423 set(all_target_specific_generated_files
424 ${arm_common_generated_files}
425 ${arm_only_generated_files}
426 ${aarch64_only_generated_files}
427 ${riscv_generated_files})
428 foreach( f ${generated_files} )
429 if (NOT ${f} IN_LIST all_target_specific_generated_files)
430 message(WARNING "${f} is a generated header but it is not included in any "
431 "target specific header lists! The resource-headers "
432 "distribtion target will be incorrect!")
436 function(add_header_target target_name file_list)
437 add_custom_target(${target_name} DEPENDS ${file_list})
438 set_target_properties(${target_name} PROPERTIES
440 RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
443 # The catch-all clang-resource-headers target
444 add_custom_target("clang-resource-headers" ALL DEPENDS ${out_files})
445 set_target_properties("clang-resource-headers" PROPERTIES
447 RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
448 add_dependencies("clang-resource-headers"
449 "core-resource-headers"
450 "arm-common-resource-headers"
451 "arm-resource-headers"
452 "aarch64-resource-headers"
453 "cuda-resource-headers"
454 "hexagon-resource-headers"
455 "hip-resource-headers"
456 "hlsl-resource-headers"
457 "loongarch-resource-headers"
458 "mips-resource-headers"
459 "ppc-resource-headers"
460 "ppc-htm-resource-headers"
461 "riscv-resource-headers"
462 "systemz-resource-headers"
463 "ve-resource-headers"
464 "webassembly-resource-headers"
465 "x86-resource-headers"
466 "opencl-resource-headers"
467 "openmp-resource-headers"
468 "llvm-libc-resource-headers"
469 "windows-resource-headers"
470 "utility-resource-headers")
472 # Core/common headers
473 add_header_target("core-resource-headers" ${core_files})
474 add_header_target("arm-common-resource-headers" "${arm_common_files};${arm_common_generated_files}")
476 # Architecture/platform specific targets
477 add_header_target("arm-resource-headers" "${arm_only_files};${arm_only_generated_files}")
478 add_header_target("aarch64-resource-headers" "${aarch64_only_files};${aarch64_only_generated_files}")
479 add_header_target("cuda-resource-headers" "${cuda_files};${cuda_wrapper_files};${cuda_wrapper_bits_files}")
480 add_header_target("hexagon-resource-headers" "${hexagon_files}")
481 add_header_target("hip-resource-headers" "${hip_files}")
482 add_header_target("loongarch-resource-headers" "${loongarch_files}")
483 add_header_target("mips-resource-headers" "${mips_msa_files}")
484 add_header_target("ppc-resource-headers" "${ppc_files};${ppc_wrapper_files}")
485 add_header_target("ppc-htm-resource-headers" "${ppc_htm_files}")
486 add_header_target("riscv-resource-headers" "${riscv_files};${riscv_generated_files}")
487 add_header_target("systemz-resource-headers" "${systemz_files}")
488 add_header_target("ve-resource-headers" "${ve_files}")
489 add_header_target("webassembly-resource-headers" "${webassembly_files}")
490 add_header_target("x86-resource-headers" "${x86_files}")
492 # Other header groupings
493 add_header_target("hlsl-resource-headers" ${hlsl_files})
494 add_header_target("opencl-resource-headers" ${opencl_files})
495 add_header_target("llvm-libc-resource-headers" ${llvm_libc_wrapper_files})
496 add_header_target("openmp-resource-headers" ${openmp_wrapper_files})
497 add_header_target("windows-resource-headers" ${windows_only_files})
498 add_header_target("utility-resource-headers" ${utility_files})
500 get_clang_resource_dir(header_install_dir SUBDIR include)
502 #############################################################
503 # Install rules for the catch-all clang-resource-headers target
505 FILES ${files} ${generated_files}
506 DESTINATION ${header_install_dir}
507 COMPONENT clang-resource-headers)
510 FILES ${cuda_wrapper_files}
511 DESTINATION ${header_install_dir}/cuda_wrappers
512 COMPONENT clang-resource-headers)
515 FILES ${cuda_wrapper_bits_files}
516 DESTINATION ${header_install_dir}/cuda_wrappers/bits
517 COMPONENT clang-resource-headers)
520 FILES ${ppc_wrapper_files}
521 DESTINATION ${header_install_dir}/ppc_wrappers
522 COMPONENT clang-resource-headers)
525 FILES ${llvm_libc_wrapper_files}
526 DESTINATION ${header_install_dir}/llvm_libc_wrappers
527 COMPONENT clang-resource-headers)
530 FILES ${openmp_wrapper_files}
531 DESTINATION ${header_install_dir}/openmp_wrappers
532 COMPONENT clang-resource-headers)
534 #############################################################
535 # Install rules for separate header lists
538 DESTINATION ${header_install_dir}
540 COMPONENT core-resource-headers)
543 FILES ${arm_common_files} ${arm_common_generated_files}
544 DESTINATION ${header_install_dir}
546 COMPONENT arm-common-resource-headers)
549 FILES ${arm_only_files} ${arm_only_generated_files}
550 DESTINATION ${header_install_dir}
552 COMPONENT arm-resource-headers)
555 FILES ${aarch64_only_files} ${aarch64_only_generated_files}
556 DESTINATION ${header_install_dir}
558 COMPONENT aarch64-resource-headers)
561 FILES ${cuda_wrapper_files}
562 DESTINATION ${header_install_dir}/cuda_wrappers
564 COMPONENT cuda-resource-headers)
567 FILES ${cuda_wrapper_bits_files}
568 DESTINATION ${header_install_dir}/cuda_wrappers/bits
570 COMPONENT cuda-resource-headers)
574 DESTINATION ${header_install_dir}
576 COMPONENT cuda-resource-headers)
579 FILES ${hexagon_files}
580 DESTINATION ${header_install_dir}
582 COMPONENT hexagon-resource-headers)
586 DESTINATION ${header_install_dir}
588 COMPONENT hip-resource-headers)
591 FILES ${loongarch_files}
592 DESTINATION ${header_install_dir}
594 COMPONENT loongarch-resource-headers)
597 FILES ${mips_msa_files}
598 DESTINATION ${header_install_dir}
600 COMPONENT mips-resource-headers)
603 FILES ${ppc_wrapper_files}
604 DESTINATION ${header_install_dir}/ppc_wrappers
606 COMPONENT ppc-resource-headers)
610 DESTINATION ${header_install_dir}
612 COMPONENT ppc-resource-headers)
615 FILES ${ppc_htm_files}
616 DESTINATION ${header_install_dir}
618 COMPONENT ppc-htm-resource-headers)
621 FILES ${riscv_generated_files}
622 DESTINATION ${header_install_dir}
624 COMPONENT riscv-resource-headers)
628 DESTINATION ${header_install_dir}
630 COMPONENT riscv-resource-headers)
633 FILES ${systemz_files}
634 DESTINATION ${header_install_dir}
636 COMPONENT systemz-resource-headers)
640 DESTINATION ${header_install_dir}
642 COMPONENT ve-resource-headers)
645 FILES ${webassembly_files}
646 DESTINATION ${header_install_dir}
648 COMPONENT webassembly-resource-headers)
652 DESTINATION ${header_install_dir}
654 COMPONENT x86-resource-headers)
656 if(NOT CLANG_ENABLE_HLSL)
657 set(EXCLUDE_HLSL EXCLUDE_FROM_ALL)
662 DESTINATION ${header_install_dir}
664 COMPONENT hlsl-resource-headers)
667 FILES ${hlsl_subdir_files}
668 DESTINATION ${header_install_dir}/hlsl
670 COMPONENT hlsl-resource-headers)
673 FILES ${opencl_files}
674 DESTINATION ${header_install_dir}
676 COMPONENT opencl-resource-headers)
679 FILES ${openmp_wrapper_files}
680 DESTINATION ${header_install_dir}/openmp_wrappers
682 COMPONENT openmp-resource-headers)
685 FILES ${openmp_wrapper_files}
686 DESTINATION ${header_install_dir}/openmp_wrappers
688 COMPONENT openmp-resource-headers)
691 FILES ${utility_files}
692 DESTINATION ${header_install_dir}
694 COMPONENT utility-resource-headers)
697 FILES ${windows_only_files}
698 DESTINATION ${header_install_dir}
700 COMPONENT windows-resource-headers)
701 #############################################################
703 if (NOT LLVM_ENABLE_IDE)
704 add_llvm_install_targets(install-clang-resource-headers
705 DEPENDS clang-resource-headers
706 COMPONENT clang-resource-headers)
708 add_llvm_install_targets(install-core-resource-headers
709 DEPENDS core-resource-headers
710 COMPONENT core-resource-headers)
711 add_llvm_install_targets(install-arm-common-resource-headers
712 DEPENDS arm-common-resource-headers
713 COMPONENT arm-common-resource-headers)
714 add_llvm_install_targets(install-arm-resource-headers
715 DEPENDS arm-resource-headers
716 COMPONENT arm-resource-headers)
717 add_llvm_install_targets(install-aarch64-resource-headers
718 DEPENDS aarch64-resource-headers
719 COMPONENT aarch64-resource-headers)
720 add_llvm_install_targets(install-cuda-resource-headers
721 DEPENDS cuda-resource-headers
722 COMPONENT cuda-resource-headers)
723 add_llvm_install_targets(install-hexagon-resource-headers
724 DEPENDS hexagon-resource-headers
725 COMPONENT hexagon-resource-headers)
726 add_llvm_install_targets(install-hip-resource-headers
727 DEPENDS hip-resource-headers
728 COMPONENT hip-resource-headers)
729 add_llvm_install_targets(install-mips-resource-headers
730 DEPENDS mips-resource-headers
731 COMPONENT mips-resource-headers)
732 add_llvm_install_targets(install-ppc-resource-headers
733 DEPENDS ppc-resource-headers
734 COMPONENT ppc-resource-headers)
735 add_llvm_install_targets(install-ppc-htm-resource-headers
736 DEPENDS ppc-htm-resource-headers
737 COMPONENT ppc-htm-resource-headers)
738 add_llvm_install_targets(install-riscv-resource-headers
739 DEPENDS riscv-resource-headers
740 COMPONENT riscv-resource-headers)
741 add_llvm_install_targets(install-systemz-resource-headers
742 DEPENDS systemz-resource-headers
743 COMPONENT systemz-resource-headers)
744 add_llvm_install_targets(install-ve-resource-headers
745 DEPENDS ve-resource-headers
746 COMPONENT ve-resource-headers)
747 add_llvm_install_targets(install-x86-resource-headers
748 DEPENDS x86-resource-headers
749 COMPONENT x86-resource-headers)
750 add_llvm_install_targets(install-webassembly-resource-headers
751 DEPENDS webassembly-resource-headers
752 COMPONENT webassembly-resource-headers)
754 add_llvm_install_targets(install-hlsl-resource-headers
755 DEPENDS hlsl-resource-headers
756 COMPONENT hlsl-resource-headers)
757 add_llvm_install_targets(install-opencl-resource-headers
758 DEPENDS opencl-resource-headers
759 COMPONENT opencl-resource-headers)
760 add_llvm_install_targets(install-openmp-resource-headers
761 DEPENDS openmp-resource-headers
762 COMPONENT openmp-resource-headers)
763 add_llvm_install_targets(install-windows-resource-headers
764 DEPENDS windows-resource-headers
765 COMPONENT windows-resource-headers)
766 add_llvm_install_targets(install-utility-resource-headers
767 DEPENDS utility-resource-headers
768 COMPONENT utility-resource-headers)
771 source_group("Clang Runtime Headers" FILES ${files})