Skip to content

Commit a6f1b3a

Browse files
authored
[Offload] Fix per-target install directory (llvm#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.
1 parent 6b1b4c1 commit a6f1b3a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

offload/CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,21 @@ if (OPENMP_ENABLE_LIBOMPTARGET)
3939
endif()
4040
endif()
4141

42-
# TODO: Leftover from the move, could probably be just LLVM_LIBDIR_SUFFIX everywhere.
43-
set(OFFLOAD_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
42+
if(OPENMP_STANDALONE_BUILD)
43+
set(OFFLOAD_LIBDIR_SUFFIX "" CACHE STRING
44+
"Suffix of lib installation directory, e.g. 64 => lib64")
45+
set(OFFLOAD_INSTALL_LIBDIR "lib${OFFLOAD_LIBDIR_SUFFIX}" CACHE STRING
46+
"Path where built offload libraries should be installed.")
47+
else()
48+
# When building in tree we install the runtime according to the LLVM settings.
49+
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
50+
set(OFFLOAD_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING
51+
"Path where built offload libraries should be installed.")
52+
else()
53+
set(OFFLOAD_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING
54+
"Path where built offload libraries should be installed.")
55+
endif()
56+
endif()
4457

4558
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
4659

0 commit comments

Comments
 (0)