mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-22 03:03:43 +00:00
[Libomptarget] Fix lookup of the libcgpu.a
library
Summary: The `libcgpu.a` library was added to support certain libc functions. A recent patch made us pass its location directly on the commandline, however it used `find_library`. This doesn't work because the ordering of CMake might run `fine_library` before it builds the library we're trying to find. This patch changes this to just use the destimation we know it will end up in and checks it manually.
This commit is contained in:
parent
918829959f
commit
4e9054d391
@ -96,15 +96,6 @@ if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND (LIBC_GPU_BUILD OR
|
||||
set(LIBC_GPU_SUPPORT TRUE)
|
||||
endif()
|
||||
|
||||
# Find the path of the GPU libc static library.
|
||||
find_library(GPU_LIBC_PATH NAMES cgpu
|
||||
PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||
if((NOT GPU_LIBC_PATH) OR (NOT LIBC_GPU_SUPPORT))
|
||||
set(GPU_LIBC_PATH "")
|
||||
endif()
|
||||
|
||||
set(LIBOMPTARGET_GPU_LIBC_PATH ${GPU_LIBC_PATH} CACHE STRING
|
||||
"Location of the 'libcgpu.a' library ")
|
||||
set(LIBOMPTARGET_GPU_LIBC_SUPPORT ${LIBC_GPU_SUPPORT} CACHE BOOL
|
||||
"Libomptarget support for the GPU libc")
|
||||
pythonize_bool(LIBOMPTARGET_GPU_LIBC_SUPPORT)
|
||||
|
@ -153,8 +153,10 @@ def remove_suffix_if_present(name):
|
||||
return name
|
||||
|
||||
def add_libraries(source):
|
||||
return source + " " + config.libomptarget_libc_path + " " + \
|
||||
config.library_dir + "/libomptarget.devicertl.a"
|
||||
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"
|
||||
|
||||
# substitutions
|
||||
# - for targets that exist in the system create the actual command.
|
||||
|
@ -12,6 +12,7 @@ config.cuda_libdir = "@CUDA_LIBDIR@"
|
||||
config.cuda_test_arch = "@LIBOMPTARGET_DEP_CUDA_ARCH@"
|
||||
config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@/@CURRENT_TARGET@"
|
||||
config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@"
|
||||
config.llvm_library_dir = "@LIBOMPTARGET_LLVM_LIBRARY_DIR@"
|
||||
config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@"
|
||||
config.omp_host_rtl_directory = "@LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER@"
|
||||
config.llvm_lib_directory = "@LIBOMPTARGET_LLVM_LIBRARY_DIR@"
|
||||
@ -23,7 +24,6 @@ config.libomptarget_not = "@OPENMP_NOT_EXECUTABLE@"
|
||||
config.libomptarget_debug = @LIBOMPTARGET_DEBUG@
|
||||
config.has_libomptarget_ompt = @LIBOMPTARGET_OMPT_SUPPORT@
|
||||
config.libomptarget_has_libc = @LIBOMPTARGET_GPU_LIBC_SUPPORT@
|
||||
config.libomptarget_libc_path = "@LIBOMPTARGET_GPU_LIBC_PATH@"
|
||||
|
||||
# Let the main config do the real work.
|
||||
lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")
|
||||
|
Loading…
x
Reference in New Issue
Block a user