From 5549175469e72380e1fc1c2e092d88567c7abf82 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 20 Feb 2011 21:04:48 -0500 Subject: [PATCH] Added cmake build system. Almost working. --- .gitignore | 2 + .gitmodules | 6 +- CMakeLists.txt | 486 +++++++++++++++++++++++++++++++ CMakeModules/FindMAVLINK.cmake | 20 ++ CMakeModules/FindPhonon.cmake | 71 +++++ CMakeModules/LibFindMacros.cmake | 98 +++++++ autobuild.sh | 62 ++++ createTags | 5 + thirdParty/mavlink | 1 + 9 files changed, 748 insertions(+), 3 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 CMakeModules/FindMAVLINK.cmake create mode 100644 CMakeModules/FindPhonon.cmake create mode 100644 CMakeModules/LibFindMacros.cmake create mode 100755 autobuild.sh create mode 100755 createTags create mode 160000 thirdParty/mavlink diff --git a/.gitignore b/.gitignore index 6d8b9fdf0..88cceabc2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +*.swp +CMakeFiles *Makefile* tags build diff --git a/.gitmodules b/.gitmodules index aab53d925..f915dfb1d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "MAVLink"] - path = MAVLink - url = git://github.com/pixhawk/mavlink.git +[submodule "thirdParty/mavlink"] + path = thirdParty/mavlink + url = https://github.com/pixhawk/mavlink.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..20fde4d61 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,486 @@ +cmake_minimum_required (VERSION 2.6) + +project (qgroundcontrol) + +# marcos +macro(find_or_build_from_source PACKAGE PACKAGE_PATH IS_GIT_SUBMODULE) + add_custom_target(${PACKAGE}) + if (NOT ${PACKAGE}_BUILD_FROM_SOURCE) + find_package(${PACKAGE}) + endif() + if (NOT ${PACKAGE}_FOUND) + set(${PACKAGE}_BUILD_FROM_SOURCE TRUE) + message(STATUS "could not find package ${PACKAGE}, building from source") + add_custom_target(${PACKAGE}_BUILD DEPENDS ${PACKAGE}_BUILD.stamp) + add_dependencies(${PACKAGE} ${PACKAGE}_BUILD) + set(${PACKAGE}_FOUND TRUE) + if (${IS_GIT_SUBMODULE}) + message(STATUS "${PACKAGE} detected as git submodule, will attempt to initialize it") + list(APPEND GIT_SUBMODULES ${PACKAGE_PATH}) + add_dependencies(${PACKAGE}_BUILD GIT) + endif() + endif() +endmacro(find_or_build_from_source) + +macro(set_default VAR DEFAULT) + if (NOT DEFINED ${VAR}) + set(${VAR} ${DEFAULT}) + endif() +endmacro(set_default) + +# check for out of source build +if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") + message(FATAL_ERROR "In-source builds are not allowed. For example run: + rm CMakeCache.txt + mkdir build + cd build + cmake .. + make") +endif() + +# settings +set(qgroundcontrol_VERSION_MAJOR 0) +set(qgroundcontrol_VERSION_MINOR 2) +set(qgroundcontrol_VERSION_PATCH 0) +set(qgroundcontrol_SOVERSION 0) + +set_default(MAVLINK_BUILD_FROM_SOURCE FALSE) +set_default(STATIC_LINKING FALSE) +set_default(IN_SRC_BUILD FALSE) + +# built variables +set(qgroundcontrol_VERSION ${qgroundcontrol_VERSION_MAJOR}.${qgroundcontrol_VERSION_MINOR}.${qgroundcontrol_VERSION_PATCH}) +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) + +# only find static libraries +if(STATIC_LINKING) + message(WARNING "static linking is not yet fully functional and will have linking errors") + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif(WIN32) +endif() + +# set build type +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) +endif(NOT CMAKE_BUILD_TYPE) + +# enable languages +enable_language(C) +enable_language(CXX) + +# initialize variables +set(qgroundcontrol_LIBRARIES qgroundcontrolNavigation qgroundcontrolCommunication) +set(SCICOSLAB_BLOCKS stdBlocks;jsbsimBlocks;mavlinkBlocks) + +# installer +include(InstallRequiredSystemLibraries) +set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${qgroundcontrol_VERSION}") +set(CPACK_GENERATOR "DEB") +set(CPACK_SOURCE_GENERATOR "TGZ;ZIP") +set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") +set(CPACK_SET_DESTDIR TRUE) +set(CPACK_PACKAGE_CONTACT "James Goppert james.goppert@gmail.com") +set(CPACK_PACKAGE_DESCRITION_SUMMARY " + QGroundControl + + A qt based ground-control program for unmanned systems. + ") +set(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES} + /.git/;/build/;~$;.*\\\\.bin$;.*\\\\.swp$) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") +set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README") +set(CPACK_PACKAGE_VERSION_MAJOR ${qgroundcontrol_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${qgroundcontrol_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${qgroundcontrol_VERSION_PATCH}) +include(CPack) + +# add make dist target +add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) + +# git submodules +if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/.git) + message(STATUS "git repository detected, will attempt to load submodules") + set(FOUND_GIT_REPO TRUE) + add_custom_command(OUTPUT GIT.stamp + COMMAND cd ${PROJECT_SOURCE_DIR} && git submodule init ${GIT_SUBMODULES} + COMMAND cd ${PROJECT_SOURCE_DIR} && git submodule update ${GIT_SUBMODULES}) + add_custom_target(GIT DEPENDS GIT.stamp) +else() + set(FOUND_GIT_REPO FALSE) +endif() + +# find libraries with cmake modules +find_package(Qt4 COMPONENTS QtGui QtCore QtNetwork QtOpenGL QtSVG QtXML QtPhonon QtWebKit REQUIRED) +set(PHONON_FIND_QUIETLY FALSE) +find_packagE(Phonon) +find_package(SDL) +find_package(OpenGL) +find_package(OpenSceneGraph 2.8.3 COMPONENTS osgGA osgDB osgUtil osgViewer) +find_or_build_from_source(MAVLINK thirdParty/mavlink FOUND_GIT_REPO) + +# build libraries from source if not found on system +if(MAVLINK_BUILD_FROM_SOURCE) + set(MAVLINK_INCLUDE_DIRS + ${PROJECT_SOURCE_DIR}/thirdParty/mavlink/include + ${PROJECT_SOURCE_DIR}/thirdParty/mavlink/include/common + ${PROJECT_SOURCE_DIR}/thirdParty/mavlink/include/pixhawk + ${PROJECT_SOURCE_DIR}/thirdParty/mavlink/include/slugs + ${PROJECT_SOURCE_DIR}/thirdParty/mavlink/include/ualberta + ${PROJECT_SOURCE_DIR}/thirdParty/mavlink/include/ardupilotmega + ) + + add_custom_command(OUTPUT MAVLINK_BUILD.stamp + COMMAND touch MAVLINK_BUILD.stamp) +endif() + +# data directory +if(IN_SRC_BUILD) + message(STATUS "configuring for in source build") + set(DATADIR ${PROJECT_SOURCE_DIR}/data) + set(LIBDIR ${CMAKE_SOURCE_DIR}/data) + set(BINDIR ${CMAKE_BINARY_DIR}/bin) +else() + message(STATUS "configuring for install build") + set(DATADIR ${CMAKE_INSTALL_PREFIX}/share/qgroundcontrol/data) + set(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib) + set(BINDIR ${CMAKE_INSTALL_PREFIX}/bin) +endif() + +# install data files +install(DIRECTORY "${PROJECT_SOURCE_DIR}/data" + DESTINATION share/qgroundcontrol + PATTERN "*.git*" EXCLUDE) + +# pkgconfig +install(FILES + qgroundcontrol.pc + DESTINATION lib/pkgconfig + ) + +# internal library list definition / dep summary +message(STATUS "=======================================") +message(STATUS "\tLIBRARY\t\t\tBUILDING") +message(STATUS "=======================================") +message(STATUS "\t\tMavlink\t\tYES") +if (OPENSCENEGRAPH_FOUND) + list(APPEND qgroundcontrol_LIBRARIES qgroundcontrolVisualization) + message(STATUS "\t\tOpenSceneGraph\tYES") +else() + message(STATUS "\t\tOpenSceneGraph\t\tNO") +endif (OPENSCENEGRAPH_FOUND) +if (QT4_FOUND) + message(STATUS "\t\tQT4\t\tYES") +else() + message(STATUS "\t\tQT4\t\tNO") +endif (QT4_FOUND) +if (PHONON_FOUND) + message(STATUS "\t\tPHONON\t\tYES") +else() + message(STATUS "\t\tPHONON\t\tNO") +endif (PHONON_FOUND) +message(${PHONON_INCLUDE_DIR}) + +message(STATUS "=======================================") + +# project wide flags +include (${QT_USE_FILE}) +include_directories( + src + src/ui + src/ui/linechart + src/ui/uas + src/ui/map + src/ui/map3D + src/uas + src/comm + include/ui + src/input + src/lib/qmapcontrol + src/ui/mavlink + src/ui/param + src/ui/watchdog + src/ui/map3D + src/ui/designer + src/lib/qextserialport + src/lib/qwt + lib/QMapControl + ${SDL_INCLUDE_DIR} + ${OPENGL_INCLUDE_DIR} + ${PROJECT_BINARY_DIR} + ${OPENSCENEGRAPH_INCLUDE_DIRS} + ${QT_INCLUDE_DIRS} + ${PHONON_INCLUDE_DIR}/phonon + ${MAVLINK_INCLUDE_DIRS} + ) +link_libraries( + ${OPENGL_LIBRARIES} + ${OSG_LIBRARIES} + ${QT_LIBRARIES} + ${SDL_LIBRARY} + ${PHONON_LIBS} + ) +add_definitions(-D_TTY_POSIX_) + +set(qgroundcontrolUiSrc + src/ui/MainWindow.ui + src/ui/CommSettings.ui + src/ui/SerialSettings.ui + src/ui/UASControl.ui + src/ui/UASList.ui + src/ui/UASInfo.ui + src/ui/Linechart.ui + src/ui/UASView.ui + src/ui/ParameterInterface.ui + src/ui/WaypointList.ui + src/ui/WaypointView.ui + src/ui/ObjectDetectionView.ui + src/ui/JoystickWidget.ui + src/ui/DebugConsole.ui + src/ui/MapWidget.ui + src/ui/XMLCommProtocolWidget.ui + src/ui/HDDisplay.ui + src/ui/MAVLinkSettingsWidget.ui + src/ui/AudioOutputWidget.ui + src/ui/QGCSensorSettingsWidget.ui + src/ui/watchdog/WatchdogControl.ui + src/ui/watchdog/WatchdogProcessView.ui + src/ui/watchdog/WatchdogView.ui + src/ui/QGCFirmwareUpdate.ui + src/ui/QGCPxImuFirmwareUpdate.ui + src/ui/QGCDataPlot2D.ui + src/ui/QGCRemoteControlView.ui + src/ui/QMap3D.ui + src/ui/QGCWebView.ui + src/ui/map3D/QGCGoogleEarthView.ui + src/ui/SlugsDataSensorView.ui + src/ui/SlugsHilSim.ui + src/ui/SlugsPIDControl.ui + src/ui/SlugsVideoCamControl.ui + src/ui/SlugsPadCameraControl.ui + src/ui/uas/QGCUnconnectedInfoWidget.ui + src/ui/designer/QGCToolWidget.ui + src/ui/designer/QGCParamSlider.ui + src/ui/designer/QGCActionButton.ui + src/ui/QGCMAVLinkLogPlayer.ui + src/ui/QGCWaypointListMulti.ui + src/ui/mission/QGCCustomWaypointAction.ui + src/ui/QGCUDPLinkConfiguration.ui + src/ui/QGCSettingsWidget.ui + ) + +set(qgroundcontrolHdrs + src/MG.h + src/Core.h + src/uas/UASInterface.h + src/uas/UAS.h + src/uas/UASManager.h + src/comm/LinkManager.h + src/comm/LinkInterface.h + src/comm/SerialLinkInterface.h + src/comm/SerialLink.h + src/comm/SerialSimulationLink.h + src/comm/ProtocolInterface.h + src/comm/MAVLinkProtocol.h + src/comm/AS4Protocol.h + src/ui/CommConfigurationWindow.h + src/ui/SerialConfigurationWindow.h + src/ui/MainWindow.h + src/ui/uas/UASControlWidget.h + src/ui/uas/UASListWidget.h + src/ui/uas/UASInfoWidget.h + src/ui/HUD.h + src/ui/linechart/LinechartWidget.h + src/ui/linechart/LinechartPlot.h + src/ui/linechart/Scrollbar.h + src/ui/linechart/ScrollZoomer.h + src/configuration.h + src/ui/uas/UASView.h + src/ui/CameraView.h + src/comm/MAVLinkSimulationLink.h + src/comm/UDPLink.h + src/ui/ParameterInterface.h + src/ui/WaypointList.h + src/Waypoint.h + src/ui/WaypointView.h + src/ui/ObjectDetectionView.h + src/input/JoystickInput.h + src/ui/JoystickWidget.h + src/ui/DebugConsole.h + src/ui/MapWidget.h + src/ui/XMLCommProtocolWidget.h + src/ui/mavlink/DomItem.h + src/ui/mavlink/DomModel.h + src/comm/MAVLinkXMLParser.h + src/ui/HDDisplay.h + src/ui/MAVLinkSettingsWidget.h + src/ui/AudioOutputWidget.h + src/GAudioOutput.h + src/LogCompressor.h + src/ui/QGCParamWidget.h + src/ui/QGCSensorSettingsWidget.h + src/ui/linechart/Linecharts.h + src/uas/SlugsMAV.h + src/uas/PxQuadMAV.h + src/uas/ArduPilotMegaMAV.h + src/comm/MAVLinkSyntaxHighlighter.h + src/ui/watchdog/WatchdogControl.h + src/ui/watchdog/WatchdogProcessView.h + src/ui/watchdog/WatchdogView.h + src/uas/UASWaypointManager.h + src/ui/HSIDisplay.h + src/QGC.h + src/ui/QGCFirmwareUpdate.h + src/ui/QGCPxImuFirmwareUpdate.h + src/ui/QGCDataPlot2D.h + src/ui/linechart/IncrementalPlot.h + src/ui/map/Waypoint2DIcon.h + src/ui/map/MAV2DIcon.h + src/ui/QGCRemoteControlView.h + src/ui/RadioCalibration/RadioCalibrationData.h + src/ui/RadioCalibration/RadioCalibrationWindow.h + src/ui/RadioCalibration/AirfoilServoCalibrator.h + src/ui/RadioCalibration/SwitchCalibrator.h + src/ui/RadioCalibration/CurveCalibrator.h + src/ui/RadioCalibration/AbstractCalibrator.h + src/comm/QGCMAVLink.h + src/ui/QGCWebView.h + src/ui/map3D/QGCWebPage.h + src/ui/SlugsDataSensorView.h + src/ui/SlugsHilSim.h + src/ui/SlugsPIDControl.h + src/ui/SlugsVideoCamControl.h + src/ui/SlugsPadCameraControl.h + src/ui/QGCMainWindowAPConfigurator.h + src/comm/MAVLinkSwarmSimulationLink.h + src/ui/uas/QGCUnconnectedInfoWidget.h + src/ui/designer/QGCToolWidget.h + src/ui/designer/QGCParamSlider.h + src/ui/designer/QGCActionButton.h + src/ui/designer/QGCToolWidgetItem.h + src/ui/QGCMAVLinkLogPlayer.h + src/comm/MAVLinkSimulationWaypointPlanner.h + src/comm/MAVLinkSimulationMAV.h + src/uas/QGCMAVLinkUASFactory.h + src/ui/QGCWaypointListMulti.h + src/ui/QGCUDPLinkConfiguration.h + src/ui/QGCSettingsWidget.h + ) + +set (qgroundcontrolMocSrc + src/ui/AudioOutputWidget.cc + src/ui/CameraView.cc + src/ui/CommConfigurationWindow.cc + src/ui/DebugConsole.cc + src/ui/HDDisplay.cc + src/ui/HSIDisplay.cc + src/ui/HUD.cc + src/ui/JoystickWidget.cc + src/ui/MAVLinkSettingsWidget.cc + src/ui/MainWindow.cc + src/ui/MapWidget.cc + src/ui/ObjectDetectionView.cc + src/ui/ParameterInterface.cc + src/ui/QGCDataPlot2D.cc + src/ui/QGCFirmwareUpdate.cc + src/ui/QGCMAVLinkLogPlayer.cc + src/ui/QGCMainWindowAPConfigurator.cc + src/ui/QGCParamWidget.cc + src/ui/QGCPxImuFirmwareUpdate.cc + src/ui/QGCRemoteControlView.cc + src/ui/QGCSensorSettingsWidget.cc + src/ui/QGCSettingsWidget.cc + src/ui/QGCUDPLinkConfiguration.cc + src/ui/QGCWaypointListMulti.cc + src/ui/QGCWebView.cc + src/ui/RadioCalibration/AbstractCalibrator.cc + src/ui/RadioCalibration/AirfoilServoCalibrator.cc + src/ui/RadioCalibration/CurveCalibrator.cc + src/ui/RadioCalibration/RadioCalibrationData.cc + src/ui/RadioCalibration/RadioCalibrationWindow.cc + src/ui/RadioCalibration/SwitchCalibrator.cc + src/ui/SerialConfigurationWindow.cc + src/ui/SlugsDataSensorView.cc + src/ui/SlugsHilSim.cc + src/ui/SlugsPIDControl.cpp + src/ui/SlugsPadCameraControl.cpp + src/ui/SlugsVideoCamControl.cpp + src/ui/WaypointList.cc + src/ui/WaypointView.cc + src/ui/XMLCommProtocolWidget.cc + src/ui/designer/QGCActionButton.cc + src/ui/designer/QGCParamSlider.cc + src/ui/designer/QGCToolWidget.cc + src/ui/designer/QGCToolWidgetItem.cc + src/ui/linechart/IncrementalPlot.cc + src/ui/linechart/LinechartPlot.cc + src/ui/linechart/LinechartWidget.cc + src/ui/linechart/Linecharts.cc + src/ui/linechart/ScrollZoomer.cc + src/ui/linechart/Scrollbar.cc + src/ui/map/MAV2DIcon.cc + src/ui/map/Waypoint2DIcon.cc + src/ui/map3D/QGCWebPage.cc + src/ui/mavlink/DomItem.cc + src/ui/mavlink/DomModel.cc + src/ui/uas/QGCUnconnectedInfoWidget.cc + src/ui/uas/UASControlWidget.cc + src/ui/uas/UASInfoWidget.cc + src/ui/uas/UASListWidget.cc + src/ui/uas/UASView.cc + src/ui/watchdog/WatchdogControl.cc + src/ui/watchdog/WatchdogProcessView.cc + src/ui/watchdog/WatchdogView.cc + ) + +set (qgroundcontrolSrc + src/main.cc + src/Core.cc + src/GAudioOutput.cc + src/LogCompressor.cc + src/QGC.cc + src/Waypoint.cc + src/comm/AS4Protocol.cc + src/comm/LinkManager.cc + src/comm/MAVLinkProtocol.cc + src/comm/MAVLinkSimulationLink.cc + src/comm/MAVLinkSimulationMAV.cc + src/comm/MAVLinkSimulationWaypointPlanner.cc + src/comm/MAVLinkSwarmSimulationLink.cc + src/comm/MAVLinkSyntaxHighlighter.cc + src/comm/MAVLinkXMLParser.cc + src/comm/SerialLink.cc + src/comm/SerialSimulationLink.cc + src/comm/UDPLink.cc + src/input/JoystickInput.cc + src/uas/ArduPilotMegaMAV.cc + src/uas/PxQuadMAV.cc + src/uas/QGCMAVLinkUASFactory.cc + src/uas/SlugsMAV.cc + src/uas/UAS.cc + src/uas/UASManager.cc + src/uas/UASWaypointManager.cc + ) + +# process qt files +qt4_wrap_cpp(qgroundcontrolMoc ${qgroundcontrolMocSrc}) +qt4_wrap_ui(qgroundcontrolUi ${qgroundcontrolUiSrc}) +qt4_add_resources(qgroundcontrolRsc ${qgroundcontrolRscSrc}) + +#add executable +add_executable(qgroundcontrol + ${qgroundcontrolSrc} + ${qgroundcontrolMoc} + ${qgroundcontrolUi} + ${qgroundcontrolRsc} + ) +add_dependencies(qgroundcontrol MAVLINK) +install(TARGETS qgroundcontrol DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + +# vim:ts=4:sw=4:expandtab diff --git a/CMakeModules/FindMAVLINK.cmake b/CMakeModules/FindMAVLINK.cmake new file mode 100644 index 000000000..1b1c57925 --- /dev/null +++ b/CMakeModules/FindMAVLINK.cmake @@ -0,0 +1,20 @@ +# - Try to find MAVLINK +# Once done, this will define +# +# MAVLINK_FOUND - system has scicoslab +# MAVLINK_INCLUDE_DIRS - the scicoslab include directories + +include(LibFindMacros) + +# Include dir +find_path(MAVLINK_INCLUDE_DIR + NAMES mavlink_types.h + PATHS + /usr/include/mavlink + /usr/local/include/mavlink +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(MAVLINK_PROCESS_INCLUDES MAVLINK_INCLUDE_DIR) +libfind_process(MAVLINK) diff --git a/CMakeModules/FindPhonon.cmake b/CMakeModules/FindPhonon.cmake new file mode 100644 index 000000000..28969c718 --- /dev/null +++ b/CMakeModules/FindPhonon.cmake @@ -0,0 +1,71 @@ +# Find libphonon +# Once done this will define +# +# PHONON_FOUND - system has Phonon Library +# PHONON_INCLUDES - the Phonon include directory +# PHONON_LIBS - link these to use Phonon +# PHONON_VERSION - the version of the Phonon Library + +# Copyright (c) 2008, Matthias Kretz +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +macro(_phonon_find_version) + set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h") + if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") + set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") + endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") + file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000) + string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}") + set(PHONON_VERSION "${CMAKE_MATCH_1}") + message(STATUS "Phonon Version: ${PHONON_VERSION}") +endmacro(_phonon_find_version) + +if(PHONON_FOUND) + # Already found, nothing more to do except figuring out the version + _phonon_find_version() +else(PHONON_FOUND) + if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + set(PHONON_FIND_QUIETLY TRUE) + endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + + # As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir) + find_library(PHONON_LIBRARY NAMES phonon phonon4 PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + # then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.) + find_library(PHONON_LIBRARY NAMES phonon phonon4) + + find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h) + + if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY}) + set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}) + set(PHONON_FOUND TRUE) + _phonon_find_version() + else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + set(PHONON_FOUND FALSE) + endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + + if(PHONON_FOUND) + if(NOT PHONON_FIND_QUIETLY) + message(STATUS "Found Phonon: ${PHONON_LIBRARY}") + message(STATUS "Found Phonon Includes: ${PHONON_INCLUDES}") + endif(NOT PHONON_FIND_QUIETLY) + else(PHONON_FOUND) + if(Phonon_FIND_REQUIRED) + if(NOT PHONON_INCLUDE_DIR) + message(STATUS "Phonon includes NOT found!") + endif(NOT PHONON_INCLUDE_DIR) + if(NOT PHONON_LIBRARY) + message(STATUS "Phonon library NOT found!") + endif(NOT PHONON_LIBRARY) + message(FATAL_ERROR "Phonon library or includes NOT found!") + else(Phonon_FIND_REQUIRED) + message(STATUS "Unable to find Phonon") + endif(Phonon_FIND_REQUIRED) + endif(PHONON_FOUND) + + + mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY PHONON_INCLUDES) +endif(PHONON_FOUND) diff --git a/CMakeModules/LibFindMacros.cmake b/CMakeModules/LibFindMacros.cmake new file mode 100644 index 000000000..ff9233a6c --- /dev/null +++ b/CMakeModules/LibFindMacros.cmake @@ -0,0 +1,98 @@ +# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments +# used for the current package. For this to work, the first parameter must be the +# prefix of the current package, then the prefix of the new package etc, which are +# passed to find_package. +macro (libfind_package PREFIX) + set (LIBFIND_PACKAGE_ARGS ${ARGN}) + if (${PREFIX}_FIND_QUIETLY) + set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET) + endif (${PREFIX}_FIND_QUIETLY) + if (${PREFIX}_FIND_REQUIRED) + set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED) + endif (${PREFIX}_FIND_REQUIRED) + find_package(${LIBFIND_PACKAGE_ARGS}) +endmacro (libfind_package) + +# CMake developers made the UsePkgConfig system deprecated in the same release (2.6) +# where they added pkg_check_modules. Consequently I need to support both in my scripts +# to avoid those deprecated warnings. Here's a helper that does just that. +# Works identically to pkg_check_modules, except that no checks are needed prior to use. +macro (libfind_pkg_check_modules PREFIX PKGNAME) + if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + include(UsePkgConfig) + pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS) + else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(${PREFIX} ${PKGNAME}) + endif (PKG_CONFIG_FOUND) + endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) +endmacro (libfind_pkg_check_modules) + +# Do the final processing once the paths have been detected. +# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain +# all the variables, each of which contain one include directory. +# Ditto for ${PREFIX}_PROCESS_LIBS and library files. +# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. +# Also handles errors in case library detection was required, etc. +macro (libfind_process PREFIX) + # Skip processing if already processed during this run + if (NOT ${PREFIX}_FOUND) + # Start with the assumption that the library was found + set (${PREFIX}_FOUND TRUE) + + # Process all includes and set _FOUND to false if any are missing + foreach (i ${${PREFIX}_PROCESS_INCLUDES}) + if (${i}) + set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}}) + mark_as_advanced(${i}) + else (${i}) + set (${PREFIX}_FOUND FALSE) + endif (${i}) + endforeach (i) + + # Process all libraries and set _FOUND to false if any are missing + foreach (i ${${PREFIX}_PROCESS_LIBS}) + if (${i}) + set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}}) + mark_as_advanced(${i}) + else (${i}) + set (${PREFIX}_FOUND FALSE) + endif (${i}) + endforeach (i) + + # Print message and/or exit on fatal error + if (${PREFIX}_FOUND) + if (NOT ${PREFIX}_FIND_QUIETLY) + message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") + endif (NOT ${PREFIX}_FIND_QUIETLY) + else (${PREFIX}_FOUND) + if (${PREFIX}_FIND_REQUIRED) + foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS}) + message("${i}=${${i}}") + endforeach (i) + message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.") + endif (${PREFIX}_FIND_REQUIRED) + endif (${PREFIX}_FOUND) + endif (NOT ${PREFIX}_FOUND) +endmacro (libfind_process) + +macro(libfind_library PREFIX basename) + set(TMP "") + if(MSVC80) + set(TMP -vc80) + endif(MSVC80) + if(MSVC90) + set(TMP -vc90) + endif(MSVC90) + set(${PREFIX}_LIBNAMES ${basename}${TMP}) + if(${ARGC} GREATER 2) + set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2}) + string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES}) + set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP}) + endif(${ARGC} GREATER 2) + find_library(${PREFIX}_LIBRARY + NAMES ${${PREFIX}_LIBNAMES} + PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS} + ) +endmacro(libfind_library) diff --git a/autobuild.sh b/autobuild.sh new file mode 100755 index 000000000..9b7f7912a --- /dev/null +++ b/autobuild.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +PS3='Please enter your choice: ' +LIST="in_source_build install_build grab_debian_dependencies package_source package remake clean END" +MAKEARGS="-j8" +echo +echo in_source_build: is used for development and you can start the scicoslab toolbox by typing scicoslab in the oooark source directory +echo install_build: is used for building before final installation to the system. +echo grab_debian_dependencies: installs all the required packages for debian based systems \(ubuntu maverick/ debian squeeze,lenny\) +echo remake: calls make again after project has been configured as install or in source build +echo package_source: creates a source package for distribution +echo package: creates binary packages for distribution +echo clean: removes the build directory + +echo +select OPT in $LIST +do + if [ $OPT = "in_source_build" ] &> /dev/null + then + echo you chose in source build + mkdir -p build && cd build && cmake -DIN_SRC_BUILD:bool=TRUE .. && make $MAKEARGS + exit 0 + elif [ $OPT = "install_build" ] &> /dev/null + then + echo you chose install build + mkdir -p build && cd build && cmake .. && make $MAKEARGS + exit 0 + elif [ $OPT = "grab_debian_dependencies" ] &> /dev/null + then + echo you chose to install debian dependencies + sudo apt-get install cmake libqt4-dev libboost-all-dev libopenscenegraph-dev + sudo apt-get install scicoslab-gtk + exit 0 + + elif [ $OPT = "remake" ] &> /dev/null + then + echo you chose to recall make on the previously configured build + cd build && make $MAKEARGS + exit 0 + + elif [ $OPT = "package_source" ] &> /dev/null + then + echo you chose to package the source + mkdir -p build && cd build && cmake .. && make package_source + exit 0 + + elif [ $OPT = "package" ] &> /dev/null + then + echo you chose to package the binary + mkdir -p build && cd build && cmake .. && make package + exit 0 + + elif [ $OPT = "clean" ] &> /dev/null + then + echo you chose to clean the build + rm -rf build + + elif [ $OPT = "END" ] &> /dev/null + then + exit 0 + fi +done diff --git a/createTags b/createTags new file mode 100755 index 000000000..80145c339 --- /dev/null +++ b/createTags @@ -0,0 +1,5 @@ +#!/bin/bash +ctags -RV --c++-kinds=+p --fields=+iaS --extra=+q \ + . \ + /usr/include/qt4 \ + /usr/include/osg* diff --git a/thirdParty/mavlink b/thirdParty/mavlink new file mode 160000 index 000000000..50ad6bf27 --- /dev/null +++ b/thirdParty/mavlink @@ -0,0 +1 @@ +Subproject commit 50ad6bf278b87a105adb4887b5338daa2940f0c6 -- 2.22.0