Skip to content

KhronosGroup/OpenCL-SDK

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

OpenCLTM SDK (in development)

This is the Khronos OpenCL SDK. It brings together all the components needed to develop OpenCL applications:

  • OpenCL Headers (include/api)
  • OpenCL C++ bindings (include/cpp)
  • OpenCL Loader
  • OpenCL utility library (include/utils)

It also contains resources useful to OpenCL developers:

  • Code samples (samples/)
  • Documentation (docs/)

Build Instructions

Dependencies

  • This repository uses sub-modules for the OpenCL Headers, OpenCL C++ bindings, and OpenCL ICD Loader and some of their transitive dependencies.

    • To clone a new repository with all sub-modules included, use the --recursive option. Note that this option clones all sub-modules and their dependencies, which are not strictly required for the OpenCL SDK:

      git clone --recursive https://github.com/KhronosGroup/OpenCL-SDK.git
      
    • Alternatively, to clone only the sub-modules for the OpenCL SDK, first clone this repository without sub-modules included then setup submodules non-recursively:

      git clone https://github.com/KhronosGroup/OpenCL-SDK.git
      git submodule init
      git submodule update
      
  • The SDK uses CMake for its build system. If CMake is not provided by your build system or OS package manager, please consult the CMake website.

  • The SDK samples depend on

Example Build

The example build guide uses Vcpkg to fetch all dependencies. Note that Vcpkg is not a requirement and is only used for convenience. One may provide dependencies through any other CMake mechanism. For details on how to install Vcpkg, refer to it's Getting Started Guide. The example build assumes targeting 64-bit Windows.

  1. Clone this repo with the rest of the OpenCL SDK components:

    git clone https://github.com/KhronosGroup/OpenCL-SDK.git
    git submodule init
    git submodule update
    
  2. Install dependencies

    vcpkg --triplet x64-windows install sfml tclap glm
    
  3. Build and install SDK with samples and no downstream unit tests

    cmake -A x64 `
          -D BUILD_TESTING=OFF `
          -D BUILD_DOCS=OFF `
          -D BUILD_EXAMPLES=OFF `
          -D BUILD_TESTS=OFF `
          -D OPENCL_SDK_BUILD_SAMPLES=ON `
          -D OPENCL_SDK_TEST_SAMPLES=OFF `
          -D CMAKE_TOOLCHAIN_FILE=/vcpkg/install/root/scripts/buildsystems/vcpkg.cmake `
          -D VCPKG_TARGET_TRIPLET=x64-windows
          -B ./OpenCL-SDK/build -S ./OpenCL-SDK
    cmake --build ./OpenCL-SDK/build --target install
    

(Note: on Linux paths to dependent libraries are automatically handled by RPATH in both the build and install tree. On Windows all DLLs have to be on the PATH. Vcpkg copies dependent DLLs to the build tree, but in order to do the same in the install tree, sufficiently new CMake version is required. CMake 3.21 instroduces install(IMPORTED_RUNTIME_ARTIFACTS).)