转qt5-ros cmakelist配置

https://www.ncnynl.com/archives/202006/3775.html

CMakelist.txt

##############################################################################
# CMake
##############################################################################

cmake_minimum_required(VERSION 2.8.0)
project(testmap)

add_compile_options(-std=c++11)

set(CMAKE_AUTOMOC ON)
#set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

#if(CMAKE_VERSION VERSION_LESS "3.7.0")
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
#endif()

##############################################################################
# Catkin
##############################################################################

# qt_build provides the qt cmake glue, roscpp the comms for a default talker
find_package(catkin REQUIRED COMPONENTS qt_build roscpp std_msgs  message_generation
    autoware_msgs
    waypoint_maker
    )
include_directories(${catkin_INCLUDE_DIRS})


find_package(Qt5 REQUIRED Core Widgets Gui)
set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Gui)


#lei
message(${catkin_INCLUDE_DIRS})

#lei
generate_messages(
   DEPENDENCIES
   std_msgs
)

# Use this to define what the package will export (e.g. libs, headers).
# Since the default here is to produce only a binary, we don't worry about
# exporting anything. 

#lei
#catkin_package()
#lei
catkin_package(CATKIN_DEPENDS
    roscpp
    std_msgs
    message_runtime)

##############################################################################
# Qt Environment
##############################################################################

# this comes from qt_build's qt-ros.cmake which is automatically 
# included via the dependency call in package.xml
#rosbuild_prepare_qt4(QtCore QtGui) # Add the appropriate components to the component list here


##############################################################################
# Sections
##############################################################################

#file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
#file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
#file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/testmap/*.hpp)

#QT4_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
#QT4_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
#QT4_WRAP_CPP(QT_MOC_HPP ${QT_MOC})

# file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
# file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
# file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/testmap/*.hpp)

file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS
    include/onboard_panel/*.hpp
    include/onboard_panel/*.h
    include/onboard_panel/node/*.h
    include/onboard_panel/model/*.h
    include/onboard_panel/view/*.h
    include/onboard_panel/controller/*.h
    #../../core_planning/waypoint_maker/nodes/waypoint_saver/waypoint_saver.h
)

##用Qt5环境#####
QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
QT5_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC})

##############################################################################
# Sources
##############################################################################

#file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp)

file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS
    src/*.cpp
    src/node/*.cpp
    src/model/*.cpp
    src/controller/*.cpp
    src/view/*.cpp
    #../../core_planning/waypoint_maker/nodes/waypoint_saver/waypoint_saver.cpp
    )

##############################################################################
# Binaries
##############################################################################

#add_executable(onboard_panel ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
#target_link_libraries(onboard_panel ${QT_LIBRARIES} ${catkin_LIBRARIES} Qt5::Core Qt5::Widgets Qt5::Gui)
#install(TARGETS onboard_panel RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

add_executable(testmap ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP} )
target_link_libraries(testmap ${QT_LIBRARIES} ${catkin_LIBRARIES} Qt5::Core Qt5::Widgets Qt5::Gui)
add_dependencies(testmap ${PROJECT_NAME}_generate_messages_cpp)
install(TARGETS testmap RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

package.xml

<?xml version="1.0"?>
<package>
  <name>testmap</name>
  <version>0.1.0</version>
  <description>
     testmap
  </description>
  <maintainer email="ros@gmail.com">ros</maintainer>
  <author>ros</author>
  <license>BSD</license>
  <!-- <url type="bugtracker">https://github.com/stonier/qt_ros/issues</url> -->
  <!-- <url type="repository">https://github.com/stonier/qt_ros</url> -->

  <buildtool_depend>catkin</buildtool_depend>
 <!-- <build_depend>qt_build</build_depend> -->
  <build_depend>qtbase5-dev</build_depend>
  <run_depend>qtbase5-dev</run_depend>

  <build_depend>roscpp</build_depend>

<!--  <build_depend>libqt4-dev</build_depend> -->

<!--  <run_depend>qt_build</run_depend>  -->

  <run_depend>roscpp</run_depend>

<!--  <run_depend>libqt4-dev</run_depend> -->


    <build_depend>libqt5-core</build_depend>
    <run_depend>libqt5-core</run_depend>

    <build_depend>libqt5-widget</build_depend>
    <run_depend>libqt5-widget</run_depend>

    <build_depend>libqt5-gui</build_depend>
    <run_depend>libqt5-gui</run_depend>


    <build_depend>std_msgs</build_depend>
    <run_depend>std_msgs</run_depend>

    <build_depend>roscpp</build_depend>
    <run_depend>roscpp</run_depend>



    <build_depend>message_generation</build_depend>
    <run_depend>message_runtime</run_depend>

 
</package>

 

 

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值