1 message(STATUS "Building offloading runtime library libomptarget.")
4 set(LIBOMP ${LIBOMP_STANDALONE})
9 add_llvm_library(omptarget
23 OpenMP/OMPT/Callback.cpp
26 ADDITIONAL_HEADER_DIRS
27 ${LIBOMPTARGET_INCLUDE_DIR}
28 ${LIBOMPTARGET_BINARY_INCLUDE_DIR}
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")
50 # Define the TARGET_NAME and DEBUG_PREFIX.
51 target_compile_definitions(omptarget PRIVATE
53 DEBUG_PREFIX="omptarget"
56 foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
57 target_link_libraries(omptarget PRIVATE omptarget.rtl.${plugin})
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}")