Skip to content

Commit

Permalink
Update FindDPCPP to find new include path (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rbiessy authored Mar 12, 2024
1 parent f859108 commit 653fde8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cmake/Modules/FindDPCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ include(FindPackageHandleStandardArgs)
get_filename_component(DPCPP_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
find_library(DPCPP_LIB NAMES sycl sycl6 PATHS "${DPCPP_BIN_DIR}/../lib")

# Look for the include directory containing SYCL headers in multiple possible locations
find_path(DPCPP_INCLUDE_DIR sycl
HINTS ${DPCPP_BIN_DIR}/../include ${DPCPP_BIN_DIR}/../../include
NO_DEFAULT_PATH
)

find_package_handle_standard_args(DPCPP
FOUND_VAR DPCPP_FOUND
REQUIRED_VARS DPCPP_LIB
REQUIRED_VARS DPCPP_LIB DPCPP_INCLUDE_DIR
)

if(NOT DPCPP_FOUND)
return()
endif()

mark_as_advanced(DPCPP_FOUND DPCPP_LIB)
mark_as_advanced(DPCPP_FOUND DPCPP_LIB DPCPP_INCLUDE_DIR)

if(DPCPP_FOUND AND NOT TARGET DPCPP::DPCPP)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -49,7 +51,8 @@ if(DPCPP_FOUND AND NOT TARGET DPCPP::DPCPP)
INTERFACE_COMPILE_OPTIONS ${COMPILE_FLAGS}
INTERFACE_LINK_OPTIONS ${COMPILE_FLAGS}
INTERFACE_LINK_LIBRARIES ${DPCPP_LIB}
INTERFACE_INCLUDE_DIRECTORIES "${DPCPP_BIN_DIR}/../include/sycl;${DPCPP_BIN_DIR}/../include")
INTERFACE_INCLUDE_DIRECTORIES "${DPCPP_INCLUDE_DIR}"
)
endif()

function(add_sycl_to_target)
Expand Down

0 comments on commit 653fde8

Please sign in to comment.