[X86][MC,LLD][NFC] Rename R_X86_64_REX2_GOTPCRELX (#116737)
[llvm-project.git] / offload / plugins-nextgen / host / CMakeLists.txt
blobcbfe4b951af453d14dc788a28b9409c4b35364c9
1 set(supported_targets x86_64 aarch64 ppc64 ppc64le riscv64 s390x)
2 if(NOT ${CMAKE_SYSTEM_PROCESSOR} IN_LIST supported_targets)
3   message(STATUS "Not building ${machine} NextGen offloading plugin")
4   return()
5 endif()
7 set(machine ${CMAKE_SYSTEM_PROCESSOR})
8 if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$")
9   set(machine ppc64)
10 endif()
12 # Create the library and add the default arguments.
13 add_target_library(omptarget.rtl.host ${machine})
15 target_sources(omptarget.rtl.host PRIVATE src/rtl.cpp)
17 if(LIBOMPTARGET_DEP_LIBFFI_FOUND)
18   message(STATUS "Building ${machine} plugin linked with libffi")
19   if(FFI_STATIC_LIBRARIES)
20     target_link_libraries(omptarget.rtl.host PRIVATE FFI::ffi_static)
21   else()
22     target_link_libraries(omptarget.rtl.host PRIVATE FFI::ffi)
23   endif()
24 else()
25   message(STATUS "Building ${machine} plugin for dlopened libffi")
26   target_sources(omptarget.rtl.host PRIVATE dynamic_ffi/ffi.cpp)
27   target_include_directories(omptarget.rtl.host PRIVATE dynamic_ffi)
28 endif()
30 target_include_directories(omptarget.rtl.host PRIVATE
31                            ${LIBOMPTARGET_INCLUDE_DIR})
33 if(LIBOMPTARGET_DEP_LIBFFI_FOUND)
34   list(APPEND LIBOMPTARGET_TESTED_PLUGINS omptarget.rtl.host)
35   set(LIBOMPTARGET_TESTED_PLUGINS
36       "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)
37 else()
38   message(STATUS "Not generating ${tmachine_name} tests. LibFFI not found.")
39 endif()
41 # Define the target specific triples and ELF machine values.
42 if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$")
43   list(APPEND LIBOMPTARGET_SYSTEM_TARGETS
44        "powerpc64le-ibm-linux-gnu" "powerpc64le-ibm-linux-gnu-LTO")
45   set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
46 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64$")
47   list(APPEND LIBOMPTARGET_SYSTEM_TARGETS
48        "powerpc64-ibm-linux-gnu" "powerpc64-ibm-linux-gnu-LTO")
49   set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
50 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64$")
51   list(APPEND LIBOMPTARGET_SYSTEM_TARGETS
52        "x86_64-unknown-linux-gnu" "x86_64-unknown-linux-gnu-LTO")
53   set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
54 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64$")
55   list(APPEND LIBOMPTARGET_SYSTEM_TARGETS
56        "aarch64-unknown-linux-gnu" "aarch64-unknown-linux-gnu-LTO")
57   set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
58 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x$")
59   list(APPEND LIBOMPTARGET_SYSTEM_TARGETS
60        "s390x-ibm-linux-gnu" "s390x-ibm-linux-gnu-LTO")
61   set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
62 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64$")
63   list(APPEND LIBOMPTARGET_SYSTEM_TARGETS
64        "riscv64-unknown-linux-gnu" "riscv64-unknown-linux-gnu-LTO")
65   set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
66 endif()