-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux support for the OpenCL SDK package (#4204)
Enable building OpenCL libraries on Linux and macOS.
- Loading branch information
1 parent
2b277b4
commit cdbaa03
Showing
7 changed files
with
126 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
Source: opencl | ||
Version: 2.2 (2017.07.18)-1 | ||
Homepage: https://github.com/KhronosGroup/OpenCL-Headers | ||
Description: C/C++ headers and ICD loader (Installable Client Driver) for OpenCL | ||
Source: opencl | ||
Version: 2.2 (2018.08.31) | ||
Homepage: https://github.com/KhronosGroup/OpenCL-Headers | ||
Description: C/C++ headers and ICD loader (Installable Client Driver) for OpenCL | ||
|
||
Feature: wdk | ||
Description: Windows Driver Kit support |
This file contains 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 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 |
---|---|---|
@@ -1,7 +1,16 @@ | ||
The package opencl is compatible with built-in CMake targets: | ||
The package opencl is compatible with built-in CMake targets via CMake v3.6 and prior syntax | ||
|
||
find_package(OpenCL REQUIRED) | ||
target_link_libraries(main PRIVATE ${OpenCL_LIBRARIES}) | ||
target_include_directories(main PRIVATE ${OpenCL_INCLUDE_DIRS}) | ||
|
||
You will also need to install an appropriate driver package from your CPU/GPU manufacturer. | ||
and the CMake v3.7 and beyond imported target syntax | ||
|
||
find_package(OpenCL REQUIRED) | ||
target_link_libraries(main PRIVATE OpenCL::OpenCL) | ||
|
||
This package is only an OpenCL SDK. To actually run OpenCL code you also need to install an implementation. | ||
|
||
WINDOWS: implementations typically ship with the drivers of you CPU/GPU vendors. | ||
LINUX: implementations may be installed from your distro's repo or manually. There are too many to count. | ||
APPLE: consult your distribution vendor on the state of OpenCL support: https://support.apple.com/en-us/HT202823 |
This file contains 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,15 @@ | ||
_find_package(${ARGS}) | ||
if(NOT BUILD_SHARED_LIBS AND (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")) | ||
find_package(Threads REQUIRED) | ||
set(OpenCL_Extra_Libs ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) | ||
if(CMAKE_SYSTEM_NAME MATCHES "Windows") | ||
list(APPEND OpenCL_Extra_Libs cfgmgr32) | ||
endif(CMAKE_SYSTEM_NAME MATCHES "Windows") | ||
|
||
if(TARGET OpenCL::OpenCL) | ||
set_property(TARGET OpenCL::OpenCL APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${OpenCL_Extra_Libs}) | ||
endif() | ||
if(OpenCL_LIBRARIES) | ||
list(APPEND OpenCL_LIBRARIES ${OpenCL_Extra_Libs}) | ||
endif() | ||
endif() |
This file contains 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,24 @@ | ||
The package opengl is compatible with built-in CMake targets via CMake v3.7 and prior syntax | ||
|
||
find_package(OpenGL REQUIRED) | ||
target_link_libraries(main PRIVATE ${OPENGL_LIBRARIES}) | ||
target_include_directories(main PRIVATE ${OPENGL_INCLUDE_DIR}) | ||
|
||
and the CMake v3.8 and beyond imported target syntax | ||
|
||
find_package(OpenGL REQUIRED) | ||
target_link_libraries(main PRIVATE OpenGL::GL) | ||
|
||
introduction of various components | ||
|
||
find_package(OpenGL REQUIRED COMPONENTS GL # v3.8 | ||
GLU # v3.8 | ||
GLX # v3.10 | ||
EGL # v3.10 | ||
OpenGL) # v3.10 | ||
|
||
The OpenGL SDK is highly platform dependent and is usually an OS component. It's not realistic to build from source for every platform. | ||
|
||
WINDOWS: is part of the Windows SDK which this package installs. | ||
LINUX: the SDK may be installed from your distro's repo or from 3rd parties manually. There are too many to count. | ||
APPLE: consult your distribution vendor on the state of OpenGL support: https://support.apple.com/en-us/HT202823 |