-
Notifications
You must be signed in to change notification settings - Fork 798
[SYCL][Cmake] Redesign OpenCL dependencies #3485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
eb1d87a
[SYCL][Cmake] Redesign opencl dependencies
adf882f
Merge branch 'sycl' into opencl-cmake1
66392bb
Moving OpenCL shared libs enforcement to OpenCL CMakeLists.txt
b934b84
Fix CUDA plugin and CUDA unittest target dependencies
fa2cb1c
Add opencl as llvm external project instead of directory
26dd1b1
Remove broken --system-ocl configure feature and cleanup
1f468b3
Replace OPENCL_ICD_LOADER_HEADERS_DIR with OpenCL_INCLUDE_DIR
f3779c1
Apply suggestions from code review
71d4b0f
Add feature to use pre-downloaded OpenCL deps sources
9dd80bd
Outline URLs and repo tags/hashes definitions
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
include(FetchContent) | ||
|
||
# Repo URLs | ||
|
||
set(OCL_HEADERS_REPO | ||
"https://github.com/KhronosGroup/OpenCL-Headers.git") | ||
set(OCL_LOADER_REPO | ||
"https://github.com/KhronosGroup/OpenCL-ICD-Loader.git") | ||
|
||
# Repo tags/hashes | ||
|
||
set(OCL_HEADERS_TAG 23710f1b99186065c1768fc3098ba681adc0f253) | ||
set(OCL_LOADER_TAG 5f8249691ec8c25775789498951f8e9eb62c201d) | ||
|
||
# OpenCL Headers | ||
if(NOT OpenCL_HEADERS) | ||
message(STATUS "Will fetch OpenCL headers from github.com") | ||
|
||
FetchContent_Declare(ocl-headers | ||
GIT_REPOSITORY ${OCL_HEADERS_REPO} | ||
GIT_TAG ${OCL_HEADERS_TAG} | ||
) | ||
else() | ||
message(STATUS "OpenCL headers are added manually ${OpenCL_HEADERS}") | ||
|
||
FetchContent_Declare(ocl-headers | ||
URL ${OpenCL_HEADERS} | ||
) | ||
endif() | ||
|
||
FetchContent_MakeAvailable(ocl-headers) | ||
FetchContent_GetProperties(ocl-headers) | ||
set(OpenCL_INCLUDE_DIR | ||
${ocl-headers_SOURCE_DIR} CACHE PATH "Path to OpenCL Headers") | ||
|
||
target_compile_definitions(Headers INTERFACE -DCL_TARGET_OPENCL_VERSION=220) | ||
add_library(OpenCL-Headers ALIAS Headers) | ||
|
||
# OpenCL Library (ICD Loader) | ||
|
||
# Set OPENCL_ICD_LOADER_HEADERS_DIR, as prerequisite for ICD build | ||
set(OPENCL_ICD_LOADER_HEADERS_DIR | ||
${OpenCL_INCLUDE_DIR} CACHE PATH "Path to OpenCL Headers") | ||
|
||
# LLVM build sets this OFF by default, but we need OpenCL to be built as shared | ||
# library. | ||
set(BUILD_SHARED_LIBS ON) | ||
|
||
if(NOT OpenCL_LIBRARY_SRC) | ||
message(STATUS "Will fetch OpenCL ICD Loader from github.com") | ||
|
||
FetchContent_Declare(ocl-icd | ||
GIT_REPOSITORY ${OCL_LOADER_REPO} | ||
GIT_TAG ${OCL_LOADER_TAG} | ||
) | ||
else() | ||
# TODO: add possibility to use prebuilt OpenCL library rather than building | ||
# together with llvm. | ||
message(STATUS | ||
"OpenCL ICD Loader sources added manually ${OpenCL_LIBRARY_SRC}") | ||
|
||
FetchContent_Declare(ocl-icd | ||
URL ${OpenCL_LIBRARY_SRC} | ||
) | ||
endif() | ||
|
||
FetchContent_MakeAvailable(ocl-icd) | ||
add_library(OpenCL-ICD ALIAS OpenCL) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.