package.xml学习记录
一、package.xml
pacakge.xml文件用于描述pacakge的基本信息,package的名称、版本号、内容描述、维护人员、软件许可、编译构建工具、编译依赖、运行依赖等信息。
二、package.xml的写法
现在有两种格式并存(format1与format2),区别不大。
1.format1
<pacakge> 根标记文件
<name> 包名
<version> 版本号
<description> 内容描述
<maintainer> 维护者
<license> 软件许可证
<buildtool_depend> 编译构建工具,通常为catkin
<build_depend> 编译依赖项,与Catkin中的
<run_depend> 运行依赖项
2.format2
<pacakge> 根标记文件
<name> 包名
<version> 版本号
<description> 内容描述
<maintainer> 维护者
<license> 软件许可证
<buildtool_depend> 编译构建工具,通常为catkin
<depend> 指定依赖项为编译、导出、运行需要的依赖,最常用
<build_depend> 编译依赖项
<build_export_depend> 导出依赖项
<exec_depend> 运行依赖项
<test_depend> 测试用例依赖项
<doc_depend> 文档依赖项
三、package.xml的例子
以turtlesim软件包为例,其pacakge.xml文件内容如下
老版本1.0
<?xml version="1.0"?> <!--本示例为老版本的pacakge.xml-->
<package> <!--pacakge为根标签,写在最外面-->
<name>turtlesim</name>
<version>0.8.1</version>
<description>
turtlesim is a tool made for teaching ROS and ROS packages.
</description>
<maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer>
<license>BSD</license>
<url type="website">http://www.ros.org/wiki/turtlesim</url>
<url type="bugtracker">https://github.com/ros/ros_tutorials/issues</url>
<url type="repository">https://github.com/ros/ros_tutorials</url>
<author>Josh Faust</author>
<!--编译工具为catkin-->
<buildtool_depend>catkin</buildtool_depend>
<!--编译时需要依赖以下包-->
<build_depend>geometry_msgs</build_depend>
<build_depend>qtbase5-dev</build_depend>
<build_depend>message_generation</build_depend>
<build_depend>qt5-qmake</build_depend>
<build_depend>rosconsole</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>roscpp_serialization</build_depend>
<build_depend>roslib</build_depend>
<build_depend>rostime</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>std_srvs</build_depend>
<!--运行时需要依赖以下包-->
<run_depend>geometry_msgs</run_depend>
<run_depend>libqt5-core</run_depend>
<run_depend>libqt5-gui</run_depend>
<run_depend>message_runtime</run_depend>
<run_depend>rosconsole</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>roscpp_serialization</run_depend>
<run_depend>roslib</run_depend>
<run_depend>rostime</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>std_srvs</run_depend>
</package>
新版本,值得注意的是 在声明pacakge时指定format2,为新版格式
<?xml version="1.0"?>
<package format="2"> <!--在声明pacakge时指定format2,为新版格式-->
<name>turtlesim</name>
<version>0.8.1</version>
<description>
turtlesim is a tool made for teaching ROS and ROS packages.
</description>
<maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer>
<license>BSD</license>
<url type="website">http://www.ros.org/wiki/turtlesim</url>
<url type="bugtracker">https://github.com/ros/ros_tutorials/issues</url>
<url type="repository">https://github.com/ros/ros_tutorials</url>
<author>Josh Faust</author>
<!--编译工具为catkin-->
<buildtool_depend>catkin</buildtool_depend>
<!--用depend来整合build_depend和run_depend-->
<depend>geometry_msgs</depend>
<depend>rosconsole</depend>
<depend>roscpp</depend>
<depend>roscpp_serialization</depend>
<depend>roslib</depend>
<depend>rostime</depend>
<depend>std_msgs</depend>
<depend>std_srvs</depend>
<!--build_depend标签未变-->
<build_depend>qtbase5-dev</build_depend>
<build_depend>message_generation</build_depend>
<build_depend>qt5-qmake</build_depend>
<!--run_depend要改为exec_depend-->
<exec_depend>libqt5-core</exec_depend>
<exec_depend>libqt5-gui</exec_depend>
<exec_depend>message_runtime</exec_depend>
</package>