[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / mlir / cmake / modules / FindSyclRuntime.cmake
blob9e6ae0402584877f9826272a9a891000929664b7
1 # CMake find_package() module for SYCL Runtime
3 # Example usage:
5 # find_package(SyclRuntime)
7 # If successful, the following variables will be defined:
8 # SyclRuntime_FOUND
9 # SyclRuntime_INCLUDE_DIRS
10 # SyclRuntime_LIBRARY
11 # SyclRuntime_LIBRARIES_DIR
14 include(FindPackageHandleStandardArgs)
16 if(NOT DEFINED ENV{CMPLR_ROOT})
17     message(WARNING "Please make sure to install Intel DPC++ Compiler and run setvars.(sh/bat)")
18     message(WARNING "You can download standalone Intel DPC++ Compiler from https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html#compilers")
19 else()
20     get_filename_component(ONEAPI_VER "$ENV{CMPLR_ROOT}" NAME)
21     if(ONEAPI_VER VERSION_LESS 2024.0)
22         if(LINUX OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux"))
23             set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/linux")
24         elseif(WIN32)
25             set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/windows")
26         endif()
27     else()
28         set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}")
29     endif()
30     list(APPEND SyclRuntime_INCLUDE_DIRS "${SyclRuntime_ROOT}/include")
31     list(APPEND SyclRuntime_INCLUDE_DIRS "${SyclRuntime_ROOT}/include/sycl")
33     set(SyclRuntime_LIBRARY_DIR "${SyclRuntime_ROOT}/lib")
35     message(STATUS "SyclRuntime_LIBRARY_DIR: ${SyclRuntime_LIBRARY_DIR}")
36     find_library(SyclRuntime_LIBRARY
37         NAMES sycl
38         PATHS ${SyclRuntime_LIBRARY_DIR}
39         NO_DEFAULT_PATH
40         )
41 endif()
43 if(SyclRuntime_LIBRARY)
44     set(SyclRuntime_FOUND TRUE)
45     if(NOT TARGET SyclRuntime::SyclRuntime)
46         add_library(SyclRuntime::SyclRuntime INTERFACE IMPORTED)
47         set_target_properties(SyclRuntime::SyclRuntime
48             PROPERTIES INTERFACE_LINK_LIBRARIES "${SyclRuntime_LIBRARY}"
49       )
50       set_target_properties(SyclRuntime::SyclRuntime
51           PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SyclRuntime_INCLUDE_DIRS}"
52       )
53     endif()
54 else()
55     set(SyclRuntime_FOUND FALSE)
56 endif()
58 find_package_handle_standard_args(SyclRuntime
59     REQUIRED_VARS
60         SyclRuntime_FOUND
61         SyclRuntime_INCLUDE_DIRS
62         SyclRuntime_LIBRARY
63         SyclRuntime_LIBRARY_DIR
64     HANDLE_COMPONENTS
67 mark_as_advanced(SyclRuntime_LIBRARY SyclRuntime_INCLUDE_DIRS)
69 if(SyclRuntime_FOUND)
70     find_package_message(SyclRuntime "Found SyclRuntime: ${SyclRuntime_LIBRARY}" "")
71 else()
72     find_package_message(SyclRuntime "Could not find SyclRuntime" "")
73 endif()