1 message(STATUS "Building offloading runtime library libomptarget.")
4 set(LIBOMP ${LIBOMP_STANDALONE})
9 add_llvm_library(omptarget
23 OpenMP/OMPT/Callback.cpp
25 KernelLanguage/API.cpp
27 ADDITIONAL_HEADER_DIRS
28 ${LIBOMPTARGET_INCLUDE_DIR}
29 ${LIBOMPTARGET_BINARY_INCLUDE_DIR}
43 target_include_directories(omptarget PRIVATE
44 ${LIBOMPTARGET_INCLUDE_DIR} ${LIBOMPTARGET_BINARY_INCLUDE_DIR}
47 if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
48 target_link_libraries(omptarget PRIVATE
49 "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
52 # Define the TARGET_NAME and DEBUG_PREFIX.
53 target_compile_definitions(omptarget PRIVATE
55 DEBUG_PREFIX="omptarget"
58 foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
59 target_link_libraries(omptarget PRIVATE omptarget.rtl.${plugin})
62 target_compile_options(omptarget PRIVATE ${offload_compile_flags})
63 target_link_options(omptarget PRIVATE ${offload_link_flags})
65 # libomptarget.so needs to be aware of where the plugins live as they
66 # are now separated in the build directory.
67 set_target_properties(omptarget PROPERTIES
68 POSITION_INDEPENDENT_CODE ON
69 INSTALL_RPATH "$ORIGIN"
70 BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
71 install(TARGETS omptarget LIBRARY COMPONENT omptarget DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")