source: pacpussensors/trunk/PtGreyCameras/CMakeLists.txt@ 110

Last change on this file since 110 was 99, checked in by nguyenhu, 9 years ago

compilation under linux with 0.2.X framework

File size: 4.8 KB
Line 
1#########################quick start############################################
2# cmake ../ -G "CodeBlocks - Unix Makefiles"
3# make
4# make install
5# make clean
6# sudo apt-get install libopencv-dev
7################################################################################
8project(PtGreyCameras)
9set(${PROJECT_NAME}_VERSION_MAJOR 0)
10set(${PROJECT_NAME}_VERSION_MINOR 1)
11# Create a DLL
12add_definitions(-DCVWEBCAM_COMPONENT_EXPORTS)
13add_definitions( -DVIDEO_EXPORTS )
14
15#include(FindOpenCV.cmake)
16find_package(OpenCV REQUIRED)
17
18# Check for OpenCV
19if(NOT OpenCV_FOUND)
20 message(FATAL_ERROR "Project ${PROJECT_NAME} requires OpenCV library")
21endif()
22################################################################################
23create_export(EXPORT_HDR ${PROJECT_NAME})
24pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
25add_definitions (${QT_DEFINITIONS})
26# ========================================
27# Options
28# ========================================
29option(BUILD_PtGreyCameras "Whether or not build the PointGrey cameras" OFF)
30if (BUILD_PtGreyCameras)
31 option(BUILD_BumbleBeeXB3 "Whether or not build the BumbleBeeXB3" OFF)
32 option(BUILD_FlyCapture2 "Whether or not build the FlyCapture2 based cameras" OFF)
33 # ========================================
34 # Find dependencies
35 # ========================================
36 if(BUILD_BumbleBeeXB3)
37 find_package(BumblebeeXB3 REQUIRED)
38 if(BumbleBeeXB3_FOUND)
39 list(APPEND OPT_LIBRARIES ${BumbleBeeXB3_LIBRARIES})
40 list(APPEND DBG_LIBRARIES ${BumbleBeeXB3_LIBRARIES})
41 list(APPEND OPT_INCLUDE_DIRS ${BumbleBeeXB3_INCLUDE_DIRS})
42 include_directories(${BumbleBeeXB3_INCLUDE_DIRS})
43 endif(BumbleBeeXB3_FOUND)
44 endif()
45 # ========================================
46 # Find dependencies
47 # ========================================
48 if(BUILD_FlyCapture2)
49 find_package(FlyCapture2 REQUIRED)
50 if(FlyCapture2_FOUND)
51 list(APPEND OPT_LIBRARIES ${FlyCapture2_LIBRARIES_OPT})
52 list(APPEND DBG_LIBRARIES ${FlyCapture2_LIBRARIES_OPT})
53 list(APPEND OPT_INCLUDE_DIRS ${FlyCapture2_INCLUDE_DIRS})
54 include_directories(${FlyCapture2_INCLUDE_DIRS})
55 endif(FlyCapture2_FOUND)
56 endif()
57endif()
58find_package(Qt5Network REQUIRED)
59################################################################################
60# DIRECTORIES
61include_directories(
62 ${PROJECT_BINARY_DIR}
63 ${QT_INCLUDE_DIR}
64 ${PACPUS_INCLUDE_DIR}
65 ${PACPUS_INCLUDE_DIR}/Pacpus/
66)
67
68# ========================================
69# Link directories
70# ========================================
71link_directories(
72 ${PACPUS_LIB_DIR}
73)
74
75################################################################################
76# FILES
77set(PROJECT_HDRS
78 ${EXPORT_HDR}
79 PtGreyCamerasExp.h
80 #../../StdDbtPlayerComponents/ImageBaseStructure.h
81)
82set(PROJECT_SRCS
83 ${PLUGIN_CPP}
84)
85
86if(OpenCV_FOUND)
87 list(APPEND OpenCV_LIBS ${OpenCV_LIBRARIES})
88 list(APPEND OpenCV_INCLUDE_DIR ${OpenCV_INCLUDE_DIRS})
89 include_directories(${OpenCV_INCLUDE_DIR})
90endif(OpenCV_FOUND)
91
92if(BUILD_PtGreyCameras AND BumbleBeeXB3_FOUND )
93 list(APPEND PROJECT_SRCS
94 BumblebeeXB3.cpp
95 BumblebeeXB3.h
96 )
97endif()
98
99if(BUILD_PtGreyCameras AND FlyCapture2_FOUND )
100 list(APPEND PROJECT_SRCS
101 Flea3Component.cpp
102 Flea3Component.h
103 Flea3Grabber.cpp
104 Flea3Grabber.h
105 )
106endif()
107
108set(FILES_TO_MOC
109 ${PLUGIN_HDR}
110)
111if(BUILD_PtGreyCameras AND BumbleBeeXB3_FOUND)
112 list(APPEND
113 FILES_TO_MOC
114 BumblebeeXB3.h
115 )
116endif()
117
118if(BUILD_PtGreyCameras AND FlyCapture2_FOUND)
119 list(APPEND
120 FILES_TO_MOC
121 Flea3Component.h
122 Flea3Grabber.h
123 )
124endif()
125
126set(UI_FILES
127)
128
129################################################################################
130# Qt: call moc, uic
131qt_wrap_cpp(PROJECT_MOC_SRCS
132 ${FILES_TO_MOC}
133)
134
135qt_wrap_ui(PROJECT_UI_SRCS
136 ${UI_FILES}
137)
138
139################################################################################
140# BUILD and LINK
141pacpus_add_library(${PROJECT_NAME} SHARED
142 ${PROJECT_HDRS}
143 ${PROJECT_SRCS}
144 ${PROJECT_MOC_SRCS}
145 ${PROJECT_UI_SRCS}
146)
147
148
149# ========================================
150# Libraries
151# ========================================
152set(LIBS
153 optimized FileLib debug FileLib_d
154 optimized PacpusLib debug PacpusLib_d
155 optimized PacpusTools debug PacpusTools_d
156)
157if (WIN32)
158 list(APPEND LIBS
159 optimized ROAD_TIME debug ROAD_TIME_d
160 )
161endif()
162# LINK
163target_link_libraries(${PROJECT_NAME}
164 ${PACPUS_LIBRARIES}
165 ${PACPUS_DEPENDENCIES_LIB}
166 ${LIBS}
167 ${QT_LIBRARIES}
168 ${OpenCV_LIBS}
169 )
170qt5_use_modules(${PROJECT_NAME} Network)
171################################################################################
172# FOLDERS
173pacpus_folder(${PROJECT_NAME} "components")
174################################################################################
175# INSTALL
176pacpus_install(${PROJECT_NAME})
Note: See TracBrowser for help on using the repository browser.