llvm.org GIT mirror llvm / 7f6f21e
CMake: Forces linking of the rest of architecture targets and its respective asm printers on MSVC. Based on a patch by Scott Graham. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59379 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
2 changed file(s) with 31 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
3636 X86
3737 XCore
3838 )
39
40 # List of targets whose asmprinters need to be forced to link
41 # into executables on some platforms (i.e. Windows):
42 set(LLVM_ASMPRINTERS_FORCE_LINK X86 PowerPC)
3943
4044 if( MSVC )
4145 set(LLVM_TARGETS_TO_BUILD X86
99 function(msvc_llvm_config executable link_components)
1010 foreach(c ${link_components})
1111 if( c STREQUAL "jit" )
12 set_target_properties(${executable}
13 PROPERTIES
14 LINK_FLAGS "/INCLUDE:_X86TargetMachineModule")
12 set(lfgs "${lfgs} /INCLUDE:_X86TargetMachineModule")
1513 endif( c STREQUAL "jit" )
14 list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
15 if( NOT idx LESS 0 )
16 set(lfgs "${lfgs} /INCLUDE:_${c}TargetMachineModule")
17 list(FIND LLVM_ASMPRINTERS_FORCE_LINK ${c} idx)
18 if( NOT idx LESS 0 )
19 set(lfgs "${lfgs} /INCLUDE:_${c}AsmPrinterForceLink")
20 endif()
21 endif()
1622 endforeach(c)
23
1724 msvc_map_components_to_libraries(${link_components} LIBRARIES)
1825 target_link_libraries(${executable} ${LIBRARIES})
26
27 if( lfgs )
28 set_target_properties(${executable}
29 PROPERTIES
30 LINK_FLAGS ${lfgs})
31 endif()
1932 endfunction(msvc_llvm_config executable link_components)
2033
2134
2235 function(msvc_map_components_to_libraries link_components out_libs)
2336 foreach(c ${link_components})
24 if( c STREQUAL "native" )
37 # add codegen/asmprinter
38 list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
39 if( NOT idx LESS 0 )
40 list(APPEND expanded_components "LLVM${c}CodeGen")
41 list(FIND llvm_libs "LLVM${c}AsmPrinter" asmidx)
42 if( NOT asmidx LESS 0 )
43 list(APPEND expanded_components "LLVM${c}AsmPrinter")
44 endif()
45 elseif( c STREQUAL "native" )
2546 # TODO: we assume ARCH is X86. In this case, we must use nativecodegen
2647 # component instead. Do nothing, as in llvm-config script.
2748 elseif( c STREQUAL "nativecodegen" )
3253 elseif( c STREQUAL "engine" )
3354 # TODO: as we assume we are on X86, this is `jit'.
3455 list(APPEND expanded_components "LLVMJIT")
35 elseif( c STREQUAL "X86" )
36 # TODO: we assume we are on X86.
37 list(APPEND expanded_components "LLVMX86CodeGen")
38 list(APPEND expanded_components "LLVMX86AsmPrinter")
3956 elseif( c STREQUAL "all" )
4057 list(APPEND expanded_components ${llvm_libs})
41 else( c STREQUAL "native" )
58 else( NOT idx LESS 0 )
4259 list(APPEND expanded_components LLVM${c})
43 endif( c STREQUAL "native" )
60 endif( NOT idx LESS 0 )
4461 endforeach(c)
4562 # We must match capitalization.
4663 string(TOUPPER "${llvm_libs}" capitalized_libs)