From 0ec4b82cfddbe0c7c7eb4b3486f55139f56d5f16 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Thu, 30 Nov 2023 15:48:39 -0600 Subject: [Libomptarget] Output the DeviceRTL alongside the other libraries (#73705) Summary: Currently, the `libomp.so` and `libomptarget.so` are emitted in the `./lib` build directory generally. This logic is internal to the `add_llvm_library` function we use to build `libomptarget`. The DeviceRTl static library however is in the middle of the OpenMP runtime build, which can vary depending on if this is a runtimes or projects build. This patch changes this to install the DeviceRTL static library alongside the other OpenMP libraries so they are easier to find. --- openmp/libomptarget/CMakeLists.txt | 8 ++++++++ openmp/libomptarget/DeviceRTL/CMakeLists.txt | 5 ++++- openmp/libomptarget/test/lit.cfg | 4 ++-- openmp/libomptarget/test/lit.site.cfg.in | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'openmp') diff --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt index 5f592f4..972b887 100644 --- a/openmp/libomptarget/CMakeLists.txt +++ b/openmp/libomptarget/CMakeLists.txt @@ -24,6 +24,12 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBOMPTARGET_LIBRARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBOMPTARGET_LIBRARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBOMPTARGET_LIBRARY_DIR}) +if(LLVM_LIBRARY_OUTPUT_INTDIR) + set(LIBOMPTARGET_INTDIR ${LIBOMPTARGET_LIBRARY_DIR}) +else() + set(LIBOMPTARGET_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) +endif() + # Message utilities. include(LibomptargetUtils) @@ -115,6 +121,8 @@ set(LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER "${LIBOMP_LIBRARY_DIR}" CACHE STRING "Path to folder containing libomp.so, and libLLVMSupport.so with profiling enabled") set(LIBOMPTARGET_LLVM_LIBRARY_DIR "${LLVM_LIBRARY_DIR}" CACHE STRING "Path to folder containing llvm library libomptarget.so") +set(LIBOMPTARGET_LLVM_LIBRARY_INTDIR "${LIBOMPTARGET_INTDIR}" CACHE STRING + "Path to folder where intermediate libraries will be output") # Build offloading plugins and device RTLs if they are available. add_subdirectory(plugins-nextgen) diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt index df8e4a5..104b650 100644 --- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt +++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt @@ -301,7 +301,10 @@ endforeach() # Archive all the object files generated above into a static library add_library(omptarget.devicertl STATIC) -set_target_properties(omptarget.devicertl PROPERTIES LINKER_LANGUAGE CXX) +set_target_properties(omptarget.devicertl PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${LIBOMPTARGET_LLVM_LIBRARY_INTDIR} + LINKER_LANGUAGE CXX +) target_link_libraries(omptarget.devicertl PRIVATE omptarget.devicertl.all_objs) install(TARGETS omptarget.devicertl ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR}) diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg index 6dab31b..adbdd7c 100644 --- a/openmp/libomptarget/test/lit.cfg +++ b/openmp/libomptarget/test/lit.cfg @@ -156,8 +156,8 @@ def remove_suffix_if_present(name): def add_libraries(source): if config.libomptarget_has_libc: return source + " " + config.llvm_library_dir + "/libcgpu.a " + \ - config.library_dir + "/libomptarget.devicertl.a" - return source + " " + config.library_dir + "/libomptarget.devicertl.a" + config.llvm_library_intdir + "/libomptarget.devicertl.a" + return source + " " + config.llvm_library_intdir + "/libomptarget.devicertl.a" # substitutions # - for targets that exist in the system create the actual command. diff --git a/openmp/libomptarget/test/lit.site.cfg.in b/openmp/libomptarget/test/lit.site.cfg.in index 2c6b90a..2d63811 100644 --- a/openmp/libomptarget/test/lit.site.cfg.in +++ b/openmp/libomptarget/test/lit.site.cfg.in @@ -13,6 +13,7 @@ config.cuda_test_arch = "@LIBOMPTARGET_DEP_CUDA_ARCH@" config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@/@CURRENT_TARGET@" config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@" config.llvm_library_dir = "@LIBOMPTARGET_LLVM_LIBRARY_DIR@" +config.llvm_library_intdir = "@LIBOMPTARGET_LLVM_LIBRARY_INTDIR@" config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@" config.omp_host_rtl_directory = "@LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER@" config.llvm_lib_directory = "@LIBOMPTARGET_LLVM_LIBRARY_DIR@" -- cgit v1.1