forked from subeiammar/avt_vimba_camera
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
155 lines (137 loc) · 3.99 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
cmake_minimum_required(VERSION 2.8.3)
project(avt_vimba_camera)
find_package(catkin REQUIRED COMPONENTS
camera_info_manager
diagnostic_updater
dynamic_reconfigure
image_transport
message_filters
roscpp
sensor_msgs
std_msgs
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
)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS camera_info_manager diagnostic_updater dynamic_reconfigure image_transport roscpp sensor_msgs std_msgs
)
###########
## Build ##
###########
include_directories(
${catkin_INCLUDE_DIRS}
include
)
# C++11 support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++14" 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++14")
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++14 support. Please use a different C++ compiler.")
endif()
function(add_dependencies_and_linkings arg)
add_dependencies(${arg}
${PROJECT_NAME}_gencfg
)
if("${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)
# Nodes
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(trigger_node
src/nodes/trigger_node.cpp
src/trigger.cpp
)
add_dependencies_and_linkings(trigger_node)
# Nodelets
add_library(avt_camera_nodelets
src/nodes/mono_camera_nodelet.cpp
src/mono_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
trigger_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"
)
## Mark other files for installation (e.g. launch and bag files, etc.)
install(FILES
README.md
plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY
launch
calibrations
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
if("${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()