This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to compile OpenCl-examples source with CMake

By Default ti-processor-sdk has a opencl-example compilation with Make

but i want to use CMake. how can i migrate opencl-example compilation with CMake?.

I read about FindOpenCL.cmake Macro.  file but it doesn't have more information

How to do a cross compilation of opencl-examples using CMake for AM57xx-evm from ubuntu14.04 64 bit machine?.

i had installation for ti-processor-sdk-03 in my  ubuntu14.04 64 bit machine.

  • Hi Govindaraji,

    Please check whether the link below helps in building using cmake.
    processors.wiki.ti.com/.../Building_OpenCV_for_ARM_Cortex-A8
  • I am asking cmake compilation for opencl-example and I'm not asking for opencv.
  • Hi Govindaraji,

    I am not sure why you need to use CMake, since it is used for generating Makefiles, which already exist in opencl-examples,
    but basically you will need to create CMakeLists.txt file in the main directory which includes all subdirectories and in all
    subdirectories add their own CMakeLists.txt. You may check this tutorial for some explanation of CMakeLists.txt layout:

    derekmolloy.ie/.../

    You may also need to create toolchain.cmake file with such contents:

    set( CMAKE_SYSTEM_NAME Linux )
    set( CMAKE_SYSTEM_PROCESSOR arm )
    set( CMAKE_C_COMPILER arm-none-linux-gnueabihf-gcc )
    set( CMAKE_CXX_COMPILER arm-none-linux-gnueabihf-g++ )
    set( CMAKE_FIND_ROOT_PATH ~/targetfs )

    and pass it to cmake command with -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake

    Regards,
    Yordan
  • Hi Yordan,

    Our build System for AM57xx-evm target will be continued using in CMake. that is the reason i should generate the Makefiles from CMake.

    i have to write CMakeList.txt for Cortex-A15 (CPU Linux) and DSP

    i have to do it opencl-examples-1.1.9.1/dsplib_fft

    Under the ti-processor-sdk-linux-am57xx-evm-03.00.00.04/example-applications/opencl-examples-1.1.9.1 folder there is a make.inc file and it has so many steps in compilation stage

    %.o: %.cpp
    @echo Compiling $<
    @$(CPP) -c $(CPP_FLAGS) $<

    %.o: %.c
    @echo Compiling $<
    @$(CPP) -c $(CPP_FLAGS) $<

    %.obj: %.c
    @echo Compiling $<
    @$(CL6X) -c $(CL6X_FLAGS) $<

    %.out: %.cl
    @echo Compiling $<
    @$(CLOCL) $(CLOCL_FLAGS) $^

    %.dsp_h: %.cl
    @echo Compiling $<
    @$(CLOCL) -t $(CLOCL_FLAGS) $^

    $(EXE):

    cross: $(EXE)


    In CMake we have add_executable(), target_link_libraries(). using these macros how can i get a final binary dsplib_fft

    And i unable to get the exact source and link libraries for the CMake compilation

    And here DSP compiler clocl, and cl6x used. when it comes to CMake how can i use this DSP Compiler.
  • For DSP Compilation i used add_custom_command() CMake macro and using the target_link_libraries() linked the DSP Object files and Opencl libraries.