Skip to content

Commit b3f00e5

Browse files
committed
[build] Update location of OpenMP libraries
By default, LLVM 19 installs libomp and libompd under $CMAKE_INSTALL_PREFIX/lib/$LLVM_HOST_TARGET/. This patch updates CMake and llvm-lit configurations to add the new location to the linker and the loader's search paths.
1 parent 6e7176e commit b3f00e5

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
8383
"--bindir"
8484
"--libdir"
8585
"--includedir"
86-
"--prefix")
86+
"--prefix"
87+
"--host-target")
8788
execute_process(
8889
COMMAND ${CONFIG_COMMAND}
8990
RESULT_VARIABLE HAD_ERROR
@@ -107,6 +108,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
107108
list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
108109
list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
109110
list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
111+
list(GET CONFIG_OUTPUT 5 LLVM_HOST_TARGET)
110112

111113
if(NOT MSVC_IDE)
112114
set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
@@ -158,7 +160,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
158160
endif()
159161

160162
include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
161-
link_directories("${LLVM_LIBRARY_DIR}")
163+
link_directories("${LLVM_LIBRARY_DIR}/${LLVM_HOST_TARGET}")
162164

163165
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
164166
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )

runtime/flangrti/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ if (NOT DEFINED LIBOMP_EXPORT_DIR)
108108
find_library(
109109
FLANG_LIBOMP
110110
NAMES omp libomp
111-
HINTS ${CMAKE_BINARY_DIR}/lib)
111+
HINTS "${LLVM_LIBRARY_DIR}/${LLVM_HOST_TARGET}")
112112
target_link_libraries(flangrti_shared PUBLIC ${FLANG_LIBOMP})
113113
endif()
114114

test/lit.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ if flang_obj_root is not None:
8686
llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
8787
if not llvm_libs_dir:
8888
lit_config.fatal('No LLVM libs dir set!')
89+
host_triple = getattr(config, 'host_triple', None)
90+
if not host_triple:
91+
lit_config.fatal('No LLVM host triple set!')
8992
path = os.path.pathsep.join((llvm_libs_dir,
93+
os.path.sep.join((llvm_libs_dir, host_triple)),
9094
config.environment.get('LD_LIBRARY_PATH','')))
9195
config.environment['LD_LIBRARY_PATH'] = path
9296

0 commit comments

Comments
 (0)