teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

CmakeListを追加しました

2020/01/09 06:48

投稿

syo_fr
syo_fr

スコア4

title CHANGED
File without changes
body CHANGED
@@ -131,4 +131,63 @@
131
131
  ```
132
132
 
133
133
  ### 試したこと
134
- Cmakeでコンパイルをしようとしましたがうまくいきませんでした
134
+ Cmakeでコンパイルをしようとしましたがうまくいきませんでした
135
+ CmakeListsも載せておきます
136
+
137
+ ```
138
+ cmake_minimum_required(VERSION 2.8.3)
139
+ project(test_opencv)
140
+
141
+ find_package(catkin REQUIRED COMPONENTS
142
+ cv_bridge image_transport roscpp rospy sensor_msgs std_msgs
143
+ )
144
+
145
+ find_package(OpenCV REQUIRED)
146
+
147
+ catkin_package(
148
+ INCLUDE_DIRS
149
+ LIBRARIES ${PROJECT_NAME}
150
+ CATKIN_DEPENDS cv_bridge image_transport roscpp rospy sensor_msgs std_msgs
151
+ DEPENDS
152
+ )
153
+
154
+ include_directories(include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
155
+
156
+ add_executable(test_opencv src/test_opencv.cpp)
157
+ target_link_libraries(test_opencv ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
158
+
159
+ add_executable(opencv_ros src/opencv_ros.cpp)
160
+ target_link_libraries(opencv_ros ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
161
+
162
+ add_executable(test_get_input src/test_get_input.cpp)
163
+ target_link_libraries(test_get_input ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
164
+
165
+ add_executable(test_edge_detection src/test_edge_detection.cpp)
166
+ target_link_libraries(test_edge_detection ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
167
+
168
+ add_executable(test_feature_detection src/test_feature_detection.cpp)
169
+ target_link_libraries(test_feature_detection ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
170
+
171
+ add_executable(test_feature_detection_matching src/test_feature_detection_matching.cpp)
172
+ target_link_libraries(test_feature_detection_matching ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
173
+
174
+ add_executable(test_svm src/test_svm.cpp)
175
+ target_link_libraries(test_svm ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
176
+
177
+ #############
178
+ ## Install ##
179
+ #############
180
+ foreach(dir launch img rviz)
181
+ install(DIRECTORY ${dir}/
182
+ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
183
+ endforeach(dir)
184
+
185
+
186
+ #############
187
+ ## Testing ##
188
+ #############
189
+ if (CATKIN_ENABLE_TESTING)
190
+ find_package(roslaunch REQUIRED)
191
+ roslaunch_add_file_check(launch)
192
+ endif()
193
+ ```