This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
161 lines (122 loc) · 4.64 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(bais)
if (POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
# Options
# -----------------------------------------------------------------------------
option(with_qt_gui "include image acquisition GUI" ON)
option(with_fc2 "include the FlyCapture2 backend" OFF)
option(with_dc1394 "include the libdc1394 backend" ON )
option(with_demos "include demos" OFF)
option(with_tests "include tests" ON)
message(STATUS "Option: with_fc2 = ${with_fc2}")
message(STATUS "Option: with_dc1394 = ${with_dc1394}")
message(STATUS "Option: with_qt_gui = ${with_qt_gui}")
message(STATUS "Option: with_demos = ${with_demos}")
message(STATUS "Option: with_tests = ${with_tests}")
if( NOT( with_fc2 OR with_dc1394 ) )
message(FATAL_ERROR "their must be at least one camera backend")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
# Opencv library
# -----------------------------------------------------------------------------
find_package( OpenCV REQUIRED )
if(${OpenCV_FOUND})
message(STATUS "OpenCV found")
else()
message(STATUS "OpenCv not found")
endif()
# FlyCapture2 library location - replace this this custom find_package
# -----------------------------------------------------------------------------
if(with_fc2)
find_package( FlyCapture2 MODULE REQUIRED )
endif()
# Qt library
# ------------------------------------------------------------------------------
if(with_qt_gui)
set(QT_BINARY_DIR "$ENV{QTDIR}/bin")
# Old qt 4.8 build
# ------------------------------------------------------------
#find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)
# ------------------------------------------------------------
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Network REQUIRED)
endif()
# Compiler flags
# -----------------------------------------------------------------------------
#set(CMAKE_CXX_FLAGS "-std=gnu++0x -O2 -Wall")
set(CMAKE_CXX_FLAGS "-std=gnu++0x -O2")
#set(CMAKE_CXX_FLAGS "-std=gnu++0x -mwindows -O2")
# Definitions
# -----------------------------------------------------------------------------
add_definitions(-DDebug)
if(with_fc2)
add_definitions(-DWITH_FC2)
endif()
if(with_dc1394)
add_definitions(-DWITH_DC1394)
endif()
# Include directories
# -----------------------------------------------------------------------------
include_directories("./src/backend/base")
include_directories("./src/facade")
include_directories("./src/utility")
include_directories("./src/gui")
include_directories("./src/plugin/base")
include_directories("./src/plugin/stampede")
include_directories("./src/plugin/grab_detector")
include_directories("./src/3rd_party/qcustomplot")
if(with_fc2)
include_directories(${FlyCapture2_INCLUDE_DIRS})
include_directories("./src/backend/fc2")
endif()
if(with_dc1394)
include_directories("./src/backend/dc1394")
# Add custom libdc1394
#include_directories("/home/wbd/local/include")
#link_directories("/home/wbd/local/lib")
endif()
# External link libraries
# -----------------------------------------------------------------------------
set(bias_ext_link_LIBS ${OpenCV_LIBS})
if(with_fc2)
set(bias_ext_link_LIBS ${bias_ext_link_LIBS} ${FlyCapture2_LIBRARIES})
endif()
if(with_dc1394)
if (WIN32)
set(bias_ext_link_LIBS ${bias_ext_link_LIBS} dc1394 1394camera setupapi)
else()
set(bias_ext_link_LIBS ${bias_ext_link_LIBS} dc1394)
endif()
endif()
set(bias_ext_link_LIBS ${bias_ext_link_LIBS})
# Output directory for executables - puts executables in build directory
# -----------------------------------------------------------------------------
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# Add project subdirectories
# -----------------------------------------------------------------------------
add_subdirectory("src/backend/base")
if(with_fc2)
add_subdirectory("src/backend/fc2")
endif()
if(with_dc1394)
add_subdirectory("src/backend/dc1394")
endif()
add_subdirectory("src/facade")
add_subdirectory("src/utility")
add_subdirectory("src/plugin/base")
add_subdirectory("src/plugin/stampede")
add_subdirectory("src/plugin/grab_detector")
add_subdirectory("src/3rd_party/qcustomplot")
if(with_qt_gui)
add_subdirectory("src/gui")
endif()
if (with_demos)
add_subdirectory("src/demo/fly_sorter")
endif()
if (with_tests)
add_subdirectory("src/test")
endif()