-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·86 lines (73 loc) · 2.31 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
cmake_minimum_required(VERSION 2.8.3)
project(pytorch_ros)
add_compile_options(-std=c++14)
# Locate the cmake file of torchlib
# set(Torch_DIR "/usr/local/lib/python3.8/dist-packages/torch/share/cmake/Torch/")
set(Torch_DIR "$ENV{TORCH_PATH}/torch/share/cmake/Torch/")
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
image_transport
cv_bridge
semantic_segmentation_srvs
tf2
tf2_ros
)
find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
find_package(OpenCV REQUIRED)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp rospy std_msgs
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
## Declare a C++ library
add_library(${PROJECT_NAME}
src/impl/pytorch_seg_trav_path_ros.cpp
src/impl/pytorch_cpp_wrapper_seg.cpp
src/impl/pytorch_cpp_wrapper_seg_trav.cpp
src/impl/pytorch_cpp_wrapper_seg_trav_path.cpp
src/impl/pytorch_cpp_wrapper_base.cpp
)
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
${TORCH_LIBRARIES}
${Open_CV_LIBS}
opencv_core opencv_highgui opencv_imgcodecs
)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
add_executable(pytorch_seg_trav_path_node src/pytorch_seg_trav_path_node.cpp src/impl/pytorch_seg_trav_path_ros.cpp)
add_executable(pytorch_seg_trav_node src/pytorch_seg_trav_node.cpp src/impl/pytorch_seg_trav_ros.cpp)
add_executable(pytorch_seg_node src/pytorch_seg_node.cpp src/impl/pytorch_seg_ros.cpp)
## Specify libraries to link a library or executable target against
target_link_libraries(pytorch_seg_trav_path_node
${catkin_LIBRARIES}
${PROJECT_NAME}
${TORCH_LIBRARIES}
)
target_link_libraries(pytorch_seg_trav_node
${catkin_LIBRARIES}
${PROJECT_NAME}
${TORCH_LIBRARIES}
)
target_link_libraries(pytorch_seg_node
${catkin_LIBRARIES}
${PROJECT_NAME}
${TORCH_LIBRARIES}
)