[llvm] r235324 - Add targets to cmake for specific target components.
Pete Cooper
peter_cooper at apple.com
Mon Apr 20 11:22:05 PDT 2015
Author: pete
Date: Mon Apr 20 13:22:05 2015
New Revision: 235324
URL: http://llvm.org/viewvc/llvm-project?rev=235324&view=rev
Log:
Add targets to cmake for specific target components.
This adds the following targets to cmake. These can be used to build and link only specific parts of a backend, instead of having to link the whole backend.
- AllTargetsAsmPrinters, AllTargetsAsmParsers, AllTargetsDescs, AllTargetsDisassemblers, AllTargetsInfos
A typical use for these is instead of linking ${LLVM_TARGETS_TO_BUILD}. This commit changes llvm-mc to show how to use the new targets.
Reviewed by Chris Bieneman.
Modified:
llvm/trunk/cmake/modules/LLVM-Config.cmake
llvm/trunk/tools/llvm-mc/CMakeLists.txt
Modified: llvm/trunk/cmake/modules/LLVM-Config.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVM-Config.cmake?rev=235324&r1=235323&r2=235324&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVM-Config.cmake (original)
+++ llvm/trunk/cmake/modules/LLVM-Config.cmake Mon Apr 20 13:22:05 2015
@@ -132,6 +132,41 @@ function(llvm_map_components_to_libnames
# already processed
elseif( c STREQUAL "all" )
list(APPEND expanded_components ${LLVM_AVAILABLE_LIBS})
+ elseif( c STREQUAL "AllTargetsAsmPrinters" )
+ # Link all the asm printers from all the targets
+ foreach(t ${LLVM_TARGETS_TO_BUILD})
+ if( TARGET LLVM${t}AsmPrinter )
+ list(APPEND expanded_components "LLVM${t}AsmPrinter")
+ endif()
+ endforeach(t)
+ elseif( c STREQUAL "AllTargetsAsmParsers" )
+ # Link all the asm parsers from all the targets
+ foreach(t ${LLVM_TARGETS_TO_BUILD})
+ if( TARGET LLVM${t}AsmParser )
+ list(APPEND expanded_components "LLVM${t}AsmParser")
+ endif()
+ endforeach(t)
+ elseif( c STREQUAL "AllTargetsDescs" )
+ # Link all the descs from all the targets
+ foreach(t ${LLVM_TARGETS_TO_BUILD})
+ if( TARGET LLVM${t}Desc )
+ list(APPEND expanded_components "LLVM${t}Desc")
+ endif()
+ endforeach(t)
+ elseif( c STREQUAL "AllTargetsDisassemblers" )
+ # Link all the disassemblers from all the targets
+ foreach(t ${LLVM_TARGETS_TO_BUILD})
+ if( TARGET LLVM${t}Disassembler )
+ list(APPEND expanded_components "LLVM${t}Disassembler")
+ endif()
+ endforeach(t)
+ elseif( c STREQUAL "AllTargetsInfos" )
+ # Link all the infos from all the targets
+ foreach(t ${LLVM_TARGETS_TO_BUILD})
+ if( TARGET LLVM${t}Info )
+ list(APPEND expanded_components "LLVM${t}Info")
+ endif()
+ endforeach(t)
else( NOT idx LESS 0 )
# Canonize the component name:
string(TOUPPER "${c}" capitalized)
Modified: llvm/trunk/tools/llvm-mc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/CMakeLists.txt?rev=235324&r1=235323&r2=235324&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-mc/CMakeLists.txt Mon Apr 20 13:22:05 2015
@@ -1,5 +1,9 @@
set(LLVM_LINK_COMPONENTS
- ${LLVM_TARGETS_TO_BUILD}
+ AllTargetsAsmPrinters
+ AllTargetsAsmParsers
+ AllTargetsDescs
+ AllTargetsDisassemblers
+ AllTargetsInfos
MC
MCParser
Support
More information about the llvm-commits
mailing list