1set(files
2  altivec.h
3  ammintrin.h
4  avxintrin.h
5  avx2intrin.h
6  bmiintrin.h
7  bmi2intrin.h
8  emmintrin.h
9  f16cintrin.h
10  float.h
11  fma4intrin.h
12  fmaintrin.h
13  immintrin.h
14  iso646.h
15  Intrin.h
16  limits.h
17  lzcntintrin.h
18  mm3dnow.h
19  mmintrin.h
20  mm_malloc.h
21  nmmintrin.h
22  pmmintrin.h
23  popcntintrin.h
24  prfchwintrin.h
25  rdseedintrin.h
26  rtmintrin.h
27  shaintrin.h
28  smmintrin.h
29  stdalign.h
30  stdarg.h
31  stdbool.h
32  stddef.h
33  stdint.h
34  stdnoreturn.h
35  tbmintrin.h
36  tgmath.h
37  tmmintrin.h
38  varargs.h
39  wmmintrin.h
40  __wmmintrin_aes.h
41  __wmmintrin_pclmul.h
42  x86intrin.h
43  xmmintrin.h
44  xopintrin.h
45  cpuid.h
46  unwind.h
47  module.map
48  )
49
50set(output_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/clang/${CLANG_VERSION}/include)
51
52# If we are in an IDE that has a configuration directory, we need to
53# create a second copy of the headers so that 'clang' can find them if
54# it's run from the build directory.
55if(MSVC_IDE OR XCODE)
56   set(other_output_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib/clang/${CLANG_VERSION}/include)
57endif()
58
59# Generate arm_neon.h
60clang_tablegen(arm_neon.h.inc -gen-arm-neon
61  SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
62
63set(out_files)
64foreach( f ${files} )
65  set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
66  set( dst ${output_dir}/${f} )
67  add_custom_command(OUTPUT ${dst}
68    DEPENDS ${src}
69    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
70    COMMENT "Copying clang's ${f}...")
71  list(APPEND out_files ${dst})
72
73  if(other_output_dir)
74   set(other_dst ${other_output_dir}/${f})
75    add_custom_command(OUTPUT ${other_dst}
76      DEPENDS ${src}
77      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
78      COMMENT "Copying clang's ${f}...")
79    list(APPEND out_files ${other_dst})
80  endif()
81endforeach( f )
82
83add_custom_command(OUTPUT ${output_dir}/arm_neon.h
84  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc
85  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc ${output_dir}/arm_neon.h
86  COMMENT "Copying clang's arm_neon.h...")
87list(APPEND out_files ${output_dir}/arm_neon.h)
88
89if (other_output_dir)
90    set(other_dst ${other_output_dir}/arm_neon.h)
91    add_custom_command(OUTPUT ${other_dst}
92      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc
93      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc ${other_dst}
94      COMMENT "Copying clang's arm_neon.h...")
95    list(APPEND out_files ${other_dst})
96endif ()
97
98add_custom_target(clang-headers ALL DEPENDS ${out_files})
99set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
100
101if (other_output_dir)
102  if(UNIX)
103    add_custom_command(TARGET clang-headers POST_BUILD
104    COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}"
105    COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib/clang" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/clang")
106  endif()
107endif ()
108
109install(FILES ${files} ${output_dir}/arm_neon.h
110  PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
111  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
112