[opencl] Add FindOpenCLhpp CMake module; vendor cl2.hpp; fixup includes
CL/cl2.hpp, which the OpenCL support is based upon, is not always
included with OpenCL on some platforms, e.g. Mac, or not readily
available as a package. This work adds a CMake module specifically for
finding cl2.hpp, as installed by OpenCL-CLHPP project.
If not found, but standard OpenCL lib and headers are, the vendored
cl2.hpp in external/opencl-clhpp is used, as it needs no compilation.
- Only the cl2.hpp, license and README are vendored from OpenCL-CLHPP.
- Fix up referenced includes in other CMake targets, to ensure the
includes for OpenCL are specifically added (previously, they were
sometimes found in existing include directories of other dependencies).
- Fixup for standard FindOpenCL module not assinging proper framework
headers directory for Mac.
2018-09-30 19:55:29 -06:00
|
|
|
# Find OpenCLhpp
|
|
|
|
# ~~~~~~~~~~~~~~~
|
|
|
|
# CMake module to search for OpenCL headers for C++ bindings from:
|
|
|
|
# https://github.com/KhronosGroup/OpenCL-CLHPP
|
|
|
|
#
|
|
|
|
# Specifically, it finds the cpl2 header.
|
|
|
|
#
|
|
|
|
# If it's found it sets OPENCL_HPP_FOUND to TRUE
|
|
|
|
# and following variables are set:
|
|
|
|
# OPENCL_HPP_INCLUDE_DIR
|
|
|
|
#
|
|
|
|
# Copyright (c) 2018, Boundless Spatial
|
|
|
|
# Author: Larry Shaffer <lshaffer (at) boundlessgeo (dot) com>
|
|
|
|
#
|
|
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
|
|
|
|
if (OPENCL_HPP_INCLUDE_DIR)
|
|
|
|
SET(OPENCL_HPP_FOUND TRUE)
|
|
|
|
else ()
|
|
|
|
find_path(OPENCL_HPP_INCLUDE_DIR
|
2021-06-01 10:45:42 +10:00
|
|
|
NAMES CL/opencl.hpp CL/cl2.hpp
|
[opencl] Add FindOpenCLhpp CMake module; vendor cl2.hpp; fixup includes
CL/cl2.hpp, which the OpenCL support is based upon, is not always
included with OpenCL on some platforms, e.g. Mac, or not readily
available as a package. This work adds a CMake module specifically for
finding cl2.hpp, as installed by OpenCL-CLHPP project.
If not found, but standard OpenCL lib and headers are, the vendored
cl2.hpp in external/opencl-clhpp is used, as it needs no compilation.
- Only the cl2.hpp, license and README are vendored from OpenCL-CLHPP.
- Fix up referenced includes in other CMake targets, to ensure the
includes for OpenCL are specifically added (previously, they were
sometimes found in existing include directories of other dependencies).
- Fixup for standard FindOpenCL module not assinging proper framework
headers directory for Mac.
2018-09-30 19:55:29 -06:00
|
|
|
PATHS
|
|
|
|
${LIB_DIR}/include
|
|
|
|
"$ENV{LIB_DIR}/include"
|
|
|
|
$ENV{INCLUDE}
|
|
|
|
/usr/local/include
|
|
|
|
/usr/include
|
|
|
|
)
|
|
|
|
if (OPENCL_HPP_INCLUDE_DIR)
|
|
|
|
SET(OPENCL_HPP_FOUND TRUE)
|
|
|
|
else ()
|
|
|
|
SET(OPENCL_HPP_FOUND FALSE)
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
if (OPENCL_HPP_FOUND)
|
2021-06-01 10:45:42 +10:00
|
|
|
# see if newer opencl.hpp file exists in include dir -- if so we should use this
|
|
|
|
# instead of the deprecated cl2.hpp header
|
|
|
|
find_path(OPENCL_HPP_RENAMED_PATH
|
|
|
|
NAMES CL/opencl.hpp
|
|
|
|
PATHS
|
|
|
|
${OPENCL_HPP_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
if (OPENCL_HPP_RENAMED_PATH)
|
|
|
|
SET(OPENCL_USE_NEW_HEADER TRUE)
|
|
|
|
else ()
|
|
|
|
SET(OPENCL_USE_NEW_HEADER FALSE)
|
|
|
|
endif ()
|
|
|
|
|
[opencl] Add FindOpenCLhpp CMake module; vendor cl2.hpp; fixup includes
CL/cl2.hpp, which the OpenCL support is based upon, is not always
included with OpenCL on some platforms, e.g. Mac, or not readily
available as a package. This work adds a CMake module specifically for
finding cl2.hpp, as installed by OpenCL-CLHPP project.
If not found, but standard OpenCL lib and headers are, the vendored
cl2.hpp in external/opencl-clhpp is used, as it needs no compilation.
- Only the cl2.hpp, license and README are vendored from OpenCL-CLHPP.
- Fix up referenced includes in other CMake targets, to ensure the
includes for OpenCL are specifically added (previously, they were
sometimes found in existing include directories of other dependencies).
- Fixup for standard FindOpenCL module not assinging proper framework
headers directory for Mac.
2018-09-30 19:55:29 -06:00
|
|
|
if (NOT OPENCLHPP_FIND_QUIETLY)
|
|
|
|
message(STATUS "Found OpenCL C++ headers: ${OPENCL_HPP_INCLUDE_DIR}")
|
|
|
|
endif ()
|
|
|
|
else ()
|
|
|
|
if (OPENCLHPP_FIND_REQUIRED)
|
|
|
|
message(FATAL_ERROR "Could not find OpenCL C++ headers")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
mark_as_advanced(OPENCL_HPP_INCLUDE_DIR)
|