brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · a72befd Raw
60 lines · plain
1# Common interface to handle creating a plugin library.2set(common_dir ${CMAKE_CURRENT_SOURCE_DIR}/common)3set(common_bin_dir ${CMAKE_CURRENT_BINARY_DIR}/common)4add_subdirectory(common)5function(add_target_library target_name lib_name)6  add_llvm_library(${target_name} STATIC7    LINK_COMPONENTS8      AggressiveInstCombine9      Analysis10      BinaryFormat11      BitReader12      BitWriter13      CodeGen14      Core15      Extensions16      FrontendOffloading17      InstCombine18      Instrumentation19      IPO20      IRReader21      Linker22      MC23      Object24      Passes25      ProfileData26      Remarks27      ScalarOpts28      Support29      Target30      TargetParser31      TransformUtils32      Vectorize33 34    NO_INSTALL_RPATH35    BUILDTREE_ONLY36  )37 38  llvm_update_compile_flags(${target_name})39  target_include_directories(${target_name} PUBLIC ${common_dir}/include40                             ${common_bin_dir}/include)41  target_link_libraries(${target_name} PRIVATE42                        PluginCommon ${OPENMP_PTHREAD_LIB})43 44  target_compile_definitions(${target_name} PRIVATE TARGET_NAME=${lib_name})45  target_compile_definitions(${target_name} PRIVATE46                             DEBUG_PREFIX="TARGET ${lib_name} RTL")47  set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE ON)48endfunction()49 50foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)51  if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${plugin})52    message(FATAL_ERROR "Unknown plugin target '${plugin}'")53  endif()54  add_subdirectory(${plugin})55endforeach()56 57# Make sure the parent scope can see the plugins that will be created.58set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)59set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)60