Skip to content

Commit

Permalink
Include CL/opencl.hpp or CL/cl2.hpp, whatever available
Browse files Browse the repository at this point in the history
  • Loading branch information
ddemidov committed Nov 9, 2021
1 parent f0f2eed commit 29c2132
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 10 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,23 @@ find_package(OpenCL)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/VexCLOpenCLTarget.cmake")

if(OpenCL_FOUND)
set(CL_HPP_TARGET_OPENCL_VERSION 120 CACHE STRING "Target OpenCL version")
set(CL_HPP_MINIMUM_OPENCL_VERSION 120 CACHE STRING "Minimum OpenCL version")

add_library(OpenCL INTERFACE)
add_library(VexCL::OpenCL ALIAS OpenCL)

target_link_libraries(OpenCL INTERFACE Common OpenCL::OpenCL)
target_compile_definitions(OpenCL INTERFACE VEXCL_BACKEND_OPENCL)
target_compile_definitions(OpenCL INTERFACE CL_TARGET_OPENCL_VERSION=${CL_HPP_TARGET_OPENCL_VERSION})
target_compile_definitions(OpenCL INTERFACE CL_HPP_TARGET_OPENCL_VERSION=${CL_HPP_TARGET_OPENCL_VERSION})
target_compile_definitions(OpenCL INTERFACE CL_HPP_MINIMUM_OPENCL_VERSION=${CL_HPP_MINIMUM_OPENCL_VERSION})

find_file(OPENCL_HPP CL/opencl.hpp HINTS ${OpenCL_INCLUDE_DIRS})
message(STATUS " -- ${OPENCL_HPP} --")
if(OPENCL_HPP)
target_compile_definitions(OpenCL INTERFACE VEXCL_HAVE_OPENCL_HPP)
endif()

target_compile_options(Common INTERFACE
$<$<CXX_COMPILER_ID:GNU>:-Wno-catch-value>
Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ THE SOFTWARE.
#endif

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

#include <vexcl/backend/opencl/error.hpp>
#include <vexcl/backend/opencl/context.hpp>
Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ THE SOFTWARE.
#include <vexcl/detail/backtrace.hpp>

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

namespace vex {
namespace backend {
Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ THE SOFTWARE.
#include <iostream>

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

namespace vex {
namespace backend {
Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/device_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ THE SOFTWARE.
*/

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

namespace vex {
namespace backend {
Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ THE SOFTWARE.
#include <iostream>

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

namespace vex {
namespace backend {
Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ THE SOFTWARE.
#include <vector>

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

#include <vexcl/backend/opencl/filter.hpp>

Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ THE SOFTWARE.
#include <boost/version.hpp>

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif


namespace vex {
Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ THE SOFTWARE.

#include <vexcl/operations.hpp>
#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

namespace vex {

Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ THE SOFTWARE.
#include <functional>

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

#include <vexcl/backend/opencl/compiler.hpp>

Expand Down
6 changes: 5 additions & 1 deletion vexcl/backend/opencl/svm_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ THE SOFTWARE.
#include <memory>

#include <vexcl/backend/opencl/defines.hpp>
#include <CL/opencl.hpp>
#ifdef VEXCL_HAVE_OPENCL_HPP
# include <CL/opencl.hpp>
#else
# include <CL/cl2.hpp>
#endif

#include <vexcl/backend/opencl/context.hpp>

Expand Down

0 comments on commit 29c2132

Please sign in to comment.