forked from fanxu/ffld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
80 lines (66 loc) · 2.94 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Implementation of the paper
# "Exact Acceleration of Linear Object Detectors"
# 12th European Conference on Computer Vision, 2012.
#
# Copyright (c) 2012 Idiap Research Institute, <http://www.idiap.ch/>
# Written by Charles Dubout <[email protected]>
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(FFLD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
# The build options
OPTION(FFLD_HOGPYRAMID_FELZENSZWALB_FEATURES "Use Felzenszwalb's original features (slower and not as accurate, provided for compatibility only)." OFF)
OPTION(FFLD_HOGPYRAMID_DOUBLE "Use doubles instead of floats (slower, uses twice more memory, and the increase in precision is not necessarily useful)." OFF)
# Select a default build configuration if none was chosen
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF()
# Also list the headers so that they are displayed along the .cpp files in the IDE
SET(HEADERS Rectangle.h JPEGImage.h Object.h Scene.h HOGPyramid.h Patchwork.h Model.h Mixture.h Intersector.h)
SET(SOURCES Rectangle.cpp JPEGImage.cpp Object.cpp Scene.cpp HOGPyramid.cpp Patchwork.cpp Model.cpp Mixture.cpp)
ADD_LIBRARY(ffld STATIC ${HEADERS} ${SOURCES})
ADD_EXECUTABLE(ffld_cmd ffld.cpp)
target_link_libraries(ffld_cmd ffld)
# Define the options
IF(FFLD_HOGPYRAMID_FELZENSZWALB_FEATURES)
ADD_DEFINITIONS(-DFFLD_HOGPYRAMID_FELZENSZWALB_FEATURES)
ENDIF()
IF(FFLD_HOGPYRAMID_DOUBLE)
ADD_DEFINITIONS(-DFFLD_HOGPYRAMID_DOUBLE)
ENDIF()
# There are no CMake Eigen package, so find it ourselves
FILE(GLOB EIGEN_ARCHIVE "eigen*")
FIND_PATH(EIGEN_INCLUDE_DIR Eigen ${EIGEN_ARCHIVE} .)
IF(NOT EIGEN_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Could not find Eigen.")
ENDIF()
INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIR})
# There are no CMake FFTW package, so find it ourselves
FIND_PATH(FFTW3_INCLUDE_DIR fftw3.h)
IF(FFLD_HOGPYRAMID_DOUBLE)
FIND_LIBRARY(FFTW3_LIBRARIES fftw3)
ELSE()
FIND_LIBRARY(FFTW3_LIBRARIES fftw3f)
ENDIF()
IF(NOT FFTW3_INCLUDE_DIR OR NOT FFTW3_LIBRARIES)
MESSAGE(FATAL_ERROR "Could not find fftw3.")
ENDIF()
INCLUDE_DIRECTORIES(${FFTW3_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(ffld_cmd ${FFTW3_LIBRARIES})
FIND_PACKAGE(JPEG REQUIRED)
IF(JPEG_FOUND)
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(ffld_cmd ${JPEG_LIBRARIES})
ENDIF()
FIND_PACKAGE(LibXml2 REQUIRED)
IF(LIBXML2_FOUND)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(ffld_cmd ${LIBXML2_LIBRARIES})
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
ENDIF()
# Not required, but stronlgy recommended on multi-core systems
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
ENDIF()