llvm.org GIT mirror llvm / 50925fb
CMake: Adds header and TableGen files to Visual Studio solution. A new dummy library, `llvm_headers_do_not_build', is created for containing all header and TableGen files under include/llvm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59346 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
4 changed file(s) with 44 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
11 include(LLVMConfig)
22
33 macro(add_llvm_library name)
4 llvm_process_sources( ${ARGN} )
5 add_library( ${name} ${ARGN} )
4 llvm_process_sources( ALL_FILES ${ARGN} )
5 add_library( ${name} ${ALL_FILES} )
66 set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
77 set( llvm_lib_targets ${llvm_lib_targets} ${name} PARENT_SCOPE )
88 if( LLVM_COMMON_DEPENDS )
1515
1616
1717 macro(add_llvm_executable name)
18 llvm_process_sources( ${ARGN} )
19 add_executable(${name} ${ARGN})
18 llvm_process_sources( ALL_FILES ${ARGN} )
19 add_executable(${name} ${ALL_FILES})
2020 if( LLVM_USED_LIBS )
2121 foreach(lib ${LLVM_USED_LIBS})
2222 target_link_libraries( ${name} ${lib} )
1515 set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${lib}.o)
1616 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
1717 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
18 llvm_process_sources( ${ARGN} )
19 add_library( ${lib} STATIC ${ARGN})
18 llvm_process_sources( ALL_FILES ${ARGN} )
19 add_library( ${lib} STATIC ${ALL_FILES})
2020 if( LLVM_COMMON_DEPENDS )
2121 add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )
2222 endif( LLVM_COMMON_DEPENDS )
0 include(AddFileDependencies)
11
2 function(llvm_process_sources)
2
3 macro(add_td_sources srcs)
4 file(GLOB tds *.td)
5 if( tds )
6 source_group("TableGen descriptions" FILES ${tds})
7 set_source_files_properties(${tds} PROPERTIES HEADER_FILE_ONLY ON)
8 list(APPEND ${srcs} ${tds})
9 endif()
10 endmacro(add_td_sources)
11
12
13 macro(add_header_files srcs)
14 file(GLOB hds *.h)
15 if( hds )
16 set_source_files_properties(${hds} PROPERTIES HEADER_FILE_ONLY ON)
17 list(APPEND ${srcs} ${hds})
18 endif()
19 endmacro(add_header_files)
20
21
22 function(llvm_process_sources OUT_VAR)
323 set( sources ${ARGN} )
424 # Create file dependencies on the tablegenned files, if any. Seems
525 # that this is not strictly needed, as dependencies of the .cpp
929 set( f ${CMAKE_CURRENT_SOURCE_DIR}/${s} )
1030 add_file_dependencies( ${f} ${TABLEGEN_OUTPUT} )
1131 endforeach(s)
32 if( MSVC_IDE )
33 # This adds .td and .h files to the Visual Studio solution:
34 add_td_sources(sources)
35 add_header_files(sources)
36 endif()
37 set( ${OUT_VAR} ${sources} PARENT_SCOPE )
1238 endfunction(llvm_process_sources)
55 DEPENDS ${llvm_builded_incs_dir}/Intrinsics.gen)
66
77 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} intrinsics_gen PARENT_SCOPE)
8
9 if( MSVC_IDE )
10 # Creates a dummy target containing all headers for the benefit of
11 # Visual Studio users.
12 file(GLOB_RECURSE headers *.h)
13 add_td_sources(headers)
14 add_library(llvm_headers_do_not_build EXCLUDE_FROM_ALL
15 # We need at least one source file:
16 ${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello/Hello.cpp
17 ${headers})
18 endif()