1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

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.

llvm-svn: 59383
This commit is contained in:
Oscar Fuentes 2008-11-16 04:13:19 +00:00
parent 9dd963a73a
commit 0b07355baa

View File

@ -1,13 +1,15 @@
macro(llvm_config executable link_components)
macro(llvm_config executable)
# extra args is the list of link components.
if( MSVC )
msvc_llvm_config(${executable} ${link_components})
msvc_llvm_config(${executable} ${ARGN})
else( MSVC )
nix_llvm_config(${executable} ${link_components})
nix_llvm_config(${executable} ${ARGN})
endif( MSVC )
endmacro(llvm_config executable link_components)
endmacro(llvm_config)
function(msvc_llvm_config executable link_components)
function(msvc_llvm_config executable)
set( link_components ${ARGN} )
foreach(c ${link_components})
if( c STREQUAL "jit" )
set(lfgs "${lfgs} /INCLUDE:_X86TargetMachineModule")
@ -22,7 +24,7 @@ function(msvc_llvm_config executable link_components)
endif()
endforeach(c)
msvc_map_components_to_libraries(${link_components} LIBRARIES)
msvc_map_components_to_libraries(LIBRARIES ${link_components})
target_link_libraries(${executable} ${LIBRARIES})
if( lfgs )
@ -30,15 +32,26 @@ function(msvc_llvm_config executable link_components)
PROPERTIES
LINK_FLAGS ${lfgs})
endif()
endfunction(msvc_llvm_config executable link_components)
endfunction(msvc_llvm_config)
function(msvc_map_components_to_libraries link_components out_libs)
function(msvc_map_components_to_libraries out_libs)
set( link_components ${ARGN} )
foreach(c ${link_components})
# add codegen/asmprinter
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
if( NOT idx LESS 0 )
list(APPEND expanded_components "LLVM${c}CodeGen")
list(FIND llvm_libs "LLVM${c}CodeGen" idx)
if( NOT idx LESS 0 )
list(APPEND expanded_components "LLVM${c}CodeGen")
else()
list(FIND llvm_libs "LLVM${c}" idx)
if( NOT idx LESS 0 )
list(APPEND expanded_components "LLVM${c}")
else()
message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
endif()
endif()
list(FIND llvm_libs "LLVM${c}AsmPrinter" asmidx)
if( NOT asmidx LESS 0 )
list(APPEND expanded_components "LLVM${c}AsmPrinter")
@ -62,6 +75,7 @@ function(msvc_map_components_to_libraries link_components out_libs)
endforeach(c)
# We must match capitalization.
string(TOUPPER "${llvm_libs}" capitalized_libs)
list(REMOVE_DUPLICATES expanded_components)
set(curr_idx 0)
list(LENGTH expanded_components lst_size)
while( ${curr_idx} LESS ${lst_size} )
@ -75,6 +89,7 @@ function(msvc_map_components_to_libraries link_components out_libs)
list(APPEND result ${canonical_lib})
list(APPEND result ${MSVC_LIB_DEPS_${canonical_lib}})
list(APPEND expanded_components ${MSVC_LIB_DEPS_${canonical_lib}})
list(REMOVE_DUPLICATES expanded_components)
list(LENGTH expanded_components lst_size)
math(EXPR curr_idx "${curr_idx} + 1")
endwhile( ${curr_idx} LESS ${lst_size} )
@ -83,9 +98,9 @@ function(msvc_map_components_to_libraries link_components out_libs)
endfunction(msvc_map_components_to_libraries)
macro(nix_llvm_config executable link_components)
macro(nix_llvm_config executable)
set(lc "")
foreach(c ${LLVM_LINK_COMPONENTS})
foreach(c ${ARGN})
set(lc "${lc} ${c}")
endforeach(c)
if( NOT HAVE_LLVM_CONFIG )
@ -116,7 +131,7 @@ macro(nix_llvm_config executable link_components)
endif(c MATCHES ".*\\.o")
endforeach(c)
endif( NOT HAVE_LLVM_CONFIG )
endmacro(nix_llvm_config executable link_components)
endmacro(nix_llvm_config)
# This data is used on MSVC for stablishing executable/library