Skip to content

Commit

Permalink
Include DPCT headers from system installation and remove the local copy
Browse files Browse the repository at this point in the history
  • Loading branch information
rafbiels committed Jul 11, 2023
1 parent 1e90d3e commit b04d23f
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 4,514 deletions.
35 changes: 35 additions & 0 deletions cmake/Finddpct.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
if (WIN32)
find_path( dpct_INCLUDE_DIR
NAMES
dpct/dpct.hpp
PATHS
${dpct_LOCATION}/include
$ENV{dpct_LOCATION}/include
$ENV{DPCT_BUNDLE_ROOT}/include
$ENV{ONEAPI_ROOT}/dpcpp-ct/latest/include
$ENV{PROGRAMFILES}/include
NO_DEFAULT_PATH
DOC "The directory where dpct/dpct.hpp resides"
)
else()
find_path( dpct_INCLUDE_DIR
NAMES
dpct/dpct.hpp
PATHS
${dpct_LOCATION}/include
$ENV{dpct_LOCATION}/include
$ENV{DPCT_BUNDLE_ROOT}/include
$ENV{ONEAPI_ROOT}/dpcpp-ct/latest/include
/opt/intel/oneapi/dpcpp-ct/latest/include
/usr/include
/usr/local/include
/sw/include
/opt/local/include
NO_DEFAULT_PATH
DOC "The directory where dpct/dpct.hpp resides"
)
endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( dpct REQUIRED_VARS dpct_INCLUDE_DIR )

3 changes: 2 additions & 1 deletion src_sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pkg_check_modules(Glew REQUIRED IMPORTED_TARGET glew)
find_package(glm REQUIRED)
find_package(glfw3 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(dpct REQUIRED)

set(COMMON_SOURCE
nbody.cpp
Expand All @@ -26,7 +27,7 @@ target_compile_definitions(${BINARY_NAME} PRIVATE -DUSE_OPENGL COMPILER_NAME="SY

target_compile_features(${BINARY_NAME} PRIVATE cxx_auto_type cxx_nullptr cxx_range_for)

target_include_directories(${BINARY_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(${BINARY_NAME} PRIVATE ${dpct_INCLUDE_DIRS})

target_link_libraries(${BINARY_NAME} PRIVATE glm::glm glfw PkgConfig::Glew OpenGL::OpenGL)

Expand Down
Loading

0 comments on commit b04d23f

Please sign in to comment.