Summary: This is a weird dependency on libomp just for testing if version scripts work. We shouldn't need to do this because LLVM already checks for this. I believe this should be available as well in standalone when we call `addLLVM` but I did not test that directly.
71 lines
1.7 KiB
CMake
71 lines
1.7 KiB
CMake
message(STATUS "Building offloading runtime library libomptarget.")
|
|
|
|
if(LIBOMP_STANDALONE)
|
|
set(LIBOMP ${LIBOMP_STANDALONE})
|
|
else()
|
|
set(LIBOMP omp)
|
|
endif()
|
|
|
|
add_llvm_library(omptarget
|
|
SHARED
|
|
|
|
device.cpp
|
|
interface.cpp
|
|
omptarget.cpp
|
|
OffloadRTL.cpp
|
|
LegacyAPI.cpp
|
|
PluginManager.cpp
|
|
DeviceImage.cpp
|
|
|
|
OpenMP/API.cpp
|
|
OpenMP/Mapping.cpp
|
|
OpenMP/InteropAPI.cpp
|
|
OpenMP/OMPT/Callback.cpp
|
|
|
|
KernelLanguage/API.cpp
|
|
|
|
ADDITIONAL_HEADER_DIRS
|
|
${LIBOMPTARGET_INCLUDE_DIR}
|
|
${LIBOMPTARGET_BINARY_INCLUDE_DIR}
|
|
|
|
LINK_COMPONENTS
|
|
FrontendOpenMP
|
|
Support
|
|
Object
|
|
|
|
LINK_LIBS
|
|
PUBLIC
|
|
${LIBOMP}
|
|
|
|
NO_INSTALL_RPATH
|
|
BUILDTREE_ONLY
|
|
)
|
|
target_include_directories(omptarget PRIVATE
|
|
${LIBOMPTARGET_INCLUDE_DIR} ${LIBOMPTARGET_BINARY_INCLUDE_DIR}
|
|
)
|
|
|
|
if(LLVM_HAVE_LINK_VERSION_SCRIPT)
|
|
target_link_libraries(omptarget PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
|
|
endif()
|
|
|
|
# Define the TARGET_NAME and DEBUG_PREFIX.
|
|
target_compile_definitions(omptarget PRIVATE
|
|
TARGET_NAME=omptarget
|
|
DEBUG_PREFIX="omptarget"
|
|
)
|
|
|
|
foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
|
|
target_link_libraries(omptarget PRIVATE omptarget.rtl.${plugin})
|
|
endforeach()
|
|
|
|
target_compile_options(omptarget PRIVATE ${offload_compile_flags})
|
|
target_link_options(omptarget PRIVATE ${offload_link_flags})
|
|
|
|
# libomptarget.so needs to be aware of where the plugins live as they
|
|
# are now separated in the build directory.
|
|
set_target_properties(omptarget PROPERTIES
|
|
POSITION_INDEPENDENT_CODE ON
|
|
INSTALL_RPATH "$ORIGIN"
|
|
BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
|
|
install(TARGETS omptarget LIBRARY COMPONENT omptarget DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")
|