Skip to content

Commit

Permalink
Remove -fsycl getting added to non-SYCL code
Browse files Browse the repository at this point in the history
  • Loading branch information
thilinarmtb committed Nov 21, 2024
1 parent 75b49c7 commit 20714a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ if(OCCA_ENABLE_DPCPP)
if(DPCPP_FOUND)
set(OCCA_DPCPP_ENABLED 1)

message("-- DPCPP flags: ${SYCL_FLAGS}")
message("-- DPCPP include dirs: ${SYCL_INCLUDE_DIRS}")
message("-- DPCPP libraries: ${SYCL_LIBRARIES}")

Expand Down
28 changes: 7 additions & 21 deletions cmake/FindDPCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ message(CHECK_START "Looking for DPC++")
unset(missingDpcppComponents)

find_path(
SYCL_INCLUDE_DIRS
SYCL_INCLUDE_DIR
NAMES
sycl.hpp
sycl/sycl.hpp
PATHS
ENV SYCL_ROOT
/opt/intel/oneapi/compiler/latest/linux
${SYCL_ROOT}
PATH_SUFFIXES
include/sycl
include/CL
include/sycl/CL
)
include/sycl/CL)

find_library(
SYCL_LIBRARIES
Expand All @@ -29,34 +28,21 @@ find_library(
/opt/intel/oneapi/compiler/latest/linux
${SYCL_ROOT}
PATH_SUFFIXES
lib
)

if(NOT DEFINED SYCL_FLAGS)
if(DEFINED ENV{SYCL_FLAGS})
set(SYCL_FLAGS $ENV{SYCL_FLAGS})
else()
set(SYCL_FLAGS -fsycl)
endif()
endif()
lib)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
DPCPP
REQUIRED_VARS
SYCL_INCLUDE_DIRS
SYCL_LIBRARIES
SYCL_FLAGS
)
SYCL_INCLUDE_DIR
SYCL_LIBRARIES)

if(DPCPP_FOUND AND NOT TARGET OCCA::depends::DPCPP)
# Create our wrapper imported target
# Put it in the OCCA namespace to make it clear that we created it.
add_library(OCCA::depends::DPCPP INTERFACE IMPORTED)
separate_arguments(SYCL_FLAGS UNIX_COMMAND "${SYCL_FLAGS}")
target_compile_options(OCCA::depends::DPCPP INTERFACE ${SYCL_FLAGS})
set_target_properties(OCCA::depends::DPCPP PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SYCL_INCLUDE_DIRS}"
INTERFACE_INCLUDE_DIRECTORIES "${SYCL_INCLUDE_DIR};${SYCL_INCLUDE_DIR}/sycl"
INTERFACE_LINK_LIBRARIES "${SYCL_LIBRARIES}"
)
endif()
2 changes: 1 addition & 1 deletion src/occa/internal/modes/dpcpp/polyfill.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define OCCA_MODES_DPCPP_POLYFILL_HEADER

#if OCCA_DPCPP_ENABLED
#include <sycl.hpp>
#include <sycl/sycl.hpp>
#else
#include <cstdint>
#include <vector>
Expand Down

0 comments on commit 20714a6

Please sign in to comment.