zoukankan      html  css  js  c++  java
  • catkin_simple 的使用

    Catkin simple 可用于规范catkin package, 并简化CMakeLists 

    • Dependencies are just listed once as build-depend in the package.xml, not also as run-depend etc.
    • Dependencies 无需在 CMakeLists.txt 中列出
    • Explicit linking of dependencies is not needed anymore (e.g. no target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES}) needed)
    • Explicit inclusion of catkin include not needed anymore (e.g. no include_directories(${catkin_INCLUDES}) needed)
    • Export and installation commands are both one-liners.

    工具安装:

    cd $CATKIN_WS/src
    git clone git@github.com:catkin/catkin_simple.git
    cd $CATKIN_WS
    catkin_make

    示例代码:

    https://github.com/simonlynen/catkin_and_catkin_simple

    示例CMakelists 解释:

    https://github.com/catkin/catkin_simple/blob/master/README.md

     1 cmake_minimum_required(VERSION 2.8.3)
     2 project(foo)
     3 
     4 find_package(catkin_simple REQUIRED)
     5 
     6 catkin_simple(ALL_DEPS_REQUIRED) //调用 catkin_simple,call package.xml中的所用build_depend,并do find_package(...)操作
     7                     //当所有的package 成功找到,a list of "catkin build dependencies"出现,并传给find_package(catkin REQUIRED COMPONETS...) 
     8                     //然后增加local include 和 catkin include 目录,并传给include_directories(...)
     9                      //最后发现并编译ROS messages,services and actions which in msg/src/action 文件夹,注意当且仅当package.xml中build_depend 包含message_generation才执行该操作
    10                     //同样查找并编译dynamic_reconfigure 文件in cfg文件夹,注意当且仅当build_depend 包含dynamic_reconfigure
    11   
    12 cs_add_library(my_lib src/my_lib.cpp) //首先call directly through to add_library
    13                        //然后call target_link_libraries(my_lib ${catkin_LIBRARIES})去链接新库(注意build_depend需要包含新库)
    14                        //最后it does some bookkeeping so that your library target can be implicitly used later???
    15 
    16 
    17 cs_add_executable(my_exec src/main.cpp)//calls CMake's add_executable(...) instead.
    18 target_link_libraries(my_exec my_lib)   //注意这句话需要写出来 there is no way to enforce order of target creation. The executable is still automatically linked against the catkin libraries
    19 
    20 cs_install() //creates an installation rule for any libraries and executables you created with cs_ prefixed commands
    21 
    22 cs_install_scripts(scripts/my_script.py) 
    23 
    24 cs_export() //calls catkin_package(...) under the hood, extending that call with any libraries created and catkin_depends found automatically with catkin_simple

    存在的限制:

    1 There are several known assumptions and incorrect behaviors in catkin_simple which are a result of the trade-off of correctness for convenience.
    2 
    3 There is no warning when a catkin package is not found during find_package.
    4 There is over linking, as all libraries of all dependencies are linked against all targets indiscriminately.
    5 Assumes that the include folder is meant to be in the include path.
    6 If new .msg or .srv files are added, they will not be detected until you force CMake to run again
    7 All targets have a target dependency on any downstream message generation, which results in sub-optimal parallelization of targets, as there are unnecessary dependencies created.
  • 相关阅读:
    20145209预备作业01
    GDB调试汇编堆栈过程分析
    20145209 《信息安全系统设计基础》第14周学习总结
    20145209 《信息安全系统设计基础》第13周学习总结
    20145209 《信息安全系统设计基础》第13周学习总结
    2018-2019-2 20175320实验一《Java开发环境的熟悉》实验报告
    20175320 2018-2019-2 《Java程序设计》第5周学习总结
    20175320 2018-2019-2 《Java程序设计》第4周学习总结
    记2017问鼎杯预赛的wp---来自一个小菜鸡的感想
    利用python多线程实现多个客户端与单个服务端的远程ssh
  • 原文地址:https://www.cnblogs.com/yebo92/p/5841882.html
Copyright © 2011-2022 走看看