forked from srv/avt_vimba_camera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
181 lines (159 loc) · 4.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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
cmake_minimum_required(VERSION 2.8.3)
project(avt_vimba_camera)
find_package(catkin REQUIRED COMPONENTS
#libvimba
camera_info_manager
diagnostic_updater
dynamic_reconfigure
image_geometry
image_transport
message_filters
roscpp
sensor_msgs
std_msgs
polled_camera
nodelet
)
#Get architecture
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(TargetArchitecture)
target_architecture(ARCH)
#add dynamic reconfigure api
generate_dynamic_reconfigure_options(
cfg/AvtVimbaCamera.cfg
cfg/AvtVimbaCameraStereo.cfg
)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS camera_info_manager diagnostic_updater dynamic_reconfigure image_geometry image_transport roscpp sensor_msgs std_msgs polled_camera
)
###########
## Build ##
###########
include_directories(
#${libvimba_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
include
)
# C++11 support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
function(add_dependencies_and_linkings arg)
add_dependencies(${arg}
${PROJECT_NAME}_gencfg
#${libvimba_EXPORTED_TARGETS}
)
if("${ARCH}" STREQUAL i386)
target_link_libraries(${arg}
${catkin_LIBRARIES}
${CMAKE_CURRENT_SOURCE_DIR}/lib/32bit/libVimbaC.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/32bit/libVimbaCPP.so
)
elseif("${ARCH}" STREQUAL x86_64)
target_link_libraries(${arg}
${catkin_LIBRARIES}
${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaC.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaCPP.so
)
elseif("${ARCH}" STREQUAL armv7)
target_link_libraries(${arg}
${catkin_LIBRARIES}
${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaC.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaCPP.so
)
elseif("${ARCH}" STREQUAL armv8)
target_link_libraries(${arg}
${catkin_LIBRARIES}
${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaC.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaCPP.so
)
else()
message(FATAL_ERROR "[libvimba]: Architecture ${ARCH} not suported. Exiting...")
endif()
endfunction(add_dependencies_and_linkings)
add_executable(mono_camera_node
src/nodes/mono_camera_node.cpp
src/mono_camera.cpp
src/avt_vimba_camera.cpp
src/frame_observer.cpp
)
add_dependencies_and_linkings(mono_camera_node)
add_executable(stereo_camera_node
src/nodes/stereo_camera_node.cpp
src/stereo_camera.cpp
src/avt_vimba_camera.cpp
src/frame_observer.cpp
)
add_dependencies_and_linkings(stereo_camera_node)
add_executable(sync_node
src/nodes/sync_node.cpp
src/sync.cpp
)
add_dependencies_and_linkings(sync_node)
add_library(avt_camera_nodelets
src/nodes/mono_camera_nodelet.cpp
src/nodes/stereo_camera_nodelet.cpp
src/stereo_camera.cpp
src/avt_vimba_camera.cpp
src/frame_observer.cpp)
add_dependencies_and_linkings(avt_camera_nodelets)
#############
## Install ##
#############
## Mark executables and/or libraries for installation
install(TARGETS mono_camera_node stereo_camera_node avt_camera_nodelets
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
## Mark cpp header files for installation
install(DIRECTORY include
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
## Mark other files for installation (e.g. launch and bag files, etc.)
install(FILES
plugins.xml
launch/mono_camera.launch
launch/mono_camera_nodelet.launch
launch/stereo_camera_one_node.launch
launch/stereo_camera_two_nodes.launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
if("${ARCH}" STREQUAL i386)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/lib/32bit/libVimbaC.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/32bit/libVimbaCPP.so
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
elseif("${ARCH}" STREQUAL x86_64)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaC.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaCPP.so
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
elseif("${ARCH}" STREQUAL armv7)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaC.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaCPP.so
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
elseif("${ARCH}" STREQUAL armv8)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaC.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaCPP.so
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
endif()