blob: 78fd6f19f67b088ff18a4f01684c07fd58112e6e [file] [log] [blame]
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +00001set(files
Chris Lattnerdd173942010-04-14 03:54:58 +00002 altivec.h
Bruno Cardoso Lopes55db5b82010-08-04 22:03:36 +00003 avxintrin.h
Oscar Fuentesbe7025e2011-02-27 13:33:31 +00004 emmintrin.h
5 float.h
Benjamin Kramer033b7b32010-08-20 18:04:07 +00006 immintrin.h
Oscar Fuentesbe7025e2011-02-27 13:33:31 +00007 iso646.h
8 limits.h
Michael J. Spencer408d5d12011-04-15 15:11:21 +00009 mm3dnow.h
Oscar Fuentesbe7025e2011-02-27 13:33:31 +000010 mmintrin.h
11 mm_malloc.h
12 nmmintrin.h
13 pmmintrin.h
Chris Lattner3a70f862010-08-20 17:24:02 +000014 smmintrin.h
Oscar Fuentesbe7025e2011-02-27 13:33:31 +000015 stdarg.h
16 stdbool.h
17 stddef.h
18 stdint.h
Douglas Gregor06026002009-06-07 07:09:23 +000019 tgmath.h
20 tmmintrin.h
Oscar Fuentesbe7025e2011-02-27 13:33:31 +000021 varargs.h
22 wmmintrin.h
23 x86intrin.h
24 xmmintrin.h
25 )
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000026
Douglas Gregor105716e2010-10-19 18:06:10 +000027set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
Douglas Gregord1e6fdb2010-10-11 23:17:59 +000028
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()
Douglas Gregorebfc1802009-06-16 20:13:51 +000035
Douglas Gregorc302f002010-05-28 04:22:06 +000036# Generate arm_neon.h
Oscar Fuentesc8da1ec2011-02-20 22:06:32 +000037clang_tablegen(arm_neon.h.inc -gen-arm-neon
38 SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
Douglas Gregorc302f002010-05-28 04:22:06 +000039
Douglas Gregord1e6fdb2010-10-11 23:17:59 +000040set(out_files)
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000041foreach( 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}...")
Douglas Gregord1e6fdb2010-10-11 23:17:59 +000048 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()
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000058endforeach( f )
59
Douglas Gregord1e6fdb2010-10-11 23:17:59 +000060add_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})
Oscar Fuentesa3f787c2011-02-20 22:06:44 +000076set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000077
Douglas Gregorc302f002010-05-28 04:22:06 +000078install(FILES ${files} ${output_dir}/arm_neon.h
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000079 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
Oscar Fuentes25950e82009-10-27 21:15:21 +000080 DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)