• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(files
2  altivec.h
3  avxintrin.h
4  emmintrin.h
5  float.h
6  immintrin.h
7  iso646.h
8  limits.h
9  mm3dnow.h
10  mmintrin.h
11  mm_malloc.h
12  nmmintrin.h
13  pmmintrin.h
14  smmintrin.h
15  stdarg.h
16  stdbool.h
17  stddef.h
18  stdint.h
19  tgmath.h
20  tmmintrin.h
21  varargs.h
22  wmmintrin.h
23  x86intrin.h
24  xmmintrin.h
25  )
26
27set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
28
29# If we are in an IDE that has a configuration directory, we need to
30# create a second copy of the headers so that 'clang' can find them if
31# it's run from the build directory.
32if(MSVC_IDE OR XCODE)
33   set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
34endif()
35
36# Generate arm_neon.h
37clang_tablegen(arm_neon.h.inc -gen-arm-neon
38  SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
39
40set(out_files)
41foreach( f ${files} )
42  set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
43  set( dst ${output_dir}/${f} )
44  add_custom_command(OUTPUT ${dst}
45    DEPENDS ${src}
46    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
47    COMMENT "Copying clang's ${f}...")
48  list(APPEND out_files ${dst})
49
50  if(other_output_dir)
51   set(other_dst ${other_output_dir}/${f})
52    add_custom_command(OUTPUT ${other_dst}
53      DEPENDS ${src}
54      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
55      COMMENT "Copying clang's ${f}...")
56    list(APPEND out_files ${other_dst})
57  endif()
58endforeach( f )
59
60add_custom_command(OUTPUT ${output_dir}/arm_neon.h
61  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc
62  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc ${output_dir}/arm_neon.h
63  COMMENT "Copying clang's arm_neon.h...")
64list(APPEND out_files ${output_dir}/arm_neon.h)
65
66if (other_output_dir)
67    set(other_dst ${other_output_dir}/arm_neon.h)
68    add_custom_command(OUTPUT ${other_dst}
69      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc
70      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc ${other_dst}
71      COMMENT "Copying clang's arm_neon.h...")
72    list(APPEND out_files ${other_dst})
73endif ()
74
75add_custom_target(clang-headers ALL DEPENDS ${out_files})
76set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
77
78install(FILES ${files} ${output_dir}/arm_neon.h
79  PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
80  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
81