forked from f1tenth/f1tenth_simulator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
112 lines (90 loc) · 2.7 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
cmake_minimum_required(VERSION 3.1)
project(f1tenth_simulator_two_agents)
set(CMAKE_CXX_STANDARD 11)
if(NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
find_package(Eigen3)
######################################
# Compile the library >
######################################
# Add includes
include_directories(include)
file(GLOB SRC_FILES src/*.cpp)
add_library(${PROJECT_NAME} ${SRC_FILES})
target_link_libraries(${PROJECT_NAME} ${LIBS})
set(LIBS ${LIBS} ${PROJECT_NAME})
# Install the library to CMAKE_INSTALL_PREFIX
# which defaults to /usr/local
install(TARGETS ${PROJECT_NAME}
DESTINATION lib)
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION include)
######################################
# < End compile the library
######################################
######################################
# ROS >
######################################
# Only run this code in the catkin environment
if(DEFINED CATKIN_DEVEL_PREFIX)
find_package(catkin REQUIRED COMPONENTS
roslib
roscpp
tf2
tf2_ros
tf2_geometry_msgs
ackermann_msgs
nav_msgs
sensor_msgs
geometry_msgs
rospy
interactive_markers
visualization_msgs
std_msgs
message_generation
)
generate_messages(
DEPENDENCIES
std_msgs
nav_msgs
sensor_msgs
)
# Include catkin_libraries
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS message_runtime
)
set(LIBS ${LIBS} ${catkin_LIBRARIES})
include_directories(include ${catkin_INCLUDE_DIRS})
# Add the py nodes
file(GLOB NODE_PY_FILES node/*.py)
foreach(_node_file ${NODE_PY_FILES})
catkin_install_python(PROGRAMS ${_node_file} DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
endforeach()
# Add the cpp nodes
file(GLOB NODE_SRC_FILES node/*.cpp)
foreach(_node_file ${NODE_SRC_FILES})
get_filename_component(_node_name ${_node_file} NAME_WE)
add_executable(${_node_name} ${_node_file})
target_link_libraries(${_node_name} ${LIBS})
add_dependencies(${_node_name} f1tenth_simulator_two_agents_generate_messages_cpp)
endforeach()
target_link_libraries(simulator ${catkin_LIBRARIES})
# Install the library
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
endif()
######################################
# < End ROS
######################################