Skip to content

Commit

Permalink
Build against sytem dependancies if available
Browse files Browse the repository at this point in the history
If CLHPP, ICD-Loader, and Headers are installed on the system, use
those instead of the submodules. This is beneficial when packaging
the SDK for distribution, as the submodules can be built as their
own seperate packages.
  • Loading branch information
Daniel Martinez committed Jan 18, 2024
1 parent d405836 commit dd3146f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,20 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install" CACHE PATH "Install Path" FORCE)
endif()

add_subdirectory(external/OpenCL-Headers)
add_subdirectory(external/OpenCL-ICD-Loader)
add_subdirectory(external/OpenCL-CLHPP)
find_package (OpenCLHeaders)
if (NOT TARGET OpenCL::Headers)
add_subdirectory(external/OpenCL-Headers)
endif ()

find_package (OpenCLICDLoader)
if (NOT TARGET OpenCL::OpenCL)
add_subdirectory(external/OpenCL-ICD-Loader)
endif ()

find_package (OpenCLHeadersCpp)
if (NOT TARGET OpenCL::HeadersCpp)
add_subdirectory(external/OpenCL-CLHPP)
endif ()

list(APPEND CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake
Expand Down

0 comments on commit dd3146f

Please sign in to comment.