1 cmake_minimum_required(VERSION 2.8)
3 set(KCF_LIB_SRC kcf.cpp kcf.h fft.cpp)
5 SET(FFT "OpenCV" CACHE STRING "Select FFT implementation")
6 SET_PROPERTY(CACHE FFT PROPERTY STRINGS OpenCV OpenCV_cuFFT fftw cuFFTW cuFFT)
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(CUDA_DEBUG "Enables error cheking for cuda and cufft. " OFF)
12 option(BIG_BATCH "Enable transforming all features from all scales together." OFF)
15 add_definitions(-DPROFILING )
16 MESSAGE(STATUS "Profiling mode")
20 add_definitions(-DBIG_BATCH )
21 MESSAGE(STATUS "Big_batch mode")
26 IF(FFT STREQUAL "OpenCV")
27 list(APPEND KCF_LIB_SRC fft_opencv.cpp complexmat.hpp)
28 ELSEIF(FFT STREQUAL "OpenCV_cuFFT")
29 list(APPEND KCF_LIB_SRC fft_opencv_cuda.cpp complexmat.hpp)
30 add_definitions(-DOPENCV_CUFFT)
32 ELSEIF(FFT STREQUAL "fftw")
33 list(APPEND KCF_LIB_SRC fft_fftw.cpp complexmat.hpp)
34 add_definitions(-DFFTW)
35 ELSEIF(FFT STREQUAL "cuFFTW")
36 list(APPEND KCF_LIB_SRC fft_fftw.cpp complexmat.hpp)
37 add_definitions(-DFFTW -DCUFFTW)
39 ELSEIF(FFT STREQUAL "cuFFT")
40 list(APPEND KCF_LIB_SRC fft_cufft.cpp complexmat.cuh)
41 add_definitions(-DCUFFT)
44 add_definitions(-DCUDA_DEBUG)
45 MESSAGE(STATUS "CUDA debug mode")
48 MESSAGE(FATAL_ERROR "Invalid FFT implementation selected")
51 IF(ASYNC AND NOT OPENMP)
52 add_definitions(-DASYNC)
53 MESSAGE(STATUS "ASYNC")
56 FIND_PACKAGE( OpenCV REQUIRED )
59 find_package(CUDA REQUIRED)
61 if (NOT ${OpenCV_USE_CUFFT})
62 message(SEND_ERROR "OpenCV was not built with cuFFT")
65 include_directories ( ${CUDA_INCLUDE_DIRS} )
66 set(CUDA_SEPARABLE_COMPILATION ON)
67 set(CUDA_PROPAGATE_HOST_FLAGS OFF)
68 set(CUDA_HOST_COMPILER /usr/bin/g++)
69 list( APPEND CUDA_NVCC_FLAGS -O3 --gpu-architecture sm_62 -std=c++11 -default-stream per-thread)
70 find_cuda_helper_libs(cufftw)
71 IF(FFT STREQUAL "cuFFT")
72 cuda_add_library(complexmat complexmat.cu)
77 add_subdirectory(piotr_fhog)
80 add_library(kcf STATIC ${KCF_LIB_SRC})
81 target_link_libraries(kcf fhog cndata ${OpenCV_LIBS})
82 set_target_properties(kcf PROPERTIES VERSION 1.0.0 SOVERSION 1)
84 IF(FFT STREQUAL "fftw")
85 target_link_libraries(kcf fftw3f)
87 target_link_libraries(kcf fftw3_omp)
89 target_link_libraries(kcf fftw3_threads)
93 IF(FFT STREQUAL "cuFFTW")
94 target_link_libraries(kcf ${CUDA_cufft_LIBRARY} ${CUDA_cufftw_LIBRARY})
97 IF(FFT STREQUAL "cuFFT")
98 target_link_libraries(kcf ${CUDA_cufft_LIBRARY} ${CUDA_LIBRARIES} complexmat)
102 target_link_libraries(kcf pfm)