1 # Common interface to handle creating a plugin library.
2 set(common_dir ${CMAKE_CURRENT_SOURCE_DIR}/common)
3 add_subdirectory(common)
4 function(add_target_library target_name lib_name)
5 add_llvm_library(${target_name} STATIC
35 llvm_update_compile_flags(${target_name})
36 target_include_directories(${target_name} PUBLIC ${common_dir}/include)
37 target_link_libraries(${target_name} PRIVATE
38 PluginCommon ${OPENMP_PTHREAD_LIB})
40 target_compile_definitions(${target_name} PRIVATE TARGET_NAME=${lib_name})
41 target_compile_definitions(${target_name} PRIVATE
42 DEBUG_PREFIX="TARGET ${lib_name} RTL")
43 set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
46 foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
47 if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${plugin})
48 message(FATAL_ERROR "Unknown plugin target '${plugin}'")
50 add_subdirectory(${plugin})
53 # Make sure the parent scope can see the plugins that will be created.
54 set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
55 set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)