OpenCL specific CMake utilities are provided by the
source/cl/cmake/AddCACL.cmake
module, exposing utilities in a similar way
to the AddCA Module, and in some cases working on top of it. For
example, the add_ca_cl_executable()
function calls
add_ca_executable()
before adding OpenCL specific compiler
definitions to the target.
If we’re testing through the ICD loader then environment variables that may be
needed for testing are also added to the target properties here.
add_ca_cl_check()
sets the OCL_ICD_FILENAMES
environment var to the name of our OpenCL library, and the OCL_ICD_VENDORS
environment
variable to set to some arbitrary path to prevent system installed drivers from
being found.
To use this module with add_ca_example_subdirectory()
:
include(${ComputeAorta_SOURCE_DIR}/source/cl/cmake/AddCACL.cmake)
- CA_CL_COMPILE_DEFINITIONS
A CMake variable containing list of compile definitions which provides a single place for setting OpenCL specific pre-processor flags such as
CA_TARGET_OPENCL_VERSION
.
- target_link_ca_cl
A CMake command which specifies the required link libraries for building libraries or executables which require OpenCL entry points. Either
CL
orOpenCL
is linked automatically baased on theCL_CA_ENABLE_ICD_LOADER
option.- Arguments:
target
Library or executable target to link OpenCL into.
- add_ca_cl_executable
A CMake command which acts acts exactly like
add_ca_executable()
except it selectively links against one of theCL
orOpenCL
targets depending on the value of theCA_CL_ENABLE_ICD_LOADER
option.- Arguments:
target
Name of the executable target to add.
- add_ca_cl_library
A CMake command which acts exactly like
add_ca_library()
except it selectively links against one of theCL
orOpenCL
targets depending on the value ofCA_CL_ENABLE_ICD_LOADER
option.- Arguments:
target
Name of the library target to add.
- add_ca_cl_icd_file
A CMake command which generates two
.icd
files, the first is used during development and points to an OpenCL library which exists in the build directory, and the second is installed and points to the installed path of the OpenCL library.- Arguments:
target
The CMake target of the OpenCL library.
- Keyword Arguments:
NAME
The name, without the .icd extension, for the output file. Defaults to${target}
.
- add_ca_cl_check
A CMake command which acts exactly like
add_ca_check()
except it also sets environment variables to specify the use of theCL
target library. IfCA_CL_ENABLE_ICD_LOADER
isON
theOCL_ICD_FILENAMES
environment variable is set when executing the check, and theOCL_ICD_VENDORS
environment variable to set to some arbitrary path (that does not need to exist) to prevent system installed drivers from being found. IfCA_CL_ENABLE_INTERCEPT_LAYER
isON
theCLI_OpenCLFileName
environment variable is set.- Arguments:
name
A unique name for the check, should include the name of the target being checked.