[clang-tidy][NFC]remove deps of clang in clang tidy test (#116588)
[llvm-project.git] / offload / plugins-nextgen / CMakeLists.txt
blobd31bf557669eac07f9244fed14f54dbea43957f9
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
6     LINK_COMPONENTS
7       AggressiveInstCombine
8       Analysis
9       BinaryFormat
10       BitReader
11       BitWriter
12       CodeGen
13       Core
14       Extensions
15       InstCombine
16       Instrumentation
17       IPO
18       IRReader
19       Linker
20       MC
21       Object
22       Passes
23       Remarks
24       ScalarOpts
25       Support
26       Target
27       TargetParser
28       TransformUtils
29       Vectorize
31     NO_INSTALL_RPATH
32     BUILDTREE_ONLY
33   )
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)
44 endfunction()
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}'")
49   endif()
50   add_subdirectory(${plugin})
51 endforeach()
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)