Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Offload] Fix per-target install directory #89645

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Apr 22, 2024

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.

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.
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 22, 2024

@llvm/pr-subscribers-offload

Author: Joseph Huber (jhuber6)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/89645.diff

1 Files Affected:

  • (modified) offload/CMakeLists.txt (+15-2)
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)
 

Copy link
Contributor

@estewart08 estewart08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jhuber6 jhuber6 merged commit a6f1b3a into llvm:main Apr 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants