forked from OSchip/llvm-project
[libomptarget] Require LLVM source tree to build libomptarget
[libomptarget] Require LLVM source tree to build libomptarget This is to permit reliably #including files from the LLVM tree in libomptarget, as an improvement on the copy and paste that is currently in use. See D87841 for the first example of removing duplication given this new requirement. The weekly openmp dev call reached consensus on this approach. See also D87841 for some alternatives that were considered. In the future, we may want to introduce a new top level repo for shared constants, or start using the ADT library within openmp. This will break sufficiently exotic build systems, trivial fixes as below. Building libomptarget as part of the monorepo will continue to work. If openmp is built separately, it now requires a cmake macro indicating where to find the LLVM source tree. If openmp is built separately, without the llvm source tree already on disk, the build machine will need a copy of a subset of the llvm source tree and the cmake macro indicating where it is. Reviewed By: protze.joachim Differential Revision: https://reviews.llvm.org/D89426
This commit is contained in:
parent
bf9edcb6fd
commit
26790ed248
|
@ -66,6 +66,20 @@ if (APPLE OR WIN32 OR NOT OPENMP_HAVE_STD_CPP14_FLAG)
|
|||
set(ENABLE_LIBOMPTARGET OFF)
|
||||
endif()
|
||||
|
||||
# Attempt to locate LLVM source, required by libomptarget
|
||||
if (NOT LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR)
|
||||
if (LLVM_MAIN_INCLUDE_DIR)
|
||||
set(LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_INCLUDE_DIR})
|
||||
elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../llvm/include)
|
||||
set(LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../llvm/include)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR)
|
||||
message(STATUS "Missing definition for LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR, disabling libomptarget")
|
||||
set(ENABLE_LIBOMPTARGET OFF)
|
||||
endif()
|
||||
|
||||
option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading."
|
||||
${ENABLE_LIBOMPTARGET})
|
||||
if (OPENMP_ENABLE_LIBOMPTARGET)
|
||||
|
|
|
@ -29,6 +29,11 @@ include(LibomptargetUtils)
|
|||
# Get dependencies for the different components of the project.
|
||||
include(LibomptargetGetDependencies)
|
||||
|
||||
# LLVM source tree is required at build time for libomptarget
|
||||
if (NOT LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "Missing definition for LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR")
|
||||
endif()
|
||||
|
||||
# This is a list of all the targets that are supported/tested right now.
|
||||
set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} aarch64-unknown-linux-gnu")
|
||||
set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} powerpc64le-ibm-linux-gnu")
|
||||
|
|
|
@ -30,8 +30,8 @@ if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(ppc64le)|(aarch64)$" AND CMAKE_
|
|||
return()
|
||||
endif()
|
||||
|
||||
if (NOT LLVM_MAIN_INCLUDE_DIR)
|
||||
libomptarget_say("Not building AMDGPU plugin: Missing definition for LLVM_MAIN_INCLUDE_DIR")
|
||||
if (NOT LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR)
|
||||
libomptarget_say("Not building AMDGPU plugin: Missing definition for LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
@ -50,7 +50,7 @@ endif()
|
|||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/impl
|
||||
${LLVM_MAIN_INCLUDE_DIR}
|
||||
${LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
add_library(omptarget.rtl.amdgpu SHARED
|
||||
|
|
Loading…
Reference in New Issue