diff --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt index 61bcb46504d43..50c59cb2e02e1 100644 --- a/openmp/libomptarget/CMakeLists.txt +++ b/openmp/libomptarget/CMakeLists.txt @@ -88,6 +88,16 @@ endif() pythonize_bool(LIBOMPTARGET_OMPT_SUPPORT) +# Check if this build supports the GPU libc. +set(LIBC_GPU_SUPPORT FALSE) +if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND (LIBC_GPU_BUILD OR + LIBC_GPU_ARCHITECTURES)) + set(LIBC_GPU_SUPPORT TRUE) +endif() +set(LIBOMPTARGET_GPU_LIBC_SUPPORT ${LIBC_GPU_SUPPORT} CACHE BOOL + "Libomptarget support for the GPU libc") +pythonize_bool(LIBOMPTARGET_GPU_LIBC_SUPPORT) + set(LIBOMPTARGET_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) message(STATUS "OpenMP tools dir in libomptarget: ${LIBOMP_OMP_TOOLS_INCLUDE_DIR}") include_directories(${LIBOMP_OMP_TOOLS_INCLUDE_DIR}) diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt index 087125fd8b937..1801b0ebd7ddc 100644 --- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt +++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt @@ -63,23 +63,18 @@ target_link_libraries(PluginInterface ) # Include the RPC server from the `libc` project if availible. -set(libomptarget_supports_rpc FALSE) -if(TARGET llvmlibc_rpc_server) +if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT}) target_link_libraries(PluginInterface PRIVATE llvmlibc_rpc_server) target_compile_definitions(PluginInterface PRIVATE LIBOMPTARGET_RPC_SUPPORT) - set(libomptarget_supports_rpc TRUE) -else() +elseif(${LIBOMPTARGET_GPU_LIBC_SUPPORT}) find_library(llvmlibc_rpc_server NAMES llvmlibc_rpc_server PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH) if(llvmlibc_rpc_server) message(WARNING ${llvmlibc_rpc_server}) target_link_libraries(PluginInterface PRIVATE llvmlibc_rpc_server) target_compile_definitions(PluginInterface PRIVATE LIBOMPTARGET_RPC_SUPPORT) - set(libomptarget_supports_rpc TRUE) endif() endif() -set(LIBOMPTARGET_GPU_LIBC_SUPPORT ${libomptarget_supports_rpc} CACHE BOOL - "Libomptarget support for the GPU libc") if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT)) target_link_libraries(PluginInterface PUBLIC OMPT) diff --git a/openmp/libomptarget/test/lit.site.cfg.in b/openmp/libomptarget/test/lit.site.cfg.in index 47bd8b6450bc4..ffe9e182df49e 100644 --- a/openmp/libomptarget/test/lit.site.cfg.in +++ b/openmp/libomptarget/test/lit.site.cfg.in @@ -22,7 +22,7 @@ config.libomptarget_not = "@OPENMP_NOT_EXECUTABLE@" config.libomptarget_debug = @LIBOMPTARGET_DEBUG@ config.has_libomptarget_ompt = @LIBOMPTARGET_OMPT_SUPPORT@ config.llvm_enabled_projects = "@LLVM_ENABLE_PROJECTS@".split(";") -config.libomptarget_has_libc = "@LIBOMPTARGET_GPU_LIBC_SUPPORT@" +config.libomptarget_has_libc = @LIBOMPTARGET_GPU_LIBC_SUPPORT@ import lit.llvm lit.llvm.initialize(lit_config, config)