[ros-users] using Qt IDE in ROS?

Klaus Petersen klaus at moegi.waseda.jp
Fri Jul 23 08:54:17 UTC 2010


Hi Nitin,

Don't know if you have it down already, but just wanted to share my 
wisdom about making qt projects with ros and cmake. Check the 
CMakeLists.txt below.

Klaus


cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

include_directories(/usr/local/include/opencv /usr/local/include/dc1394 
/usr/local/include)
include_directories(/System/Library/Frameworks/CoreAudio.framework/Headers)
include_directories(/usr/local/include/portaudio)
include_directories(/usr/local/include/portmidi)

link_directories(/opt/local/lib)
link_directories(/usr/local/lib)

set( sources	
	src/audio4good.cpp
	src/rec_pa.cpp
	src/analyze.cpp
	src/tone_sequence.cpp
	src/colors.cpp
	src/spectrum_win.cpp
	src/pm_rec.cpp
)

set( headers
	include/k_rnsound_node/audio4good.h
	include/k_rnsound_node/rec_pa.h
	include/k_rnsound_node/analyze.h
	include/k_rnsound_node/audio_defs.h
	include/k_rnsound_node/tone_sequence.h
	include/k_rnsound_node/colors.h
	include/k_rnsound_node/spectrum_win.h
	include/k_rnsound_node/pm_rec.h
)

if (APPLE)
	find_library(COREAUDIO_LIBRARY CoreAudio)
	find_library(COREFOUNDATION_LIBRARY CoreFoundation)
	find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
	find_library(AUDIOUNIT_LIBRARY AudioUnit)
	find_library(CORESERVICES_LIBRARY CoreServices)
	find_library(COREMIDI_LIBRARY CoreMIDI)
	find_library(CARBON_LIBRARY Carbon)	
endif (APPLE)

add_definitions(-Wall)

find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
qt4_wrap_cpp(moc_sources ${headers})
include_directories(${CMAKE_BINARY_DIR})
include_directories(${QT_INCLUDE_DIR})

rosbuild_add_executable(k_rnsound_node ${sources} ${headers} ${moc_sources})
target_link_libraries(k_rnsound_node ${QT_LIBRARIES} gsl gslcblas)
target_link_libraries(k_rnsound_node IOKit cv cxcore libdc1394.a)
target_link_libraries(k_rnsound_node libportmidi_s.a)
target_link_libraries(k_rnsound_node libportaudio.a)
target_link_libraries(k_rnsound_node ${COREAUDIO_LIBRARY} 
${COREFOUNDATION_LIBRARY})
target_link_libraries(k_rnsound_node ${AUDIOTOOLBOX_LIBRARY} 
${AUDIOUNIT_LIBRARY})
target_link_libraries(k_rnsound_node ${CORESERVICES_LIBRARY} 
${COREMIDI_LIBRARY})
target_link_libraries(k_rnsound_node ${CARBON_LIBRARY})


nitinDhiman さんは書きました:
> Hi Daniel,
> I can import individual package each as individual projects.  Have you tried
> importing multiple packages as single project?
> Examples are welcome :)
> 
> thank you 
> nitin




More information about the ros-users mailing list