forked from neufieldrobotics/spinnaker_sdk_camera_driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·149 lines (122 loc) · 4.29 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
cmake_minimum_required(VERSION 2.8.3)
project(spinnaker_sdk_camera_driver)
add_compile_options(-std=c++11)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
###
# camera Acquisition specific
###
set(PROJECT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include" CACHE PATH "Project Include Directory")
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
message_generation
cv_bridge
image_transport
sensor_msgs
dynamic_reconfigure
nodelet
)
find_package(trigger_msgs)
#find_package(PCL REQUIRED)
###
# Acquisition specific
###
# Find Packages
find_package(Spinnaker REQUIRED)
message("spinnaker lib : " ${Spinnaker_LIBRARIES})
find_package(OpenCV REQUIRED)
# use LibUnwind only for x86_64 or x86_32 architecture
# do not use LibUnwind for arm architecture
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64 OR x86_32)
message("uses LibUnwind for x86_64 or x86_32 architecture")
find_package(LibUnwind REQUIRED)
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64 OR x86_32)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
message("Detected ARM architecture")
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
find_package(Boost REQUIRED)
if(Boost_FOUND)
find_package ( Boost COMPONENTS filesystem system serialization REQUIRED )
set(Boost_GENERAL ${Boost_LIBRARIES})
elseif(NOT Boost_FOUND)
message("Boost not found!")
endif()
# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
"${PROJECT_SOURCE_DIR}/include/spinnaker_sdk_camera_driver/spinnaker_configure.h.in"
"${PROJECT_SOURCE_DIR}/include/spinnaker_sdk_camera_driver/spinnaker_configure.h"
)
add_message_files(
FILES
SpinnakerImageNames.msg
)
generate_dynamic_reconfigure_options(
cfg/spinnaker_cam.cfg
)
generate_messages(
DEPENDENCIES
std_msgs
)
## setting catkin_package, include_directories and libs based on architecture
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64 OR x86_32)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp std_msgs message_runtime nodelet
DEPENDS OpenCV LibUnwind
)
include_directories(
${PROJECT_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
SYSTEM ${Spinnaker_INCLUDE_DIRS}
SYSTEM ${OpenCV_INCLUDE_DIRS}
SYSTEM ${Boost_INCLUDE_DIR}
${LibUnwind_INCLUDE_DIRS}
)
link_directories( ${Spinnaker_LIBRARIES} )
set (LIBS ${LibUnwind_LIBRARIES} ${Spinnaker_LIBRARIES} ${OpenCV_LIBS} ${Boost_GENERAL})
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64 OR x86_32)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp std_msgs message_runtime nodelet
DEPENDS OpenCV
)
include_directories(
${PROJECT_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
SYSTEM ${Spinnaker_INCLUDE_DIRS}
SYSTEM ${OpenCV_INCLUDE_DIRS}
SYSTEM ${Boost_INCLUDE_DIR}
)
link_directories( ${Spinnaker_LIBRARIES} )
set (LIBS ${Spinnaker_LIBRARIES} ${OpenCV_LIBS} ${Boost_GENERAL})
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
# Make package version available in CPP as a defination
add_definitions("-D${PROJECT_NAME}_VERSION=\"${${PROJECT_NAME}_VERSION}\"")
add_library (acquilib SHARED
src/capture.cpp
src/camera.cpp
)
add_dependencies(acquilib ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencfg)
target_link_libraries(acquilib ${LIBS} ${catkin_LIBRARIES})
add_executable (acquisition_node src/acquisition_node.cpp)
add_dependencies(acquisition_node acquilib ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencfg)
target_link_libraries (acquisition_node acquilib ${LIBS} ${catkin_LIBRARIES})
## subscriber_example for subscribing as nodelet
add_library (subscriber_example examples/subscriber_nodelet.cpp)
add_dependencies(subscriber_example ${catkin_EXPORTED_TARGETS})
target_link_libraries(subscriber_example ${catkin_LIBRARIES})
install(TARGETS acquilib acquisition_node subscriber_example
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
)
install(FILES nodelet_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)