ament_cmake生成ROS2库并链接

网友投稿 898 2022-10-12

ament_cmake生成ROS2库并链接

ament_cmake生成ROS2库并链接

cmake_minimum_required(VERSION 3.5)project(arm_controller)set(BUILD_TEST TRUE)set(LIB_NAME libarmcore)# Default to C99if(NOT CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 99)endif()# Default to C++14if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14)endif()if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic)endif()# find dependenciesfind_package(ament_cmake REQUIRED)find_package(rclcpp REQUIRED)find_package(rclcpp_action REQUIRED)find_package(comm_interfaces REQUIRED)find_package(trajectory_msgs REQUIRED)find_package(geometry_msgs REQUIRED)find_package(yaml-cpp REQUIRED)find_package(spdlog REQUIRED) include_directories( include/)LINK_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/libs ${CMAKE_INSTALL_PREFIX}/lib)add_library(libarmcore SHARED #interface src/config/ArmConfigInterface.cpp #jaka # src/arm/ArmJaka.cpp src/arm/ArmJakaTcp.cpp src/arm/ArmLittleJakaTcp.cpp src/arm/ArmTest.cpp #pose src/pose/Pose.cpp #error src/ArmErrors.cpp #controller src/arm/ArmController.cpp #factory src/ArmFactory.cpp #tools src/tools/YamlTool.cpp src/tools/StringTool.cpp src/tools/NetTool.cpp #tcp src/tools/tcp/client.cpp src/tools/tcp/server.cpp #log src/ArmLogger.cpp #python src/Controller.cpp)target_include_directories(libarmcore PUBLIC $ $ )ament_target_dependencies(libarmcore PUBLIC ${Boost_LIBRARIES} rclcpp trajectory_msgs geometry_msgs comm_interfaces)#ament_export_targets(libarmcore HAS_LIBRARY_TARGET)#ament_export_dependencies(rclcpp)install( DIRECTORY include/ DESTINATION include)install( TARGETS libarmcore EXPORT libarmcore LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin INCLUDES DESTINATION include)add_executable(${PROJECT_NAME} src/main.cpp)target_link_libraries(${PROJECT_NAME} libarmcore jsoncpp yaml-cpp spdlog )ament_target_dependencies(${PROJECT_NAME} rclcpp trajectory_msgs geometry_msgs rclcpp_action comm_interfaces)install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME})if (BUILD_TEST ) add_executable(test_${PROJECT_NAME} test/test.cpp ) target_link_libraries(test_${PROJECT_NAME} libarmcore jsoncpp yaml-cpp spdlog ) ament_target_dependencies(test_${PROJECT_NAME} rclcpp trajectory_msgs geometry_msgs rclcpp_action comm_interfaces ) install(TARGETS test_${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) endif()ament_package()

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:银行营销策略数据分析 - 智能定位
下一篇:基于玩android开放API完成的《玩android》微信小程序版本
相关文章

 发表评论

暂时没有评论,来抢沙发吧~