CMakeLists.txt revision 1bfc28c48c1b86a05d2e07b403107ef3da5a0f8e
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  limits.h
16  lzcntintrin.h
17  mm3dnow.h
18  mmintrin.h
19  mm_malloc.h
20  nmmintrin.h
21  pmmintrin.h
22  popcntintrin.h
23  prfchwintrin.h
24  rdseedintrin.h
25  rtmintrin.h
26  smmintrin.h
27  stdalign.h
28  stdarg.h
29  stdbool.h
30  stddef.h
31  stdint.h
32  stdnoreturn.h
33  tgmath.h
34  tmmintrin.h
35  varargs.h
36  wmmintrin.h
37  __wmmintrin_aes.h
38  __wmmintrin_pclmul.h
39  x86intrin.h
40  xmmintrin.h
41  xopintrin.h
42  cpuid.h
43  unwind.h
44  module.map
45  )
46
47set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
48
49# If we are in an IDE that has a configuration directory, we need to
50# create a second copy of the headers so that 'clang' can find them if
51# it's run from the build directory.
52if(MSVC_IDE OR XCODE)
53   set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
54endif()
55
56# Generate arm_neon.h
57clang_tablegen(arm_neon.h.inc -gen-arm-neon
58  SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
59
60set(out_files)
61foreach( f ${files} )
62  set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
63  set( dst ${output_dir}/${f} )
64  add_custom_command(OUTPUT ${dst}
65    DEPENDS ${src}
66    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
67    COMMENT "Copying clang's ${f}...")
68  list(APPEND out_files ${dst})
69
70  if(other_output_dir)
71   set(other_dst ${other_output_dir}/${f})
72    add_custom_command(OUTPUT ${other_dst}
73      DEPENDS ${src}
74      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
75      COMMENT "Copying clang's ${f}...")    
76    list(APPEND out_files ${other_dst})
77  endif()
78endforeach( f )
79
80add_custom_command(OUTPUT ${output_dir}/arm_neon.h 
81  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc
82  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc ${output_dir}/arm_neon.h
83  COMMENT "Copying clang's arm_neon.h...")
84list(APPEND out_files ${output_dir}/arm_neon.h)
85
86if (other_output_dir)
87    set(other_dst ${other_output_dir}/arm_neon.h)
88    add_custom_command(OUTPUT ${other_dst}
89      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc
90      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h.inc ${other_dst}
91      COMMENT "Copying clang's arm_neon.h...")
92    list(APPEND out_files ${other_dst})
93endif ()
94
95add_custom_target(clang-headers ALL DEPENDS ${out_files})
96set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
97
98install(FILES ${files} ${output_dir}/arm_neon.h
99  PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
100  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
101