-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
101 lines (87 loc) · 3.91 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Implementation of the papers
#
# "Exact Acceleration of Linear Object Detectors"
# 12th European Conference on Computer Vision, 2012.
#
# "Deformable Part Models with Individual Part Scaling"
# 24th British Machine Vision Conference, 2013.
#
# Copyright (c) 2013 Idiap Research Institute, <http://www.idiap.ch/>
# Written by Charles Dubout <[email protected]>
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(FFLD)
# The build options
OPTION(FFLD_HOGPYRAMID_DOUBLE "Use doubles instead of floats (slower, uses twice more memory, and the increase in precision is not necessarily useful)." OFF)
OPTION(FFLD_HOGPYRAMID_EXTRA_FEATURES "Use extra features (LBP + color) in addition to HOG." OFF)
OPTION(FFLD_MODEL_3D "Allow parts to also deform across scales." OFF)
OPTION(FFLD_MIXTURE_STANDARD_CONVOLUTION "Use standard convolutions instead of the optimized Fourier ones." 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 HOGPyramid.h Intersector.h JPEGImage.h LBFGS.h Mixture.h Model.h Object.h Patchwork.h Rectangle.h Scene.h SimpleOpt.h)
SET(SOURCES HOGPyramid.cpp JPEGImage.cpp LBFGS.cpp Mixture.cpp Model.cpp Object.cpp Patchwork.cpp Rectangle.cpp Scene.cpp)
ADD_EXECUTABLE(train ${HEADERS} ${SOURCES} train.cpp)
ADD_EXECUTABLE(test ${HEADERS} ${SOURCES} test.cpp)
ADD_EXECUTABLE(test_images ${HEADERS} ${SOURCES} test_images.cpp)
# Define the options
IF(FFLD_HOGPYRAMID_DOUBLE)
MESSAGE("Use doubles instead of floats.")
ADD_DEFINITIONS(-DFFLD_HOGPYRAMID_DOUBLE)
ENDIF()
IF(FFLD_HOGPYRAMID_EXTRA_FEATURES)
MESSAGE("Use extra features (LBP + color) in addition to HOG.")
ADD_DEFINITIONS(-DFFLD_HOGPYRAMID_EXTRA_FEATURES)
ENDIF()
IF(FFLD_MODEL_3D)
MESSAGE("Allow parts to also deform across scales.")
ADD_DEFINITIONS(-DFFLD_MODEL_3D)
ENDIF()
IF(FFLD_MIXTURE_STANDARD_CONVOLUTION)
MESSAGE("Use standard convolutions instead of the optimized Fourier ones.")
ADD_DEFINITIONS(-DFFLD_MIXTURE_STANDARD_CONVOLUTION)
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(train ${FFTW3_LIBRARIES})
TARGET_LINK_LIBRARIES(test ${FFTW3_LIBRARIES})
TARGET_LINK_LIBRARIES(test_images ${FFTW3_LIBRARIES})
FIND_PACKAGE(JPEG REQUIRED)
IF(JPEG_FOUND)
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(train ${JPEG_LIBRARIES})
TARGET_LINK_LIBRARIES(test ${JPEG_LIBRARIES})
TARGET_LINK_LIBRARIES(test_images ${JPEG_LIBRARIES})
ENDIF()
FIND_PACKAGE(LibXml2 REQUIRED)
IF(LIBXML2_FOUND)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(train ${LIBXML2_LIBRARIES})
TARGET_LINK_LIBRARIES(test ${LIBXML2_LIBRARIES})
TARGET_LINK_LIBRARIES(test_images ${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()