-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindOpenCL.cmake
54 lines (40 loc) · 1.53 KB
/
FindOpenCL.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# - Try to find OpenCL
# Once done this will define
#
# OPENCL_FOUND - system has OpenCL
# OPENCL_INCLUDE_DIR - the OpenCL include directory
# OPENCL_LIBRARIES - link these to use OpenCL
#
# WIN32 should work, but is untested
IF (WIN32)
FIND_PATH(OPENCL_INCLUDE_DIR 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)
# Unix style platforms
# We also search for OpenCL in the NVIDIA GPU SDK default location
SET(OPENCL_INCLUDE_DIR "$ENV{OPENCL_HOME}/common/inc"
CACHE PATH "path to Opencl Include files")
message(***** OPENCL_INCLUDE_DIR: "${OPENCL_INCLUDE_DIR}" ********)
# does not work. WHY?
SET(inc $ENV{CUDA_LOCAL}/../OpenCL/common/inc /usr/include)
FIND_PATH(OPENCL_INCLUDE_DIR CL/cl.h PATHS ${inc} /usr/include )
message("lib path: $ENV{LD_LIBRARY_PATH}")
#FIND_LIBRARY(OPENCL_LIBRARIES OpenCL $ENV{LD_LIBRARY_PATH})
FIND_LIBRARY(OPENCL_LIBRARIES OpenCL ENV LD_LIBRARY_PATH)
message("==============")
message("opencl_libraries: ${OPENCL_LIBRARIES}")
#message(***** OPENCL ENV: "$ENV{GPU_SDK}" ********)
#~/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc/
ENDIF (WIN32)
SET( OPENCL_FOUND "NO" )
IF(OPENCL_LIBRARIES )
SET( OPENCL_FOUND "YES" )
ENDIF(OPENCL_LIBRARIES)
MARK_AS_ADVANCED(
OPENCL_INCLUDE_DIR
)