llvm.org GIT mirror llvm / 808e3a9
CMake: MSVC: Pass list of components the right way to msvc_llvm_config and siblings. Support targets whose name does not end on `CodeGen'. Remove a performance bottleneck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59383 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
1 changed file(s) with 31 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
None macro(llvm_config executable link_components)
0 macro(llvm_config executable)
1 # extra args is the list of link components.
12 if( MSVC )
2 msvc_llvm_config(${executable} ${link_components})
3 msvc_llvm_config(${executable} ${ARGN})
34 else( MSVC )
4 nix_llvm_config(${executable} ${link_components})
5 nix_llvm_config(${executable} ${ARGN})
56 endif( MSVC )
6 endmacro(llvm_config executable link_components)
7
8
9 function(msvc_llvm_config executable link_components)
7 endmacro(llvm_config)
8
9
10 function(msvc_llvm_config executable)
11 set( link_components ${ARGN} )
1012 foreach(c ${link_components})
1113 if( c STREQUAL "jit" )
1214 set(lfgs "${lfgs} /INCLUDE:_X86TargetMachineModule")
2123 endif()
2224 endforeach(c)
2325
24 msvc_map_components_to_libraries(${link_components} LIBRARIES)
26 msvc_map_components_to_libraries(LIBRARIES ${link_components})
2527 target_link_libraries(${executable} ${LIBRARIES})
2628
2729 if( lfgs )
2931 PROPERTIES
3032 LINK_FLAGS ${lfgs})
3133 endif()
32 endfunction(msvc_llvm_config executable link_components)
33
34
35 function(msvc_map_components_to_libraries link_components out_libs)
34 endfunction(msvc_llvm_config)
35
36
37 function(msvc_map_components_to_libraries out_libs)
38 set( link_components ${ARGN} )
3639 foreach(c ${link_components})
3740 # add codegen/asmprinter
3841 list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
3942 if( NOT idx LESS 0 )
40 list(APPEND expanded_components "LLVM${c}CodeGen")
43 list(FIND llvm_libs "LLVM${c}CodeGen" idx)
44 if( NOT idx LESS 0 )
45 list(APPEND expanded_components "LLVM${c}CodeGen")
46 else()
47 list(FIND llvm_libs "LLVM${c}" idx)
48 if( NOT idx LESS 0 )
49 list(APPEND expanded_components "LLVM${c}")
50 else()
51 message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
52 endif()
53 endif()
4154 list(FIND llvm_libs "LLVM${c}AsmPrinter" asmidx)
4255 if( NOT asmidx LESS 0 )
4356 list(APPEND expanded_components "LLVM${c}AsmPrinter")
6174 endforeach(c)
6275 # We must match capitalization.
6376 string(TOUPPER "${llvm_libs}" capitalized_libs)
77 list(REMOVE_DUPLICATES expanded_components)
6478 set(curr_idx 0)
6579 list(LENGTH expanded_components lst_size)
6680 while( ${curr_idx} LESS ${lst_size} )
7488 list(APPEND result ${canonical_lib})
7589 list(APPEND result ${MSVC_LIB_DEPS_${canonical_lib}})
7690 list(APPEND expanded_components ${MSVC_LIB_DEPS_${canonical_lib}})
91 list(REMOVE_DUPLICATES expanded_components)
7792 list(LENGTH expanded_components lst_size)
7893 math(EXPR curr_idx "${curr_idx} + 1")
7994 endwhile( ${curr_idx} LESS ${lst_size} )
8297 endfunction(msvc_map_components_to_libraries)
8398
8499
85 macro(nix_llvm_config executable link_components)
100 macro(nix_llvm_config executable)
86101 set(lc "")
87 foreach(c ${LLVM_LINK_COMPONENTS})
102 foreach(c ${ARGN})
88103 set(lc "${lc} ${c}")
89104 endforeach(c)
90105 if( NOT HAVE_LLVM_CONFIG )
115130 endif(c MATCHES ".*\\.o")
116131 endforeach(c)
117132 endif( NOT HAVE_LLVM_CONFIG )
118 endmacro(nix_llvm_config executable link_components)
133 endmacro(nix_llvm_config)
119134
120135
121136 # This data is used on MSVC for stablishing executable/library