Hi, Im new here. So, Im trying to compile the “helloworld” sample from OpenCL programming guide.I wanna know how to configure the CMakeList.txt, I couldn’t compile the sample because im having a problem with the link-libraries:
CMakeFiles/HelloWorld.dir/HelloWorld.cpp.o: In function `CreateContext()':
/home/facundo/projects/HelloWorld/HelloWorld.cpp:45: undefined reference to `clGetPlatformIDs'
I descompressed the Nvidia SDK into my HOME, but NVIDIA_GPU_Computing_SDK/OpenCL/common/lib/Linux64 is empty :S How to link these?
PD: Sorry for my bad english.
Hi! I could compile it. This is the cmakelist.txt:
cmake_minimum_required(VERSION 2.8)
add_executable( HelloWorld HelloWorld.cpp )
FIND_LIBRARY(OPENCL_LIBRARIES OpenCL
ENV LD_LIBRARY_PATH
)
GET_FILENAME_COMPONENT(OPENCL_LIB_DIR ${OPENCL_LIBRARIES} PATH)
GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE)
FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include")
FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include_directories( ${OPENCL_INCLUDE_DIRS} )
include_directories( "${CMAKE_SOURCE_DIR}/khronos" )
target_link_libraries( HelloWorld ${OPENCL_LIBRARIES} )
configure_file(HelloWorld.cl ${CMAKE_CURRENT_BINARY_DIR}/HelloWorld.cl COPYONLY)