1 cmake_minimum_required(VERSION 2.8)
3 set(KCF_LIB_SRC kcf.cpp kcf.h complexmat.hpp fft.cpp)
5 SET(FFT "OpenCV" CACHE STRING "Select FFT implementation")
6 SET_PROPERTY(CACHE FFT PROPERTY STRINGS OpenCV OpenCV_cuFFT fftw cuFFTW)
7 MESSAGE(STATUS "FFT implementation: ${FFT}")
9 option(OPENMP "Use OpenMP library. Works with FFTW and OpenCV implementation." OFF)
10 option(ASYNC "Works only if OPENCV_CUFFT is not ON. Will enable C++ async directive." OFF)
11 option(PROFILING "Enable profiling using perf_event_open together with libpfm4. " OFF)
14 add_definitions(-DPROFILING )
15 MESSAGE(STATUS "Profiling mode")
20 IF(FFT STREQUAL "OpenCV")
21 list(APPEND KCF_LIB_SRC fft_opencv.cpp)
22 ELSEIF(FFT STREQUAL "OpenCV_cuFFT")
23 list(APPEND KCF_LIB_SRC fft_opencv_cuda.cpp)
24 add_definitions(-DOPENCV_CUFFT)
26 ELSEIF(FFT STREQUAL "fftw")
27 list(APPEND KCF_LIB_SRC fft_fftw.cpp)
28 add_definitions(-DFFTW)
29 ELSEIF(FFT STREQUAL "cuFFTW")
30 list(APPEND KCF_LIB_SRC fft_fftw.cpp)
31 add_definitions(-DFFTW -DCUFFTW)
34 MESSAGE(FATAL_ERROR "Invalid FFT implementation selected")
37 IF(ASYNC AND NOT OPENMP)
38 add_definitions(-DASYNC)
39 MESSAGE(STATUS "ASYNC")
42 FIND_PACKAGE( OpenCV REQUIRED )
45 find_package(CUDA REQUIRED)
47 if (NOT ${OpenCV_USE_CUFFT})
48 message(SEND_ERROR "OpenCV was not built with cuFFT")
51 include_directories ( ${CUDA_INCLUDE_DIRS} )
52 set(CUDA_SEPARABLE_COMPILATION ON)
53 set(CUDA_PROPAGATE_HOST_FLAGS OFF)
54 set(CUDA_HOST_COMPILER /usr/bin/g++)
55 list( APPEND CUDA_NVCC_FLAGS "-O3 --gpu-architecture compute_62 -std=c++11")
56 find_cuda_helper_libs(cufftw)
59 add_subdirectory(piotr_fhog)
62 add_library(kcf STATIC ${KCF_LIB_SRC})
63 target_link_libraries(kcf fhog cndata ${OpenCV_LIBS})
64 set_target_properties(kcf PROPERTIES VERSION 1.0.0 SOVERSION 1)
66 IF(FFT STREQUAL "fftw")
67 target_link_libraries(kcf fftw3f)
69 target_link_libraries(kcf fftw3_omp)
73 IF(FFT STREQUAL "cuFFTW")
74 target_link_libraries(kcf ${CUDA_cufft_LIBRARY} ${CUDA_cufftw_LIBRARY})
78 target_link_libraries(kcf pfm)