1 # CMake find_package() module for SYCL Runtime
5 # find_package(SyclRuntime)
7 # If successful, the following variables will be defined:
9 # SyclRuntime_INCLUDE_DIRS
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")
20 if(LINUX OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux"))
21 set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/linux")
23 set(SyclRuntime_ROOT "$ENV{CMPLR_ROOT}/windows")
25 list(APPEND SyclRuntime_INCLUDE_DIRS "${SyclRuntime_ROOT}/include")
26 list(APPEND SyclRuntime_INCLUDE_DIRS "${SyclRuntime_ROOT}/include/sycl")
28 set(SyclRuntime_LIBRARY_DIR "${SyclRuntime_ROOT}/lib")
30 message(STATUS "SyclRuntime_LIBRARY_DIR: ${SyclRuntime_LIBRARY_DIR}")
31 find_library(SyclRuntime_LIBRARY
33 PATHS ${SyclRuntime_LIBRARY_DIR}
38 if(SyclRuntime_LIBRARY)
39 set(SyclRuntime_FOUND TRUE)
40 if(NOT TARGET SyclRuntime::SyclRuntime)
41 add_library(SyclRuntime::SyclRuntime INTERFACE IMPORTED)
42 set_target_properties(SyclRuntime::SyclRuntime
43 PROPERTIES INTERFACE_LINK_LIBRARIES "${SyclRuntime_LIBRARY}"
45 set_target_properties(SyclRuntime::SyclRuntime
46 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SyclRuntime_INCLUDE_DIRS}"
50 set(SyclRuntime_FOUND FALSE)
53 find_package_handle_standard_args(SyclRuntime
56 SyclRuntime_INCLUDE_DIRS
58 SyclRuntime_LIBRARY_DIR
62 mark_as_advanced(SyclRuntime_LIBRARY SyclRuntime_INCLUDE_DIRS)
65 find_package_message(SyclRuntime "Found SyclRuntime: ${SyclRuntime_LIBRARY}" "")
67 find_package_message(SyclRuntime "Could not find SyclRuntime" "")