[llvm] [Offload] Fix per-target install directory (PR #89645)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 22 11:21:33 PDT 2024
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/89645
Summary:
The move from `openmp` to `offload` did not preserve the per-target
runtime directory installation. This is important because this
per-target directory is always included first and is likely the de-facto
way to handle these going forward. Without this installation, old
installations of the library will be linked against first.
>From 41ef2fa1713a13d943bc95b642ad1ea1f1b0a16b Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Mon, 22 Apr 2024 13:18:53 -0500
Subject: [PATCH] [Offload] Fix per-target install directory
Summary:
The move from `openmp` to `offload` did not preserve the per-target
runtime directory installation. This is important because this
per-target directory is always included first and is likely the de-facto
way to handle these going forward. Without this installation, old
installations of the library will be linked against first.
---
offload/CMakeLists.txt | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index b23ffdcbd5aa87..abc8baa0805ffd 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -39,8 +39,21 @@ if (OPENMP_ENABLE_LIBOMPTARGET)
endif()
endif()
-# TODO: Leftover from the move, could probably be just LLVM_LIBDIR_SUFFIX everywhere.
-set(OFFLOAD_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
+if(OPENMP_STANDALONE_BUILD)
+ set(OFFLOAD_LIBDIR_SUFFIX "" CACHE STRING
+ "Suffix of lib installation directory, e.g. 64 => lib64")
+ set(OFFLOAD_INSTALL_LIBDIR "lib${OFFLOAD_LIBDIR_SUFFIX}" CACHE STRING
+ "Path where built offload libraries should be installed.")
+else()
+ # When building in tree we install the runtime according to the LLVM settings.
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(OFFLOAD_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING
+ "Path where built offload libraries should be installed.")
+ else()
+ set(OFFLOAD_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING
+ "Path where built offload libraries should be installed.")
+ endif()
+endif()
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
More information about the llvm-commits
mailing list