1# Common interface to handle creating a plugin library. 2set(common_dir ${CMAKE_CURRENT_SOURCE_DIR}/common) 3add_subdirectory(common) 4function(add_target_library target_name lib_name) 5 add_llvm_library(${target_name} STATIC 6 LINK_COMPONENTS 7 AggressiveInstCombine 8 Analysis 9 BinaryFormat 10 BitReader 11 BitWriter 12 CodeGen 13 Core 14 Extensions 15 FrontendOffloading 16 InstCombine 17 Instrumentation 18 IPO 19 IRReader 20 Linker 21 MC 22 Object 23 Passes 24 ProfileData 25 Remarks 26 ScalarOpts 27 Support 28 Target 29 TargetParser 30 TransformUtils 31 Vectorize 32 33 NO_INSTALL_RPATH 34 BUILDTREE_ONLY 35 ) 36 37 llvm_update_compile_flags(${target_name}) 38 target_include_directories(${target_name} PUBLIC ${common_dir}/include) 39 target_link_libraries(${target_name} PRIVATE 40 PluginCommon ${OPENMP_PTHREAD_LIB}) 41 42 target_compile_definitions(${target_name} PRIVATE TARGET_NAME=${lib_name}) 43 target_compile_definitions(${target_name} PRIVATE 44 DEBUG_PREFIX="TARGET ${lib_name} RTL") 45 set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE ON) 46endfunction() 47 48foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD) 49 if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${plugin}) 50 message(FATAL_ERROR "Unknown plugin target '${plugin}'") 51 endif() 52 add_subdirectory(${plugin}) 53endforeach() 54 55# Make sure the parent scope can see the plugins that will be created. 56set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) 57set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE) 58