| | function(get_system_libs return_var) |
| | message(AUTHOR_WARNING "get_system_libs no longer needed") |
| | set(${return_var} "" PARENT_SCOPE) |
| | endfunction() |
| |
|
| |
|
| | function(link_system_libs target) |
| | message(AUTHOR_WARNING "link_system_libs no longer needed") |
| | endfunction() |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | function(is_llvm_target_library library return_var) |
| | cmake_parse_arguments(ARG "ALL_TARGETS;INCLUDED_TARGETS;OMITTED_TARGETS" "" "" ${ARGN}) |
| | |
| | |
| | set(${return_var} OFF PARENT_SCOPE) |
| | string(TOUPPER "${library}" capitalized_lib) |
| | if(ARG_INCLUDED_TARGETS) |
| | string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" targets) |
| | elseif(ARG_OMITTED_TARGETS) |
| | set(omitted_targets ${LLVM_ALL_TARGETS}) |
| | list(REMOVE_ITEM omitted_targets ${LLVM_TARGETS_TO_BUILD}) |
| | string(TOUPPER "${omitted_targets}" targets) |
| | else() |
| | string(TOUPPER "${LLVM_ALL_TARGETS}" targets) |
| | endif() |
| | foreach(t ${targets}) |
| | if( capitalized_lib STREQUAL t OR |
| | capitalized_lib STREQUAL "${t}" OR |
| | capitalized_lib STREQUAL "${t}DESC" OR |
| | capitalized_lib STREQUAL "${t}CODEGEN" OR |
| | capitalized_lib STREQUAL "${t}ASMPARSER" OR |
| | capitalized_lib STREQUAL "${t}ASMPRINTER" OR |
| | capitalized_lib STREQUAL "${t}DISASSEMBLER" OR |
| | capitalized_lib STREQUAL "${t}INFO" OR |
| | capitalized_lib STREQUAL "${t}UTILS" ) |
| | set(${return_var} ON PARENT_SCOPE) |
| | break() |
| | endif() |
| | endforeach() |
| | endfunction(is_llvm_target_library) |
| |
|
| | function(is_llvm_target_specifier library return_var) |
| | is_llvm_target_library(${library} ${return_var} ${ARGN}) |
| | string(TOUPPER "${library}" capitalized_lib) |
| | if(NOT ${return_var}) |
| | if( capitalized_lib STREQUAL "ALLTARGETSASMPARSERS" OR |
| | capitalized_lib STREQUAL "ALLTARGETSDESCS" OR |
| | capitalized_lib STREQUAL "ALLTARGETSDISASSEMBLERS" OR |
| | capitalized_lib STREQUAL "ALLTARGETSINFOS" OR |
| | capitalized_lib STREQUAL "NATIVE" OR |
| | capitalized_lib STREQUAL "NATIVECODEGEN" ) |
| | set(${return_var} ON PARENT_SCOPE) |
| | endif() |
| | endif() |
| | endfunction() |
| |
|
| | macro(llvm_config executable) |
| | cmake_parse_arguments(ARG "USE_SHARED" "" "" ${ARGN}) |
| | set(link_components ${ARG_UNPARSED_ARGUMENTS}) |
| |
|
| | if(ARG_USE_SHARED) |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | if (DEFINED link_components AND DEFINED LLVM_DYLIB_COMPONENTS) |
| | if("${LLVM_DYLIB_COMPONENTS}" STREQUAL "all") |
| | set(link_components "") |
| | else() |
| | list(REMOVE_ITEM link_components ${LLVM_DYLIB_COMPONENTS}) |
| | endif() |
| | endif() |
| |
|
| | target_link_libraries(${executable} PRIVATE LLVM) |
| | endif() |
| |
|
| | explicit_llvm_config(${executable} ${link_components}) |
| | endmacro(llvm_config) |
| |
|
| |
|
| | function(explicit_llvm_config executable) |
| | set( link_components ${ARGN} ) |
| |
|
| | llvm_map_components_to_libnames(LIBRARIES ${link_components}) |
| | get_target_property(t ${executable} TYPE) |
| | if(t STREQUAL "STATIC_LIBRARY") |
| | target_link_libraries(${executable} INTERFACE ${LIBRARIES}) |
| | elseif(t STREQUAL "EXECUTABLE" OR t STREQUAL "SHARED_LIBRARY" OR t STREQUAL "MODULE_LIBRARY") |
| | target_link_libraries(${executable} PRIVATE ${LIBRARIES}) |
| | else() |
| | |
| | target_link_libraries(${executable} ${LIBRARIES}) |
| | endif() |
| | endfunction(explicit_llvm_config) |
| |
|
| |
|
| | |
| | function(llvm_map_components_to_libraries OUT_VAR) |
| | message(AUTHOR_WARNING "Using llvm_map_components_to_libraries() is deprecated. Use llvm_map_components_to_libnames() instead") |
| | explicit_map_components_to_libraries(result ${ARGN}) |
| | set( ${OUT_VAR} ${result} ${sys_result} PARENT_SCOPE ) |
| | endfunction(llvm_map_components_to_libraries) |
| |
|
| | |
| | |
| | |
| | |
| | function(llvm_expand_pseudo_components out_components) |
| | set( link_components ${ARGN} ) |
| | foreach(c ${link_components}) |
| | |
| | list(FIND LLVM_TARGETS_TO_BUILD ${c} idx) |
| | if( NOT idx LESS 0 ) |
| | if( TARGET LLVM${c}CodeGen ) |
| | list(APPEND expanded_components "${c}CodeGen") |
| | else() |
| | if( TARGET LLVM${c} ) |
| | list(APPEND expanded_components "${c}") |
| | else() |
| | message(FATAL_ERROR "Target ${c} is not in the set of libraries.") |
| | endif() |
| | endif() |
| | if( TARGET LLVM${c}AsmPrinter ) |
| | list(APPEND expanded_components "${c}AsmPrinter") |
| | endif() |
| | if( TARGET LLVM${c}AsmParser ) |
| | list(APPEND expanded_components "${c}AsmParser") |
| | endif() |
| | if( TARGET LLVM${c}Desc ) |
| | list(APPEND expanded_components "${c}Desc") |
| | endif() |
| | if( TARGET LLVM${c}Disassembler ) |
| | list(APPEND expanded_components "${c}Disassembler") |
| | endif() |
| | if( TARGET LLVM${c}Info ) |
| | list(APPEND expanded_components "${c}Info") |
| | endif() |
| | if( TARGET LLVM${c}Utils ) |
| | list(APPEND expanded_components "${c}Utils") |
| | endif() |
| | elseif( c STREQUAL "nativecodegen" ) |
| | if( TARGET LLVM${LLVM_NATIVE_ARCH}CodeGen ) |
| | list(APPEND expanded_components "${LLVM_NATIVE_ARCH}CodeGen") |
| | endif() |
| | if( TARGET LLVM${LLVM_NATIVE_ARCH}Desc ) |
| | list(APPEND expanded_components "${LLVM_NATIVE_ARCH}Desc") |
| | endif() |
| | if( TARGET LLVM${LLVM_NATIVE_ARCH}Info ) |
| | list(APPEND expanded_components "${LLVM_NATIVE_ARCH}Info") |
| | endif() |
| | elseif( c STREQUAL "AllTargetsCodeGens" ) |
| | |
| | foreach(t ${LLVM_TARGETS_TO_BUILD}) |
| | if( TARGET LLVM${t}CodeGen) |
| | list(APPEND expanded_components "${t}CodeGen") |
| | endif() |
| | endforeach(t) |
| | elseif( c STREQUAL "AllTargetsAsmParsers" ) |
| | |
| | foreach(t ${LLVM_TARGETS_TO_BUILD}) |
| | if( TARGET LLVM${t}AsmParser ) |
| | list(APPEND expanded_components "${t}AsmParser") |
| | endif() |
| | endforeach(t) |
| | elseif( c STREQUAL "AllTargetsDescs" ) |
| | |
| | foreach(t ${LLVM_TARGETS_TO_BUILD}) |
| | if( TARGET LLVM${t}Desc ) |
| | list(APPEND expanded_components "${t}Desc") |
| | endif() |
| | endforeach(t) |
| | elseif( c STREQUAL "AllTargetsDisassemblers" ) |
| | |
| | foreach(t ${LLVM_TARGETS_TO_BUILD}) |
| | if( TARGET LLVM${t}Disassembler ) |
| | list(APPEND expanded_components "${t}Disassembler") |
| | endif() |
| | endforeach(t) |
| | elseif( c STREQUAL "AllTargetsInfos" ) |
| | |
| | foreach(t ${LLVM_TARGETS_TO_BUILD}) |
| | if( TARGET LLVM${t}Info ) |
| | list(APPEND expanded_components "${t}Info") |
| | endif() |
| | endforeach(t) |
| | else() |
| | list(APPEND expanded_components "${c}") |
| | endif() |
| | endforeach() |
| | set(${out_components} ${expanded_components} PARENT_SCOPE) |
| | endfunction(llvm_expand_pseudo_components out_components) |
| |
|
| | |
| | |
| | function(llvm_map_components_to_libnames out_libs) |
| | set( link_components ${ARGN} ) |
| | if(NOT LLVM_AVAILABLE_LIBS) |
| | |
| | get_property(LLVM_AVAILABLE_LIBS GLOBAL PROPERTY LLVM_LIBS) |
| | endif() |
| | string(TOUPPER "${LLVM_AVAILABLE_LIBS}" capitalized_libs) |
| |
|
| | get_property(LLVM_TARGETS_CONFIGURED GLOBAL PROPERTY LLVM_TARGETS_CONFIGURED) |
| |
|
| | |
| | |
| | |
| | |
| | if(NOT LLVM_TARGETS_CONFIGURED) |
| | foreach(c ${link_components}) |
| | is_llvm_target_specifier(${c} iltl_result ALL_TARGETS) |
| | if(iltl_result) |
| | message(FATAL_ERROR "Specified target library before target registration is complete.") |
| | endif() |
| | endforeach() |
| | endif() |
| |
|
| | |
| | list(FIND LLVM_TARGETS_TO_BUILD "${LLVM_NATIVE_ARCH}" have_native_backend) |
| | list(FIND link_components "engine" engine_required) |
| | if( NOT engine_required EQUAL -1 ) |
| | list(FIND LLVM_TARGETS_WITH_JIT "${LLVM_NATIVE_ARCH}" have_jit) |
| | if( NOT have_native_backend EQUAL -1 AND NOT have_jit EQUAL -1 ) |
| | list(APPEND link_components "jit") |
| | list(APPEND link_components "native") |
| | else() |
| | list(APPEND link_components "interpreter") |
| | endif() |
| | endif() |
| | list(FIND link_components "native" native_required) |
| | if( NOT native_required EQUAL -1 ) |
| | if( NOT have_native_backend EQUAL -1 ) |
| | list(APPEND link_components ${LLVM_NATIVE_ARCH}) |
| | endif() |
| | endif() |
| |
|
| | |
| | llvm_expand_pseudo_components(link_components ${link_components}) |
| | foreach(c ${link_components}) |
| | get_property(c_rename GLOBAL PROPERTY LLVM_COMPONENT_NAME_${c}) |
| | if(c_rename) |
| | set(c ${c_rename}) |
| | endif() |
| | if( c STREQUAL "native" ) |
| | |
| | elseif( c STREQUAL "backend" ) |
| | |
| | elseif( c STREQUAL "engine" ) |
| | |
| | elseif( c STREQUAL "all" ) |
| | get_property(all_components GLOBAL PROPERTY LLVM_COMPONENT_LIBS) |
| | list(APPEND expanded_components ${all_components}) |
| | else() |
| | |
| | string(TOUPPER "${c}" capitalized) |
| | list(FIND capitalized_libs LLVM${capitalized} lib_idx) |
| | if( lib_idx LESS 0 ) |
| | |
| | is_llvm_target_library(${c} iltl_result OMITTED_TARGETS) |
| | if(iltl_result) |
| | |
| | message(FATAL_ERROR "Library '${c}' is a direct reference to a target library for an omitted target.") |
| | else() |
| | |
| | |
| | |
| | |
| | list(APPEND expanded_components LLVM${c}) |
| | endif() |
| | else( lib_idx LESS 0 ) |
| | list(GET LLVM_AVAILABLE_LIBS ${lib_idx} canonical_lib) |
| | list(APPEND expanded_components ${canonical_lib}) |
| | endif( lib_idx LESS 0 ) |
| | endif( c STREQUAL "native" ) |
| | endforeach(c) |
| |
|
| | set(${out_libs} ${expanded_components} PARENT_SCOPE) |
| | endfunction() |
| |
|
| | |
| | |
| | |
| | function(expand_topologically name required_libs visited_libs) |
| | list(FIND visited_libs ${name} found) |
| | if( found LESS 0 ) |
| | list(APPEND visited_libs ${name}) |
| | set(visited_libs ${visited_libs} PARENT_SCOPE) |
| |
|
| | |
| | get_property(libname GLOBAL PROPERTY LLVM_COMPONENT_NAME_${name}) |
| | if(libname) |
| | set(cname LLVM${libname}) |
| | elseif(TARGET ${name}) |
| | set(cname ${name}) |
| | elseif(TARGET LLVM${name}) |
| | set(cname LLVM${name}) |
| | else() |
| | message(FATAL_ERROR "unknown component ${name}") |
| | endif() |
| |
|
| | get_property(lib_deps TARGET ${cname} PROPERTY LLVM_LINK_COMPONENTS) |
| | foreach( lib_dep ${lib_deps} ) |
| | expand_topologically(${lib_dep} "${required_libs}" "${visited_libs}") |
| | set(required_libs ${required_libs} PARENT_SCOPE) |
| | set(visited_libs ${visited_libs} PARENT_SCOPE) |
| | endforeach() |
| |
|
| | list(APPEND required_libs ${cname}) |
| | set(required_libs ${required_libs} PARENT_SCOPE) |
| | endif() |
| | endfunction() |
| |
|
| | |
| | function(llvm_expand_dependencies out_libs) |
| | set(expanded_components ${ARGN}) |
| |
|
| | set(required_libs) |
| | set(visited_libs) |
| | foreach( lib ${expanded_components} ) |
| | expand_topologically(${lib} "${required_libs}" "${visited_libs}") |
| | endforeach() |
| |
|
| | if(required_libs) |
| | list(REVERSE required_libs) |
| | endif() |
| | set(${out_libs} ${required_libs} PARENT_SCOPE) |
| | endfunction() |
| |
|
| | function(explicit_map_components_to_libraries out_libs) |
| | llvm_map_components_to_libnames(link_libs ${ARGN}) |
| | llvm_expand_dependencies(expanded_components ${link_libs}) |
| | |
| | set(result) |
| | foreach(c ${expanded_components}) |
| | if( TARGET ${c} ) |
| | set(result ${result} ${c}) |
| | endif() |
| | endforeach(c) |
| | set(${out_libs} ${result} PARENT_SCOPE) |
| | endfunction(explicit_map_components_to_libraries) |
| |
|