ROS中CMakeLists.txt和package.xml参考样例

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/daybreak222/article/details/84644034
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS 
 roscpp
 rospy
 std_msgs
 message_generation)

## Declare ROS messages and services
add_message_files(FILES Num.msg)
add_service_files(FILES AddTwoInts.srv)

## Generate added messages and services
add_service_files(
  FILES
  AddTwoInts.srv
)
generate_messages(DEPENDENCIES std_msgs)
## Declare a catkin package
catkin_package()

## Build talker and listener
include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker beginner_tutorials_generate_messages_cpp)

add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener beginner_tutorials_generate_messages_cpp)

add_executable(add_two_ints_server src/add_two_ints_server.cpp)
target_link_libraries(add_two_ints_server ${catkin_LIBRARIES})
add_dependencies(add_two_ints_server beginner_tutorials_gencpp)

add_executable(add_two_ints_client src/add_two_ints_client.cpp)
target_link_libraries(add_two_ints_client ${catkin_LIBRARIES})
add_dependencies(add_two_ints_client beginner_tutorials_gencpp)
cmake_minimum_required(VERSION 2.8.3)
project(carla_localization)

find_package(catkin REQUIRED
roscpp
rospy
carla_ros_bridge
sensor_msgs
pcl_ros
pcl_conversions
message_generation)

find_package(PCL REQUIRED)

add_message_files(FILES speed.msg)
## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  sensor_msgs
  # geometry_msgs
  std_msgs  # Or other packages containing msgs
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES carla_localization
#  CATKIN_DEPENDS other_catkin_pkg
#  DEPENDS system_lib
)

# 指定构建project所需要的资源
include_directories(${PCL_INCLUDE_DIRS})#包含头文件的位置
link_directories(${PCL_LIBRARY_DIRS})#添加链接器的lib库文件路径
add_definitions(${PCL_DEFINITIONS})

include_directories("./src/BasicFuns")
add_subdirectory("./src/BasicFuns") #这里还是文件夹的名字
## Build talker and listener
include_directories(include ${catkin_INCLUDE_DIRS})

# add_executable(receiver src/receiver.cpp)
# target_link_libraries(receiver ${catkin_LIBRARIES} ${PCL_LIBRARIES} basicFun)

# add_executable(localization src/receive_localization.cpp)
# target_link_libraries(localization ${catkin_LIBRARIES} ${PCL_LIBRARIES} basicFun)

add_executable(localizationICP src/localization_ICP.cpp)
target_link_libraries(localizationICP ${catkin_LIBRARIES} ${PCL_LIBRARIES} basicFun)

add_executable(local src/local_localization.cpp)
target_link_libraries(local ${catkin_LIBRARIES} ${PCL_LIBRARIES} basicFun)

add_executable(localization src/localization_online.cpp)
target_link_libraries(localization ${catkin_LIBRARIES} ${PCL_LIBRARIES} basicFun)

add_executable(localGT src/local_gt.cpp)
target_link_libraries(localGT ${catkin_LIBRARIES} ${PCL_LIBRARIES} basicFun)

add_executable(mapsending src/Map2rviz.cpp)
target_link_libraries(mapsending ${catkin_LIBRARIES} ${PCL_LIBRARIES} basicFun)

下面是package.xml

<?xml version="1.0"?>
<package format="2">
  <name>carla_localization</name>
  <version>0.0.1</version>
  <description>The carla_localization package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
  <maintainer email="[email protected]">think33</maintainer>


  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>rospy</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>sensor_msgs</build_depend>
  <build_depend>tf</build_depend>
  <build_depend>libpcl-all-dev</build_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>sensor_msgs</build_export_depend>
  <build_export_depend>tf</build_export_depend>
  <!-- <exec_depend>rospy</exec_depend> -->
  <exec_depend>roscpp</exec_depend>
  <exec_depend>sensor_msgs</exec_depend>
  <exec_depend>tf</exec_depend>
  <exec_depend>tf2</exec_depend>
  <exec_depend>rviz</exec_depend>
  <exec_depend>ackermann_msgs</exec_depend>
  <exec_depend>cv_bridge</exec_depend>
  <exec_depend>geometry_msgs</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <exec_depend>rosbag_storage</exec_depend>
  <!-- <run_depend>libpcl-all</run_depend> -->

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>
<?xml version="1.0"?>
<package format="2">
  <name>beginner_tutorials</name>
  <version>0.0.0</version>
  <description>The beginner_tutorials package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
  <maintainer email="[email protected]">think33</maintainer>


  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <build_depend>message_generation</build_depend>
  <!-- <run_depend>message_runtime</run_depend> -->
  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

猜你喜欢

转载自blog.csdn.net/daybreak222/article/details/84644034
今日推荐