AddCACL Module
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
CLorOpenCLis linked automatically baased on theCL_CA_ENABLE_ICD_LOADERoption.- Arguments:
targetLibrary 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 theCLorOpenCLtargets depending on the value of theCA_CL_ENABLE_ICD_LOADERoption.- Arguments:
targetName 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 theCLorOpenCLtargets depending on the value ofCA_CL_ENABLE_ICD_LOADERoption.- Arguments:
targetName of the library target to add.
- add_ca_cl_icd_file
A CMake command which generates two
.icdfiles, 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:
targetThe CMake target of the OpenCL library.
- Keyword Arguments:
NAMEThe 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 theCLtarget library. IfCA_CL_ENABLE_ICD_LOADERisONtheOCL_ICD_FILENAMESenvironment variable is set when executing the check, and theOCL_ICD_VENDORSenvironment 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_LAYERisONtheCLI_OpenCLFileNameenvironment variable is set.Note
If
CA_ENABLE_TESTSis set toOFFthis function does nothing.- Arguments:
nameA unique name for the check, should include the name of the target being checked.
- Keyword Arguments:
NOGLOBALCL- Flag to specify that the new target should not be added to the CL-wide check target.