2013년 5월 11일 토요일

opencl programming guide sample cmake error


env:

ubuntu 10.04
AMD Straming SDK 2.6

CMake shows below error ,
because AMD Straming ASK OpenCl header directory is changed
...
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:70 (MESSAGE):
  Could NOT find OpenCL (missing: OPENCL_INCLUDE_DIRS)
...

Open

opencl-book-samples-read-only/cmake/FindOpenCL.cmake

add AMD straming SDK opencl include path as llike below

FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include" "/opt/AMDAPP/include/")
            FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include" "/opt/AMDAPP/include/")

then cmake

$ cmake ../opencl-book-samples-read-only -G "Eclipse CDT4 - Unix Makefiles"
-- Found OpenCL: /usr/lib/libOpenCL.so
-- Boost version: 1.40.0
-- Found the following Boost libraries:
--   program_options
-- Configuring done
-- Generating done
-- Build files have been written to: /home2/dokyun/dkworks/opencl/build

it is completed

move to chapters 2 sample directory and build , you can find out HelloWorld

$ ls
CMakeFiles  HelloWorld.cl  Makefile  cmake_install.cmake
$ make
Scanning dependencies of target HelloWorld
[100%] Building CXX object src/Chapter_2/HelloWorld/CMakeFiles/HelloWorld.dir/HelloWorld.cpp.o
Linking CXX executable HelloWorld
[100%] Built target HelloWorld
$ ls
CMakeFiles  HelloWorld  HelloWorld.cl  Makefile  cmake_install.cmake


env

windows 7
Nvidia CUDA 5.0


use cmake-gui





























set source code directory and build binary directory , then configure and generate



댓글 없음:

댓글 쓰기