Commit 67a705c8 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #586

Use cmake provide module to find OpenCL
parents 07273982 cd3a98c8
...@@ -511,12 +511,17 @@ endif() ...@@ -511,12 +511,17 @@ endif()
# build opencl library if not told otherwise and OpenCL package was found # build opencl library if not told otherwise and OpenCL package was found
if(NOT CAF_NO_OPENCL) if(NOT CAF_NO_OPENCL)
find_package(OpenCL) if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.0)
if(OpenCL_FOUND) find_package(OpenCL)
add_optional_caf_lib(opencl) if(OpenCL_FOUND)
add_optional_caf_binaries(libcaf_opencl/examples) add_optional_caf_lib(opencl)
add_optional_caf_binaries(libcaf_opencl/examples)
else()
set(CAF_NO_OPENCL yes)
endif()
else() else()
set(CAF_NO_OPENCL yes) set(CAF_NO_OPENCL yes)
message(STATUS "Could NOT find OpenCL, requires Cmake >= 3.1.")
endif() endif()
endif() endif()
......
# - Try to find OpenCL
# Once done this will define
#
# OpenCL_FOUND - system has OpenCL
# OpenCL_INCLUDE_DIRS - the OpenCL include directory
# OpenCL_LIBRARIES - link these to use OpenCL
#
# WIN32 should work, but is untested
IF (WIN32)
FIND_PATH(OpenCL_INCLUDE_DIRS CL/cl.h )
# TODO this is only a hack assuming the 64 bit library will
# not be found on 32 bit system
FIND_LIBRARY(OpenCL_LIBRARIES opencl ) #used to say opencl64
IF( OpenCL_LIBRARIES )
FIND_LIBRARY(OpenCL_LIBRARIES opencl ) #used to say opencl32
ENDIF( OpenCL_LIBRARIES )
ELSE (WIN32)
FIND_LIBRARY(OpenCL_LIBRARIES OpenCL ENV LD_LIBRARY_PATH)
message("-- Found OpenCL: ${OpenCL_LIBRARIES}")
ENDIF (WIN32)
SET( OpenCL_FOUND "NO" )
IF(OpenCL_LIBRARIES )
SET( OpenCL_FOUND "YES" )
ENDIF(OpenCL_LIBRARIES)
MARK_AS_ADVANCED(
OpenCL_INCLUDE_DIRS
OpenCL_LIBRARIES
)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 3.1)
project(caf_opencl C CXX) project(caf_opencl C CXX)
# get header files; only needed by CMake generators, # get header files; only needed by CMake generators,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment