llvm.org GIT mirror llvm / 94d38e5
CMake: Automatic regeneration of the library dependencies file. It doesn't stop or reconfigure the build, though, so the user will see a broken build that magically succeeds at the next attempt. It is technically possible to halt the build with a helpful message, and even to automatically restart the build using the new dependencies as it we did when llvm-config was used by cmake for learning dependencies. This is left on the TODO list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79004 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
3 changed file(s) with 49 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
None include(LLVMLibDeps)
1
2 function(get_system_libs return_var)
31 # Returns in `return_var' a list of system libraries used by LLVM.
42 if( NOT MSVC )
10098 endwhile( 0 LESS ${lst_size} )
10199 set(${out_libs} ${result} PARENT_SCOPE)
102100 endfunction(explicit_map_components_to_libraries)
101
102
103 # The library dependency data is contained in the file
104 # LLVMLibDeps.cmake on this directory. It is automatically generated
105 # by tools/llvm-config/CMakeLists.txt when the build comprises all the
106 # targets and we are on a environment Posix enough to build the
107 # llvm-config script. This, in practice, just excludes MSVC.
108
109 # When you remove or rename a library from the build, be sure to
110 # remove its file from lib/ as well, or the GenLibDeps.pl script will
111 # include it on its analysis!
112
113 # The format generated by GenLibDeps.pl
114
115 # LLVMARMAsmPrinter.o: LLVMARMCodeGen.o libLLVMAsmPrinter.a libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMTarget.a
116
117 # is translated to:
118
119 # set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
120
121 # It is necessary to remove the `lib' prefix and the `.a'.
122
123 # This 'sed' script should do the trick:
124 # sed -e s'#\.a##g' -e 's#libLLVM#LLVM#g' -e 's#: # #' -e 's#\(.*\)#set(MSVC_LIB_DEPS_\1)#' ~/llvm/tools/llvm-config/LibDeps.txt
125
126 include(LLVMLibDeps)
None # This data is used to establish executable/library
1 # dependencies. Comes from the llvm-config script, which is built and
2 # installed on the bin directory for MinGW or Linux. At the end of the
3 # script, you'll see lines like this:
4
5 # LLVMARMAsmPrinter.o: LLVMARMCodeGen.o libLLVMAsmPrinter.a libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMTarget.a
6
7 # This is translated to:
8
9 # set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
10
11 # It is necessary to remove the `lib' prefix and the `.a'.
12
13 # This 'sed' script should do the trick:
14 # sed -e s'#\.a##g' -e 's#libLLVM#LLVM#g' -e 's#: # #' -e 's#\(.*\)#set(MSVC_LIB_DEPS_\1)#' ~/llvm/tools/llvm-config/LibDeps.txt
15 #
16
17 # TODO: do this transformations on cmake.
18
19 # It is very important that the LLVM built for extracting this data
20 # must contain all targets, not just X86.
21
22
23 set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMARMInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget)
241 set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMInfo LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
252 set(MSVC_LIB_DEPS_LLVMARMInfo LLVMSupport)
7855 set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport LLVMSystem)
7956 set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMipa)
8057 set(MSVC_LIB_DEPS_LLVMX86AsmParser LLVMMC LLVMX86Info)
81 set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMX86CodeGen LLVMX86Info)
58 set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget LLVMX86CodeGen LLVMX86Info)
8259 set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMX86Info)
8360 set(MSVC_LIB_DEPS_LLVMX86Info LLVMSupport)
8461 set(MSVC_LIB_DEPS_LLVMXCore LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMXCoreInfo)
123123 WORLD_READ WORLD_EXECUTE
124124 DESTINATION bin)
125125
126
127 # Regeneration of library dependencies.
128
129 # See the comments at the end of cmake/modules/LLVMConfig.cmake for
130 # notes and guidelines.
131
132 set(LLVMLibDeps ${LLVM_MAIN_SRC_DIR}/cmake/modules/LLVMLibDeps.cmake)
133 set(LLVMLibDeps_TMP ${CMAKE_CURRENT_BINARY_DIR}/LLVMLibDeps.cmake.tmp)
134
135 add_custom_command(OUTPUT ${LLVMLibDeps_TMP}
136 COMMAND sed -e s'@\\.a@@g' -e 's@libLLVM@LLVM@g' -e 's@: @ @' -e 's@\\\(.*\\\)@set\(MSVC_LIB_DEPS_\\1\)@' ${FINAL_LIBDEPS} > ${LLVMLibDeps_TMP}
137 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LLVMLibDeps_TMP} ${LLVMLibDeps}
138 DEPENDS ${FINAL_LIBDEPS}
139 COMMENT "Updating cmake library dependencies file ${LLVMLibDeps}"
140 )
141
142 if( LLVM_TARGETS_TO_BUILD STREQUAL LLVM_ALL_TARGETS )
143 add_custom_target(llvmlibdeps.target ALL DEPENDS ${LLVMLibDeps_TMP})
144 add_dependencies(llvmlibdeps.target llvm-config.target)
145 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} llvmlibdeps.target)
146 endif()
147
126148 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)