[Headers] [ARM64EC] Fix extra tokens inside intrin0.h preprocessor directive (#112066)
[llvm-project.git] / offload / src / CMakeLists.txt
blobefa5cdab33ec9079e1122e05510a3848ea4218e6
1 message(STATUS "Building offloading runtime library libomptarget.")
3 if(LIBOMP_STANDALONE)
4   set(LIBOMP ${LIBOMP_STANDALONE})
5 else()
6   set(LIBOMP omp)
7 endif()
9 add_llvm_library(omptarget
10   SHARED
12   device.cpp
13   interface.cpp
14   omptarget.cpp
15   OffloadRTL.cpp
16   LegacyAPI.cpp
17   PluginManager.cpp
18   DeviceImage.cpp
20   OpenMP/API.cpp
21   OpenMP/Mapping.cpp
22   OpenMP/InteropAPI.cpp
23   OpenMP/OMPT/Callback.cpp
26   ADDITIONAL_HEADER_DIRS
27   ${LIBOMPTARGET_INCLUDE_DIR}
28   ${LIBOMPTARGET_BINARY_INCLUDE_DIR}
30   LINK_COMPONENTS
31   Support
32   Object
34   LINK_LIBS
35   PUBLIC
36   ${LIBOMP}
38   NO_INSTALL_RPATH
39   BUILDTREE_ONLY
41 target_include_directories(omptarget PRIVATE
42   ${LIBOMPTARGET_INCLUDE_DIR} ${LIBOMPTARGET_BINARY_INCLUDE_DIR}
45 if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
46   target_link_libraries(omptarget PRIVATE
47     "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
48 endif()
50 # Define the TARGET_NAME and DEBUG_PREFIX.
51 target_compile_definitions(omptarget PRIVATE
52   TARGET_NAME=omptarget
53   DEBUG_PREFIX="omptarget"
56 foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
57   target_link_libraries(omptarget PRIVATE omptarget.rtl.${plugin})
58 endforeach()
60 target_compile_options(omptarget PRIVATE ${offload_compile_flags})
61 target_link_options(omptarget PRIVATE ${offload_link_flags})
63 # libomptarget.so needs to be aware of where the plugins live as they
64 # are now separated in the build directory.
65 set_target_properties(omptarget PROPERTIES
66                       POSITION_INDEPENDENT_CODE ON
67                       INSTALL_RPATH "$ORIGIN"
68                       BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
69 install(TARGETS omptarget LIBRARY COMPONENT omptarget DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")