forked from RaymondCM/topic_store
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
81 lines (67 loc) · 2.55 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
cmake_minimum_required(VERSION 2.8.3)
project(topic_store)
## Add support for C++11, supported in ROS Kinetic and newer
add_definitions(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
genmsg
std_msgs
sensor_msgs
actionlib_msgs
ros_numpy
message_generation
)
# ==============================================
# Python scripts setup
# ==============================================
if(DEFINED ENV{INSTALL_TOPIC_STORE_PYTHON_FROM_PIP})
# Install python dependancies (first try to install locally, then to user site_packages)
find_package(PythonInterp REQUIRED)
set(return_status "1")
set(failed_commands "")
foreach(flag "" "--user")
set(command "pip install -r ${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt ${flag}")
execute_process (COMMAND bash -c "${command}" OUTPUT_VARIABLE output_var ERROR_VARIABLE error_var
RESULT_VARIABLE return_status)
message(WARNING "${command}Not a warning just output of pip install dependancies:\n${output_var}")
if(return_status EQUAL "0")
break()
endif()
list(APPEND failed_commands "\n\t- '${command}'")
endforeach()
if(NOT return_status EQUAL "0")
message(SEND_ERROR "${output_var}")
message(SEND_ERROR "${error_var}")
message(FATAL_ERROR "Failed to install python requirements with:${failed_commands}")
endif()
endif()
catkin_python_setup()
# ==============================================
# Service/Message files setup
# ==============================================
# add_service_files( FILES )
# add_message_files( FILES )
add_action_files(DIRECTORY action FILES CollectData.action)
generate_messages(DEPENDENCIES std_msgs sensor_msgs topic_store actionlib_msgs)
# ==============================================
# Setup
# ==============================================
catkin_package(CATKIN_DEPENDS std_msgs message_runtime)
# ==============================================
# Install
# ==============================================
install(DIRECTORY "launch" "scenarios" "config" "action" DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
file(GLOB python_scripts_DIR "scripts/*.py")
file(GLOB docker_scripts_DIR "docker/*")
catkin_install_python(
PROGRAMS ${python_src_DIR} ${python_scripts_DIR} ${docker_scripts_DIR}
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# ==============================================
# Tests
# ==============================================
if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
add_rostest(tests/topic_store.test)
endif()