ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

No qt_build in ROS Jade? [closed]

asked 2015-07-08 14:30:14 -0600

updated 2015-07-09 17:17:50 -0600

Hi,

will there be a version of qt_build in Jade? Or how do I replace it?

Greetings, Stephan

Edit

Thanks for the solutions. I actually didn't made it work with Qt5, because of some changes in namespaces between Qt4 and Qt5. So my solution is based on CMake's Documentation about Qt4. This is probably quite similar to you answer, so I marked it as a solution.

Thanks for your help!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Stopfer
close date 2015-07-09 17:18:29.857440

2 Answers

Sort by ยป oldest newest most voted
2

answered 2015-07-09 03:06:00 -0600

Simon Schmeisser gravatar image

if you use CMake 2.8.11 or newer (allowed in Jade and I think also Indigo) it gets even easier: http://doc.qt.io/qt-5/cmake-manual.html

cmake_minimum_required(VERSION 2.8.11)

project(testproject)

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

# Find the QtWidgets library
find_package(Qt5Widgets)

# Tell CMake to create the helloworld executable
add_executable(helloworld WIN32 main.cpp)

# Use the Widgets module from Qt 5.
target_link_libraries(helloworld Qt5::Widgets)

if you replace every 5 by a 4 you will get it build against qt4. Mixing is not allowed for the same target but inside the same CMakeLists.txt is ok

edit flag offensive delete link more
0

answered 2015-07-09 00:19:08 -0600

allenh1 gravatar image

qt_build can be replaced by using Qt in CMake. Here's an example.

cmake_minimum_required(VERSION 2.8.9)
project(ros_qt_controller)
find_package(catkin REQUIRED COMPONENTS roscpp)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)

catkin_package(
  CATKIN_DEPENDS roscpp geometry_msgs
  DEPENDS system-lib
)

qt5_add_resources(QT_RESOURCES_CPP qt_resources/arrows.qrc)
qt5_wrap_cpp(QT_MOC_HPP src/ControlWindow.h
                        src/RobotThread.h)

include_directories(src ${catkin_INCLUDE_DIRS})
include_directories(${Qt5Widgets_INCLUDE_DIRS})

add_executable(qt_ros_ctrl src/ControlWindow.cpp
                           src/RobotThread.cpp
                           src/main.cpp
                           ${QT_RESOURCES_CPP}
                           ${QT_MOC_HPP})

target_link_libraries(qt_ros_ctrl ${QT_LIBRARIES}
                      ${catkin_LIBRARIES} Qt5::Widgets)

install(TARGETS qt_ros_ctrl
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-07-08 14:30:14 -0600

Seen: 1,232 times

Last updated: Jul 09 '15