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