Results 1 to 2 of 2

Thread: Opencl setting up kdevelop + cmake

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    2

    Opencl setting up kdevelop + cmake

    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:

    Code :
    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.

  2. #2
    Junior Member
    Join Date
    Dec 2011
    Posts
    2

    Re: Opencl setting up kdevelop + cmake

    Hi! I could compile it. This is the cmakelist.txt:

    Code :
    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)

Similar Threads

  1. Cmake error while configuring OpenCL program
    By shreedhar22 in forum OpenCL
    Replies: 0
    Last Post: 12-08-2012, 06:22 AM
  2. OpenCL+ CMake @ iMac
    By fteixeira in forum OpenCL
    Replies: 0
    Last Post: 02-01-2012, 05:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •