[Openmp-commits] [openmp] [Libomptarget] Output the DeviceRTL alongside the other libraries (PR #73705)
Joseph Huber via Openmp-commits
openmp-commits at lists.llvm.org
Tue Nov 28 14:43:23 PST 2023
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/73705
>From f94ffdd4f4cda94795a5900aa611c5fdbc847f88 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 28 Nov 2023 16:03:36 -0600
Subject: [PATCH 1/2] [Libomptarget] Output the DeviceRTL alongside the other
libraries
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/DeviceRTL/CMakeLists.txt | 5 ++++-
openmp/libomptarget/test/lit.cfg | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt
index df8e4a5126fd443..5a5b882b3d08330 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
+ LINKER_LANGUAGE CXX
+ ARCHIVE_OUTPUT_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR}
+)
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 6dab31bd35a9f31..fb221041b4be5a1 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_dir + "/libomptarget.devicertl.a"
+ return source + " " + config.llvm_library_dir + "/libomptarget.devicertl.a"
# substitutions
# - for targets that exist in the system create the actual command.
>From 22944800c5c95d301e4c7b2dc9af0e88db33b17d Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 28 Nov 2023 16:43:10 -0600
Subject: [PATCH 2/2] Update location for standalone
---
openmp/libomptarget/DeviceRTL/CMakeLists.txt | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt
index 5a5b882b3d08330..43458517f07f2f5 100644
--- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt
+++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt
@@ -301,10 +301,13 @@ 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
- ARCHIVE_OUTPUT_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR}
-)
+set_target_properties(omptarget.devicertl PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(omptarget.devicertl PRIVATE omptarget.devicertl.all_objs)
+# Install this alongside the LLVM libraries is possible.
+if(NOT OPENMP_STANDALONE_BUILD)
+ set_target_properties(omptarget.devicertl PROPERTIES
+ ARCHIVE_OUTPUT_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR})
+endif()
+
install(TARGETS omptarget.devicertl ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR})
More information about the Openmp-commits
mailing list