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
134 set(webassembly_files
161 avx512vlbitalgintrin.h
167 avx512vlvbmi2intrin.h
169 avx512vlvp2intersectintrin.h
171 avx512vp2intersectintrin.h
172 avx512vpopcntdqintrin.h
173 avx512vpopcntdqvlintrin.h
252 set(windows_only_files
265 ${aarch64_only_files}
279 ${windows_only_files}
283 set(cuda_wrapper_files
284 cuda_wrappers/algorithm
286 cuda_wrappers/complex
290 set(cuda_wrapper_bits_files
291 cuda_wrappers/bits/shared_ptr_base.h
292 cuda_wrappers/bits/basic_string.h
293 cuda_wrappers/bits/basic_string.tcc
296 set(ppc_wrapper_files
297 ppc_wrappers/mmintrin.h
298 ppc_wrappers/xmmintrin.h
299 ppc_wrappers/mm_malloc.h
300 ppc_wrappers/emmintrin.h
301 ppc_wrappers/pmmintrin.h
302 ppc_wrappers/tmmintrin.h
303 ppc_wrappers/smmintrin.h
304 ppc_wrappers/nmmintrin.h
305 ppc_wrappers/bmiintrin.h
306 ppc_wrappers/bmi2intrin.h
307 ppc_wrappers/immintrin.h
308 ppc_wrappers/x86intrin.h
309 ppc_wrappers/x86gprintrin.h
312 set(openmp_wrapper_files
313 openmp_wrappers/math.h
314 openmp_wrappers/cmath
315 openmp_wrappers/complex.h
316 openmp_wrappers/complex
317 openmp_wrappers/__clang_openmp_device_functions.h
318 openmp_wrappers/complex_cmath.h
322 set(llvm_libc_wrapper_files
323 llvm_libc_wrappers/assert.h
324 llvm_libc_wrappers/stdio.h
325 llvm_libc_wrappers/stdlib.h
326 llvm_libc_wrappers/string.h
327 llvm_libc_wrappers/ctype.h
328 llvm_libc_wrappers/inttypes.h
329 llvm_libc_wrappers/time.h
332 include(GetClangResourceDir)
333 get_clang_resource_dir(output_dir PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. SUBDIR include)
337 set(arm_common_generated_files)
338 set(arm_only_generated_files)
339 set(aarch64_only_generated_files)
340 set(riscv_generated_files)
342 function(copy_header_to_output_dir src_dir file)
343 set(src ${src_dir}/${file})
344 set(dst ${output_dir}/${file})
345 add_custom_command(OUTPUT ${dst}
347 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
348 COMMENT "Copying clang's ${file}...")
349 list(APPEND out_files ${dst})
350 set(out_files ${out_files} PARENT_SCOPE)
351 endfunction(copy_header_to_output_dir)
353 function(clang_generate_header td_option td_file out_file)
354 clang_tablegen(${out_file} ${td_option}
355 -I ${CLANG_SOURCE_DIR}/include/clang/Basic/
356 SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/${td_file})
358 copy_header_to_output_dir(${CMAKE_CURRENT_BINARY_DIR} ${out_file})
359 set(out_files ${out_files} PARENT_SCOPE)
360 list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${out_file}")
361 set(generated_files ${generated_files} PARENT_SCOPE)
362 endfunction(clang_generate_header)
365 # Copy header files from the source directory to the build directory
366 foreach( f ${files} ${cuda_wrapper_files} ${cuda_wrapper_bits_files}
367 ${ppc_wrapper_files} ${openmp_wrapper_files} ${hlsl_files}
368 ${llvm_libc_wrapper_files})
369 copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR} ${f})
372 # Generate header files and copy them to the build directory
373 if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST LLVM_TARGETS_TO_BUILD)
374 # Generate arm_neon.h
375 clang_generate_header(-gen-arm-neon arm_neon.td arm_neon.h)
376 # Generate arm_fp16.h
377 clang_generate_header(-gen-arm-fp16 arm_fp16.td arm_fp16.h)
379 clang_generate_header(-gen-arm-sve-header arm_sve.td arm_sve.h)
380 # Generate arm_sme_draft_spec_subject_to_change.h
381 clang_generate_header(-gen-arm-sme-header arm_sme.td arm_sme_draft_spec_subject_to_change.h)
382 # Generate arm_bf16.h
383 clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
385 clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
387 clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
389 # Add headers to target specific lists
390 list(APPEND arm_common_generated_files
391 "${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h"
392 "${CMAKE_CURRENT_BINARY_DIR}/arm_fp16.h"
395 list(APPEND arm_only_generated_files
396 "${CMAKE_CURRENT_BINARY_DIR}/arm_mve.h"
397 "${CMAKE_CURRENT_BINARY_DIR}/arm_cde.h"
400 list(APPEND aarch64_only_generated_files
401 "${CMAKE_CURRENT_BINARY_DIR}/arm_sve.h"
402 "${CMAKE_CURRENT_BINARY_DIR}/arm_sme_draft_spec_subject_to_change.h"
403 "${CMAKE_CURRENT_BINARY_DIR}/arm_bf16.h"
406 if(RISCV IN_LIST LLVM_TARGETS_TO_BUILD)
407 # Generate riscv_vector.h
408 clang_generate_header(-gen-riscv-vector-header riscv_vector.td riscv_vector.h)
409 list(APPEND riscv_generated_files
410 "${CMAKE_CURRENT_BINARY_DIR}/riscv_vector.h"
415 # Check if the generated headers are included in a target specific lists
416 # Currently, all generated headers are target specific.
417 set(all_target_specific_generated_files
418 ${arm_common_generated_files}
419 ${arm_only_generated_files}
420 ${aarch64_only_generated_files}
421 ${riscv_generated_files})
422 foreach( f ${generated_files} )
423 if (NOT ${f} IN_LIST all_target_specific_generated_files)
424 message(WARNING "${f} is a generated header but it is not included in any "
425 "target specific header lists! The resource-headers "
426 "distribtion target will be incorrect!")
430 function(add_header_target target_name file_list)
431 add_custom_target(${target_name} DEPENDS ${file_list})
432 set_target_properties(${target_name} PROPERTIES
434 RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
437 # The catch-all clang-resource-headers target
438 add_custom_target("clang-resource-headers" ALL DEPENDS ${out_files})
439 set_target_properties("clang-resource-headers" PROPERTIES
441 RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
442 add_dependencies("clang-resource-headers"
443 "core-resource-headers"
444 "arm-common-resource-headers"
445 "arm-resource-headers"
446 "aarch64-resource-headers"
447 "cuda-resource-headers"
448 "hexagon-resource-headers"
449 "hip-resource-headers"
450 "hlsl-resource-headers"
451 "loongarch-resource-headers"
452 "mips-resource-headers"
453 "ppc-resource-headers"
454 "ppc-htm-resource-headers"
455 "riscv-resource-headers"
456 "systemz-resource-headers"
457 "ve-resource-headers"
458 "webassembly-resource-headers"
459 "x86-resource-headers"
460 "opencl-resource-headers"
461 "openmp-resource-headers"
462 "llvm-libc-resource-headers"
463 "windows-resource-headers"
464 "utility-resource-headers")
466 # Core/common headers
467 add_header_target("core-resource-headers" ${core_files})
468 add_header_target("arm-common-resource-headers" "${arm_common_files};${arm_common_generated_files}")
470 # Architecture/platform specific targets
471 add_header_target("arm-resource-headers" "${arm_only_files};${arm_only_generated_files}")
472 add_header_target("aarch64-resource-headers" "${aarch64_only_files};${aarch64_only_generated_files}")
473 add_header_target("cuda-resource-headers" "${cuda_files};${cuda_wrapper_files};${cuda_wrapper_bits_files}")
474 add_header_target("hexagon-resource-headers" "${hexagon_files}")
475 add_header_target("hip-resource-headers" "${hip_files}")
476 add_header_target("loongarch-resource-headers" "${loongarch_files}")
477 add_header_target("mips-resource-headers" "${mips_msa_files}")
478 add_header_target("ppc-resource-headers" "${ppc_files};${ppc_wrapper_files}")
479 add_header_target("ppc-htm-resource-headers" "${ppc_htm_files}")
480 add_header_target("riscv-resource-headers" "${riscv_files};${riscv_generated_files}")
481 add_header_target("systemz-resource-headers" "${systemz_files}")
482 add_header_target("ve-resource-headers" "${ve_files}")
483 add_header_target("webassembly-resource-headers" "${webassembly_files}")
484 add_header_target("x86-resource-headers" "${x86_files}")
486 # Other header groupings
487 add_header_target("hlsl-resource-headers" ${hlsl_files})
488 add_header_target("opencl-resource-headers" ${opencl_files})
489 add_header_target("llvm-libc-resource-headers" ${llvm_libc_wrapper_files})
490 add_header_target("openmp-resource-headers" ${openmp_wrapper_files})
491 add_header_target("windows-resource-headers" ${windows_only_files})
492 add_header_target("utility-resource-headers" ${utility_files})
494 get_clang_resource_dir(header_install_dir SUBDIR include)
496 #############################################################
497 # Install rules for the catch-all clang-resource-headers target
499 FILES ${files} ${generated_files}
500 DESTINATION ${header_install_dir}
501 COMPONENT clang-resource-headers)
504 FILES ${cuda_wrapper_files}
505 DESTINATION ${header_install_dir}/cuda_wrappers
506 COMPONENT clang-resource-headers)
509 FILES ${cuda_wrapper_bits_files}
510 DESTINATION ${header_install_dir}/cuda_wrappers/bits
511 COMPONENT clang-resource-headers)
514 FILES ${ppc_wrapper_files}
515 DESTINATION ${header_install_dir}/ppc_wrappers
516 COMPONENT clang-resource-headers)
519 FILES ${llvm_libc_wrapper_files}
520 DESTINATION ${header_install_dir}/llvm_libc_wrappers
521 COMPONENT clang-resource-headers)
524 FILES ${openmp_wrapper_files}
525 DESTINATION ${header_install_dir}/openmp_wrappers
526 COMPONENT clang-resource-headers)
528 #############################################################
529 # Install rules for separate header lists
532 DESTINATION ${header_install_dir}
534 COMPONENT core-resource-headers)
537 FILES ${arm_common_files} ${arm_common_generated_files}
538 DESTINATION ${header_install_dir}
540 COMPONENT arm-common-resource-headers)
543 FILES ${arm_only_files} ${arm_only_generated_files}
544 DESTINATION ${header_install_dir}
546 COMPONENT arm-resource-headers)
549 FILES ${aarch64_only_files} ${aarch64_only_generated_files}
550 DESTINATION ${header_install_dir}
552 COMPONENT aarch64-resource-headers)
555 FILES ${cuda_wrapper_files}
556 DESTINATION ${header_install_dir}/cuda_wrappers
558 COMPONENT cuda-resource-headers)
561 FILES ${cuda_wrapper_bits_files}
562 DESTINATION ${header_install_dir}/cuda_wrappers/bits
564 COMPONENT cuda-resource-headers)
568 DESTINATION ${header_install_dir}
570 COMPONENT cuda-resource-headers)
573 FILES ${hexagon_files}
574 DESTINATION ${header_install_dir}
576 COMPONENT hexagon-resource-headers)
580 DESTINATION ${header_install_dir}
582 COMPONENT hip-resource-headers)
585 FILES ${loongarch_files}
586 DESTINATION ${header_install_dir}
588 COMPONENT loongarch-resource-headers)
591 FILES ${mips_msa_files}
592 DESTINATION ${header_install_dir}
594 COMPONENT mips-resource-headers)
597 FILES ${ppc_wrapper_files}
598 DESTINATION ${header_install_dir}/ppc_wrappers
600 COMPONENT ppc-resource-headers)
604 DESTINATION ${header_install_dir}
606 COMPONENT ppc-resource-headers)
609 FILES ${ppc_htm_files}
610 DESTINATION ${header_install_dir}
612 COMPONENT ppc-htm-resource-headers)
615 FILES ${riscv_generated_files}
616 DESTINATION ${header_install_dir}
618 COMPONENT riscv-resource-headers)
622 DESTINATION ${header_install_dir}
624 COMPONENT riscv-resource-headers)
627 FILES ${systemz_files}
628 DESTINATION ${header_install_dir}
630 COMPONENT systemz-resource-headers)
634 DESTINATION ${header_install_dir}
636 COMPONENT ve-resource-headers)
639 FILES ${webassembly_files}
640 DESTINATION ${header_install_dir}
642 COMPONENT webassembly-resource-headers)
646 DESTINATION ${header_install_dir}
648 COMPONENT x86-resource-headers)
650 if(NOT CLANG_ENABLE_HLSL)
651 set(EXCLUDE_HLSL EXCLUDE_FROM_ALL)
656 DESTINATION ${header_install_dir}
658 COMPONENT hlsl-resource-headers)
661 FILES ${hlsl_subdir_files}
662 DESTINATION ${header_install_dir}/hlsl
664 COMPONENT hlsl-resource-headers)
667 FILES ${opencl_files}
668 DESTINATION ${header_install_dir}
670 COMPONENT opencl-resource-headers)
673 FILES ${openmp_wrapper_files}
674 DESTINATION ${header_install_dir}/openmp_wrappers
676 COMPONENT openmp-resource-headers)
679 FILES ${openmp_wrapper_files}
680 DESTINATION ${header_install_dir}/openmp_wrappers
682 COMPONENT openmp-resource-headers)
685 FILES ${utility_files}
686 DESTINATION ${header_install_dir}
688 COMPONENT utility-resource-headers)
691 FILES ${windows_only_files}
692 DESTINATION ${header_install_dir}
694 COMPONENT windows-resource-headers)
695 #############################################################
697 if (NOT LLVM_ENABLE_IDE)
698 add_llvm_install_targets(install-clang-resource-headers
699 DEPENDS clang-resource-headers
700 COMPONENT clang-resource-headers)
702 add_llvm_install_targets(install-core-resource-headers
703 DEPENDS core-resource-headers
704 COMPONENT core-resource-headers)
705 add_llvm_install_targets(install-arm-common-resource-headers
706 DEPENDS arm-common-resource-headers
707 COMPONENT arm-common-resource-headers)
708 add_llvm_install_targets(install-arm-resource-headers
709 DEPENDS arm-resource-headers
710 COMPONENT arm-resource-headers)
711 add_llvm_install_targets(install-aarch64-resource-headers
712 DEPENDS aarch64-resource-headers
713 COMPONENT aarch64-resource-headers)
714 add_llvm_install_targets(install-cuda-resource-headers
715 DEPENDS cuda-resource-headers
716 COMPONENT cuda-resource-headers)
717 add_llvm_install_targets(install-hexagon-resource-headers
718 DEPENDS hexagon-resource-headers
719 COMPONENT hexagon-resource-headers)
720 add_llvm_install_targets(install-hip-resource-headers
721 DEPENDS hip-resource-headers
722 COMPONENT hip-resource-headers)
723 add_llvm_install_targets(install-mips-resource-headers
724 DEPENDS mips-resource-headers
725 COMPONENT mips-resource-headers)
726 add_llvm_install_targets(install-ppc-resource-headers
727 DEPENDS ppc-resource-headers
728 COMPONENT ppc-resource-headers)
729 add_llvm_install_targets(install-ppc-htm-resource-headers
730 DEPENDS ppc-htm-resource-headers
731 COMPONENT ppc-htm-resource-headers)
732 add_llvm_install_targets(install-riscv-resource-headers
733 DEPENDS riscv-resource-headers
734 COMPONENT riscv-resource-headers)
735 add_llvm_install_targets(install-systemz-resource-headers
736 DEPENDS systemz-resource-headers
737 COMPONENT systemz-resource-headers)
738 add_llvm_install_targets(install-ve-resource-headers
739 DEPENDS ve-resource-headers
740 COMPONENT ve-resource-headers)
741 add_llvm_install_targets(install-x86-resource-headers
742 DEPENDS x86-resource-headers
743 COMPONENT x86-resource-headers)
744 add_llvm_install_targets(install-webassembly-resource-headers
745 DEPENDS webassembly-resource-headers
746 COMPONENT webassembly-resource-headers)
748 add_llvm_install_targets(install-hlsl-resource-headers
749 DEPENDS hlsl-resource-headers
750 COMPONENT hlsl-resource-headers)
751 add_llvm_install_targets(install-opencl-resource-headers
752 DEPENDS opencl-resource-headers
753 COMPONENT opencl-resource-headers)
754 add_llvm_install_targets(install-openmp-resource-headers
755 DEPENDS openmp-resource-headers
756 COMPONENT openmp-resource-headers)
757 add_llvm_install_targets(install-windows-resource-headers
758 DEPENDS windows-resource-headers
759 COMPONENT windows-resource-headers)
760 add_llvm_install_targets(install-utility-resource-headers
761 DEPENDS utility-resource-headers
762 COMPONENT utility-resource-headers)
765 source_group("Clang Runtime Headers" FILES ${files})