Commit b1e1d98b authored by James Goppert's avatar James Goppert

Using official tarball for mavlink.

parent 94e91013
......@@ -40,6 +40,7 @@ MOC_DIR = $${BUILDDIR}/moc
UI_DIR = $${BUILDDIR}/ui
RCC_DIR = $${BUILDDIR}/rcc
MAVLINK_CONF = ""
MAVLINKPATH = $$BASEDIR/thirdParty/mavlink/v1.0
DEFINES += MAVLINK_NO_DATA
win32 {
......@@ -87,58 +88,47 @@ exists(user_config.pri) {
message("Adding support for additional MAVLink messages for: " $$MAVLINK_CONF)
message("------------------------------------------------------------------------")
}
INCLUDEPATH += $$BASEDIR/../mavlink/include/common
INCLUDEPATH += $$BASEDIR/../mavlink/include
INCLUDEPATH += $$BASEDIR/thirdParty/mavlink/include/common
INCLUDEPATH += $$BASEDIR/thirdParty/mavlink/include
INCLUDEPATH += $$MAVLINKPATH/common
INCLUDEPATH += $$MAVLINKPATH
contains(MAVLINK_CONF, pixhawk) {
# Remove the default set - it is included anyway
INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
INCLUDEPATH -= $$BASEDIR/thirdParty/mavlink/include/common
INCLUDEPATH -= $$MAVLINKPATH/common
# PIXHAWK SPECIAL MESSAGES
INCLUDEPATH += $$BASEDIR/../mavlink/include/pixhawk
INCLUDEPATH += $$BASEDIR/thirdParty/mavlink/include/pixhawk
INCLUDEPATH += $$MAVLINKPATH/pixhawk
DEFINES += QGC_USE_PIXHAWK_MESSAGES
}
contains(MAVLINK_CONF, slugs) {
# Remove the default set - it is included anyway
INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
INCLUDEPATH -= $$BASEDIR/thirdParty/mavlink/include/common
INCLUDEPATH -= $$MAVLINKPATH/common
# SLUGS SPECIAL MESSAGES
INCLUDEPATH += $$BASEDIR/../mavlink/include/slugs
INCLUDEPATH += $$BASEDIR/thirdParty/mavlink/include/slugs
INCLUDEPATH += $$MAVLINKPATH/slugs
DEFINES += QGC_USE_SLUGS_MESSAGES
}
contains(MAVLINK_CONF, ualberta) {
# Remove the default set - it is included anyway
INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
INCLUDEPATH -= $$BASEDIR/thirdParty/mavlink/include/common
INCLUDEPATH -= $$MAVLINKPATH/common
# UALBERTA SPECIAL MESSAGES
INCLUDEPATH += $$BASEDIR/../mavlink/include/ualberta
INCLUDEPATH += $$BASEDIR/thirdParty/mavlink/include/ualberta
INCLUDEPATH += $$MAVLINKPATH/ualberta
DEFINES += QGC_USE_UALBERTA_MESSAGES
}
contains(MAVLINK_CONF, ardupilotmega) {
# Remove the default set - it is included anyway
INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
INCLUDEPATH -= $$MAVLINKPATH/common
INCLUDEPATH -= $$BASEDIR/thirdParty/mavlink/include/common
# UALBERTA SPECIAL MESSAGES
INCLUDEPATH += $$BASEDIR/../mavlink/include/ardupilotmega
INCLUDEPATH += $$BASEDIR/thirdParty/mavlink/include/ardupilotmega
INCLUDEPATH += $$MAVLINKPATH/ardupilotmega
DEFINES += QGC_USE_ARDUPILOTMEGA_MESSAGES
}
contains(MAVLINK_CONF, senseSoar) {
# Remove the default set - it is included anyway
INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
INCLUDEPATH -= $$BASEDIR/thirdParty/mavlink/include/common
INCLUDEPATH -= $$MAVLINKPATH/common
# SENSESOAR SPECIAL MESSAGES
INCLUDEPATH += $$BASEDIR/../mavlink/include/SenseSoar
INCLUDEPATH += $$BASEDIR/thirdParty/mavlink/include/SenseSoar
INCLUDEPATH += $$MAVLINKPATH/SenseSoar
DEFINES += QGC_USE_SENSESOAR_MESSAGES
}
......@@ -149,6 +139,7 @@ contains(MAVLINK_CONF, senseSoar) {
include(qgroundcontrol.pri)
# Include MAVLink generator
# has been deprecated
DEPENDPATH += \
src/apps/mavlinkgen
......
#!/bin/bash
MAVLINK_TAG=257e5194afc4bd5752e10fb58e8b8ee158116eb7
QSERIAL_TAG=004e3de552fe25fee593dfcb03e2ffa82cb0b152
MAVLINK_VERSION=1.0.0
libList="mavlink qserialport"
......@@ -31,7 +30,13 @@ function processLib
fetch_git qserialport git://gitorious.org/inbiza-labs/qserialport.git master $QSERIAL_TAG
;;
"mavlink")
fetch_git mavlink git@github.com:mavlink/mavlink.git master $MAVLINK_TAG
rm -rf mavlink
mavlinkName=mavlink-$MAVLINK_VERSION-Linux
wget https://github.com/downloads/mavlink/mavlink/$mavlinkName.tar.gz
tar -xzvf $mavlinkName.tar.gz
mv $mavlinkName/usr/local/include/mavlink mavlink
rm -rf $mavlinkName
rm -rf $mavlinkName.tar.gz
;;
"all")
for lib in $libList
......
*~
doc/html
doc/*.log
missionlib/testing/*.xcodeproj/*
.DS_Store
build*
project (mavlink)
# Requried cmake version
cmake_minimum_required (VERSION 2.8.2)
# global needed variables
set(APPLICATION_NAME ${PROJECT_NAME})
# set these for release
set(APPLICATION_VERSION_MAJOR "1")
set(APPLICATION_VERSION_MINOR "0")
set(APPLICATION_VERSION_PATCH "0")
set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
set(LIBRARY_VERSION ${APPLICATION_VERSION})
# SOVERSION scheme: CURRENT.AGE.REVISION
# If there was an incompatible interface change:
# Increment CURRENT. Set AGE and REVISION to 0
# If there was a compatible interface change:
# Increment AGE. Set REVISION to 0
# If the source code was changed, but there were no interface changes:
# Increment REVISION.
set(LIBRARY_SOVERSION "0.0.0")
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_SOURCE_DIR}/cmake/arkcmake
)
# add definitions
include(DefineCMakeDefaults)
include(DefinePlatformDefaults)
include(DefineCompilerFlags)
include(DefineInstallationPaths)
# cpack
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MAVLink Micro Air Vehicle Message Marshalling Library")
set(CPACK_PACKAGE_VENDOR "pixhawk")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "james.goppert@gmail.com")
set(CPACK_PACKAGE_CONTACT "james.goppert@gmail.com")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
set(CPACK_PACKAGE_VERSION_MAJOR "${APPLICATION_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${APPLICATION_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${APPLICATION_VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
set(CPACK_SET_DESTDIR TRUE)
set(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES}
/.git/;/build/;~$;.*\\\\.bin$;.*\\\\.swp$)
set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
if(WIN32)
set(CPACK_GENERATOR "NSIS")
set(CPACK_SOURCE_GENERATOR "ZIP")
elseif(APPLE)
set(CPACK_GENERATOR "PackageMaker")
set(CPACK_SOURCE_GENERATOR "TGZ")
elseif(UNIX)
set(CPACK_GENERATOR "DEB")
set(CPACK_SOURCE_GENERATOR "TGZ")
else()
message(FATAL_ERROR "unknown operating system")
endif()
include(CPack)
# disallow in-source build
include(MacroEnsureOutOfSourceBuild)
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build.
Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.")
# add macros
include(MacroAddPlugin)
include(MacroCopyFile)
include(MacroSetDefault)
include(language_support_v2)
include(MacroAddLinkFlags)
include(ExternalProject)
include(CTest)
# settings
option(DEV_MODE "Setup paths for developer testing." OFF)
option(BUILD_SHARED_LIBS "Build shared libraries instead of static." OFF)
# built variables
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
# 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)
# add make dist target
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
# external projects
set(EP_BASE_DIR "${CMAKE_BINARY_DIR}/CMakeExternals")
set_property(DIRECTORY PROPERTY EP_BASE ${EP_BASE_DIR})
set(EP_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}-external)
# install/developer mode
if(DEV_MODE)
message(STATUS "configuring for in source build")
set(DATADIR ${PROJECT_SOURCE_DIR}/data)
set(LIBDIR ${CMAKE_BINARY_DIR}/lib)
set(BINDIR ${CMAKE_BINARY_DIR}/bin)
set(EP_DATADIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/share)
else()
message(STATUS "configuring for install build")
set(DATADIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/data)
set(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
set(BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
set(EP_DATADIR ${EP_INSTALL_PREFIX}/share)
endif()
set(EP_INCLUDEDIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include)
set(EP_LIBDIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/lib)
# install files
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME} FILES_MATCHING PATTERN "*.h")
# pkgconfig
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc)
install(FILES
${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION lib/pkgconfig
)
# vim:sw=4:ts=4:expandtab
MAVLink Micro Air Vehicle Message Marshalling Library
This is a library for lightweight communication between
Micro Air Vehicles (swarm) and/or ground control stations.
It serializes C-structs for serial channels and can be used with
any type of radio modem.
For help, please visit the mailing list: http://groups.google.com/group/mavlink
MAVLink is licensed under the terms of the Lesser General Public License of the Free Software Foundation (LGPL).
As MAVLink is a header-only library, compiling an application with it is considered "using the libary", not a derived work. MAVLink can therefore be used without limits in any closed-source application without publishing the source code of the closed-source application.
To generate/update packets, select mavlink_standard_message.xml
in the QGroundControl station settings view, select mavlink/include as
the output directory and click on "Save and Generate".
You will find the newly generated/updated message_xx.h files in
the mavlink/include/generated folder.
To use MAVLink, #include the <mavlink.h> file, not the individual
message files. In some cases you will have to add the main folder to the include search path as well. To be safe, we recommend these flags:
gcc -I mavlink/include -I mavlink/include/<your message set, e.g. common>
For more information, please visit:
http://qgroundcontrol.org/mavlink/
(c) 2009-2012 Lorenz Meier <mail@qgroundcontrol.org>
\ No newline at end of file
# - Try to find OPENSCENEGRAPH
# Once done, this will define
#
# OPENSCENEGRAPH_FOUND - system has scicoslab
# OPENSCENEGRAPH_INCLUDE_DIRS - the scicoslab include directories
# OPENSCENEGRAPH_LIBRARIES - libraries to link to
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(OPENSCENEGRAPH)
macro(build_openscenegraph TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
ExternalProject_Add(openscenegraph
SVN_REPOSITORY "http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-${TAG}"
UPDATE_COMMAND ""
INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
)
set(OPENSCENEGRAPH_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include)
set(OPENSCENEGRAPH_DATA_DIR ${EP_DATADIR}/openscenegraph/data)
# static lib prefix
if(WIN32)
set(STATIC_LIB_PREFIX "")
elseif(APPLE)
set(STATIC_LIB_PREFIX "lib")
elseif(UNIX)
set(STATIC_LIB_PREFIX "lib")
else()
message(FATAL_ERROR "unknown operating system")
endif()
set(OPENSCENEGRAPH_LIBRARIES
)
set(OPENSCENEGRAPH_FOUND TRUE)
endmacro()
This diff is collapsed.
# Always include srcdir and builddir in include path
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in
# about every subdir
# since cmake 2.4.0
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Put the include dirs which are in the source or build tree
# before all other include dirs, so the headers in the sources
# are prefered over the already installed ones
# since cmake 2.4.1
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
# Use colored output
# since cmake 2.4.0
set(CMAKE_COLOR_MAKEFILE ON)
# Define the generic version of the libraries here
set(GENERIC_LIB_VERSION "0.1.0")
set(GENERIC_LIB_SOVERSION "0")
# Set the default build type to release with debug info
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo
CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
)
endif (NOT CMAKE_BUILD_TYPE)
# define system dependent compiler flags
include(CheckCCompilerFlag)
include(MacroCheckCCompilerFlagSSP)
if (UNIX AND NOT WIN32)
#
# Define GNUCC compiler flags
#
if (${CMAKE_C_COMPILER_ID} MATCHES GNU)
# add -Wconversion ?
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -pedantic-errors")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -Wmissing-prototypes -Wdeclaration-after-statement")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute")
# with -fPIC
check_c_compiler_flag("-fPIC" WITH_FPIC)
if (WITH_FPIC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif (WITH_FPIC)
check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
if (WITH_STACK_PROTECTOR)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
endif (WITH_STACK_PROTECTOR)
check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
if (WITH_FORTIFY_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2")
endif (WITH_FORTIFY_SOURCE)
endif (${CMAKE_C_COMPILER_ID} MATCHES GNU)
#
# Check for large filesystem support
#
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
# with large file support
execute_process(
COMMAND
getconf LFS64_CFLAGS
OUTPUT_VARIABLE
_lfs_CFLAGS
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else (CMAKE_SIZEOF_VOID_P MATCHES "8")
# with large file support
execute_process(
COMMAND
getconf LFS_CFLAGS
OUTPUT_VARIABLE
_lfs_CFLAGS
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
if (_lfs_CFLAGS)
string(REGEX REPLACE "[\r\n]" " " "${_lfs_CFLAGS}" "${${_lfs_CFLAGS}}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_lfs_CFLAGS}")
endif (_lfs_CFLAGS)
endif (UNIX AND NOT WIN32)
if (MSVC)
# Use secure functions by defaualt and suppress warnings about
#"deprecated" functions
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1")
endif (MSVC)
if (WIN32)
# Same same
set(BIN_INSTALL_DIR "bin" CACHE PATH "-")
set(SBIN_INSTALL_DIR "." CACHE PATH "-")
set(LIB_INSTALL_DIR "lib" CACHE PATH "-")
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "-")
set(PLUGIN_INSTALL_DIR "plugins" CACHE PATH "-")
set(HTML_INSTALL_DIR "doc/HTML" CACHE PATH "-")
set(ICON_INSTALL_DIR "." CACHE PATH "-")
set(SOUND_INSTALL_DIR "." CACHE PATH "-")
set(LOCALE_INSTALL_DIR "lang" CACHE PATH "-")
elseif (UNIX OR OS2)
IF (NOT APPLICATION_NAME)
MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME")
SET(APPLICATION_NAME ${PROJECT_NAME})
ENDIF (NOT APPLICATION_NAME)
# Suffix for Linux
SET(LIB_SUFFIX
CACHE STRING "Define suffix of directory name (32/64)"
)
SET(EXEC_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}"
CACHE PATH "Base directory for executables and libraries"
)
SET(SHARE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}/share"
CACHE PATH "Base directory for files which go to share/"
)
SET(DATA_INSTALL_PREFIX
"${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}"
CACHE PATH "The parent directory where applications can install their data")
# The following are directories where stuff will be installed to
SET(BIN_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/bin"
CACHE PATH "The ${APPLICATION_NAME} binary install dir (default prefix/bin)"
)
SET(SBIN_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/sbin"
CACHE PATH "The ${APPLICATION_NAME} sbin install dir (default prefix/sbin)"
)
SET(LIB_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}"
CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/lib)"
)
SET(LIBEXEC_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/libexec"
CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/libexec)"
)
SET(PLUGIN_INSTALL_DIR
"${LIB_INSTALL_DIR}/${APPLICATION_NAME}"
CACHE PATH "The subdirectory relative to the install prefix where plugins will be installed (default is prefix/lib/${APPLICATION_NAME})"
)
SET(INCLUDE_INSTALL_DIR
"${CMAKE_INSTALL_PREFIX}/include"
CACHE PATH "The subdirectory to the header prefix (default prefix/include)"
)
SET(DATA_INSTALL_DIR
"${DATA_INSTALL_PREFIX}"
CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_NAME})"
)
SET(HTML_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/doc/HTML"
CACHE PATH "The HTML install dir for documentation (default data/doc/html)"
)
SET(ICON_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/icons"
CACHE PATH "The icon install dir (default data/icons/)"
)
SET(SOUND_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/sounds"
CACHE PATH "The install dir for sound files (default data/sounds)"
)
SET(LOCALE_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/locale"
CACHE PATH "The install dir for translations (default prefix/share/locale)"
)
SET(XDG_APPS_DIR
"${SHARE_INSTALL_PREFIX}/applications/"
CACHE PATH "The XDG apps dir"
)
SET(XDG_DIRECTORY_DIR
"${SHARE_INSTALL_PREFIX}/desktop-directories"
CACHE PATH "The XDG directory"
)
SET(SYSCONF_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/etc"
CACHE PATH "The ${APPLICATION_NAME} sysconfig install dir (default prefix/etc)"
)
SET(MAN_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/man"
CACHE PATH "The ${APPLICATION_NAME} man install dir (default prefix/man)"
)
SET(INFO_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/info"
CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)"
)
endif ()
# Set system vars
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX TRUE)
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(FREEBSD TRUE)
set(BSD TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(OPENBSD TRUE)
set(BSD TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(NETBSD TRUE)
set(BSD TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
set(SOLARIS TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
if (CMAKE_SYSTEM_NAME MATCHES "OS2")
set(OS2 TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "OS2")
# - Try to find ARKCOMM
# Once done, this will define
#
# ARKCOMM_FOUND - system has scicoslab
# ARKCOMM_INCLUDE_DIRS - the scicoslab include directories
# ARKCOMM_LIBRARIES - libraries to link to
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(ARKCOMM)
# Include dir
find_path(ARKCOMM_INCLUDE_DIR
NAMES arkcomm/AsyncSerial.hpp
PATHS ${COMMON_INCLUDE_PATHS_ARKCOMM}
)
# the library itself
find_library(ARKCOMM_LIBRARY
NAMES arkcomm
PATHS ${COMMON_LIBRARY_PATHS_ARKCOMM}
)
# the import file
find_path(ARKCOMM_LIBRARY_DIR
NAMES arkcomm/arkcomm-targets.cmake
PATHS ${COMMON_LIBRARY_PATHS_ARKCOMM}
)
set(ARKCOMM_LIB_IMPORT ${ARKCOMM_LIBRARY_DIR}/arkcomm/arkcomm-targets.cmake)
# 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(ARKCOMM_PROCESS_INCLUDES ARKCOMM_INCLUDE_DIR)
set(ARKCOMM_PROCESS_LIBS ARKCOMM_LIBRARY ARKCOMM_LIBRARIES)
libfind_process(ARKCOMM)
macro(build_arkcomm TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
if(NOT ARKCOMM_FOUND)
ExternalProject_Add(arkcomm
GIT_REPOSITORY "git://github.com/arktools/arkcomm.git"
GIT_TAG ${TAG}
UPDATE_COMMAND ""
INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
)
set(ARKCOMM_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include)
# static lib prefix
if(WIN32)
set(STATIC_LIB_PREFIX "")
elseif(APPLE)
set(STATIC_LIB_PREFIX "lib")
elseif(UNIX)
set(STATIC_LIB_PREFIX "lib")
else()
message(FATAL_ERROR "unknown operating system")
endif()
set(ARKCOMM_LIBRARIES ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/lib/${STATIC_LIB_PREFIX}arkcomm.a)
set(ARKCOMM_FOUND TRUE)
endif()
endmacro()
# - Try to find ARKHANGAR
# Once done, this will define
#
# ARKHANGAR_FOUND - system has scicoslab
# ARKHANGAR_INCLUDE_DIRS - the scicoslab include directories
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(ARKHANGAR)
# Include dir
find_path(ARKHANGAR_INCLUDE_DIR
NAMES arkhangar/easystar/easystar-windtunnel.xml
PATHS ${COMMON_DATA_PATHS_ARKHANGAR}
)
# data dir
find_path(ARKHANGAR_DATA_DIR_SEARCH
NAMES arkhangar/easystar/easystar-windtunnel.xml
PATHS ${COMMON_DATA_PATHS_ARKHANGAR}
)
set(ARKHANGAR_DATA_DIR ${ARKHANGAR_DATA_DIR_SEARCH}/arkhangar)
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(ARKHANGAR_PROCESS_INCLUDES ARKHANGAR_INCLUDE_DIR)
libfind_process(ARKHANGAR)
macro(build_arkhangar TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
find_package(ARKCOMM ${TAG})
if( NOT ARKHANGAR_FOUND)
ExternalProject_Add(arkhangar
GIT_REPOSITORY "git://github.com/arktools/arkhangar.git"
GIT_TAG ${TAG}
UPDATE_COMMAND ""
INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
)
set(ARKHANGAR_INCLUDE_DIR "")
set(ARKHANGAR_INCLUDES_DIR "")
set(ARKHANGAR_DATA_DIR "${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/share/arkhangar")
set(ARKHANGAR_FOUND TRUE)
endif()
endmacro()
# - Try to find ARKMATH
# Once done, this will define
#
# ARKMATH_FOUND - system has scicoslab
# ARKMATH_INCLUDE_DIRS - the scicoslab include directories
# ARKMATH_LIBRARIES - libraries to link to
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(ARKMATH)
# Include dir
find_path(ARKMATH_INCLUDE_DIR
NAMES arkmath/storage_adaptors.hpp
PATHS ${COMMON_INCLUDE_PATHS_ARKMATH}
)
# data dir
find_path(ARKMATH_DATA_DIR_SEARCH
NAMES arkmath/data/WMM.COF
PATHS ${COMMON_DATA_PATHS_ARKMATH}
)
set(ARKMATH_DATA_DIR ${ARKMATH_DATA_DIR_SEARCH}/arkmath/data)
# the library itself
find_library(ARKMATH_LIBRARY
NAMES arkmath
PATHS ${COMMON_LIBRARY_PATHS_ARKMATH}
)
# the import file
find_path(ARKMATH_LIBRARY_DIR
NAMES arkmath/arkmath-targets.cmake
PATHS ${COMMON_LIBRARY_PATHS_ARKMATH}
)
set(ARKMATH_LIB_IMPORT ${ARKMATH_LIBRARY_DIR}/arkmath/arkmath-targets.cmake)
# 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(ARKMATH_PROCESS_INCLUDES ARKMATH_INCLUDE_DIR)
set(ARKMATH_PROCESS_LIBS ARKMATH_LIBRARY ARKMATH_LIBRARIES)
libfind_process(ARKMATH)
macro(build_arkmath TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
if(NOT ARKMATH_FOUND)
ExternalProject_Add(arkmath
GIT_REPOSITORY "git://github.com/arktools/arkmath.git"
GIT_TAG ${TAG}
UPDATE_COMMAND ""
INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
)
set(ARKMATH_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include)
set(ARKMATH_DATA_DIR ${EP_DATADIR}/arkmath/data)
# static lib prefix
if(WIN32)
set(STATIC_LIB_PREFIX "")
elseif(APPLE)
set(STATIC_LIB_PREFIX "lib")
elseif(UNIX)
set(STATIC_LIB_PREFIX "lib")
else()
message(FATAL_ERROR "unknown operating system")
endif()
set(ARKMATH_LIBRARIES ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/lib/${STATIC_LIB_PREFIX}arkmath.a)
set(ARKMATH_FOUND TRUE)
endif()
endmacro()
# - Try to find ARKOSG
# Once done, this will define
#
# ARKOSG_FOUND - system has scicoslab
# ARKOSG_INCLUDE_DIRS - the scicoslab include directories
# ARKOSG_LIBRARIES - libraries to link to
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(ARKOSG)
# Include dir
find_path(ARKOSG_INCLUDE_DIR
NAMES arkosg/osgUtils.hpp
PATHS ${COMMON_INCLUDE_PATHS_ARKOSG}
)
# data dir
find_path(ARKOSG_DATA_DIR_SEARCH
NAMES arkosg/data/models/plane.ac
PATHS ${COMMON_DATA_PATHS_ARKOSG}
)
set(ARKOSG_DATA_DIR ${ARKOSG_DATA_DIR_SEARCH}/arkosg/data)
# the library itself
find_library(ARKOSG_LIBRARY
NAMES arkosg
PATHS ${COMMON_LIBRARY_PATHS_ARKOSG}
)
# the import file
find_path(ARKOSG_LIBRARY_DIR
NAMES arkosg/arkosg-targets.cmake
PATHS ${COMMON_LIBRARY_PATHS_ARKOSG}
)
set(ARKOSG_LIB_IMPORT ${ARKOSG_LIBRARY_DIR}/arkosg/arkosg-targets.cmake)
# 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(ARKOSG_PROCESS_INCLUDES ARKOSG_INCLUDE_DIR)
set(ARKOSG_PROCESS_LIBS ARKOSG_LIBRARY ARKOSG_LIBRARIES)
libfind_process(ARKOSG)
macro(build_arkosg TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
if(NOT ARKOSG_FOUND)
ExternalProject_Add(arkosg
GIT_REPOSITORY "git://github.com/arktools/arkosg.git"
GIT_TAG ${TAG}
UPDATE_COMMAND ""
INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
)
set(ARKOSG_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include)
set(ARKOSG_DATA_DIR ${EP_DATADIR}/arkosg/data)
# static lib prefix
if(WIN32)
set(STATIC_LIB_PREFIX "")
elseif(APPLE)
set(STATIC_LIB_PREFIX "lib")
elseif(UNIX)
set(STATIC_LIB_PREFIX "lib")
else()
message(FATAL_ERROR "unknown operating system")
endif()
set(ARKOSG_LIBRARIES ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/lib/${STATIC_LIB_PREFIX}arkosg.a)
set(ARKOSG_FOUND TRUE)
endif()
endmacro()
# - Try to find ARKSCICOS
# Once done, this will define
#
# ARKSCICOS_FOUND - system has scicoslab
# ARKSCICOS_INCLUDE_DIRS - the scicoslab include directories
# ARKSCICOS_LIBRARIES - libraries to link to
include(LibFindMacroos)
include(MacroCommonPaths)
MacroCommonPaths(ARKSCICOS)
# Include dir
find_path(ARKSCICOS_INCLUDE_DIR
NAMES definiotions.hpp
PATHS ${COMMON_INCLUDE_PATHS_ARKSCICOS}
)
# the library itself
find_library(ARKSCICOS_LIBRARY
NAMES arkscicos
PATHS ${COMMON_LIBRARY_PATHS_ARKSCICOS}
)
# the import file
find_path(ARKSCICOS_LIBRARY_DIR
NAMES arkscicos/arkscicos-targets.cmake
PATHS ${COMMON_LIBRARY_PATHS_ARKSCICOS}
)
set(ARKSCICOS_LIB_IMPORT ${ARKSCICOS_LIBRARY_DIR}/arkscicos/arkscicos-targets.cmake)
# 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(ARKSCICOS_PROCESS_INCLUDES ARKSCICOS_INCLUDE_DIR)
set(ARKSCICOS_PROCESS_LIBS ARKSCICOS_LIBRARY ARKSCICOS_LIBRARIES)
libfind_process(ARKSCICOS)
# - Try to find BOOSTNUMERICBINDINGS
# Once done, this will define
#
# BOOSTNUMERICBINDINGS_FOUND - system has scicoslab
# BOOSTNUMERICBINDINGS_INCLUDE_DIRS - the scicoslab include directories
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(BOOSTNUMERICBINDINGS)
# Include dir
find_path(BOOSTNUMERICBINDINGS_INCLUDE_DIR
NAMES boost/numeric/bindings/lapack/lapack.h
PATHS ${COMMON_INCLUDE_PATHS_BOOSTNUMERICBINDINGS}
)
# 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(BOOSTNUMERICBINDINGS_PROCESS_INCLUDES BOOSTNUMERICBINDINGS_INCLUDE_DIR)
libfind_process(BOOSTNUMERICBINDINGS)
macro(build_boostnumericbindings TAG EP_BASE_DIR EP_INSTALL_PREFIX)
if( NOT BOOSTNUMERICBINDINGS)
ExternalProject_Add(boost-numeric-bindings
GIT_REPOSITORY "http://git.tiker.net/trees/boost-numeric-bindings.git"
GIT_TAG ${BOOSTNUMERICBINDINGS_TAG}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
)
set(BOOSTNUMERICBINDINGS_FOUND TRUE)
set(BOOSTNUMERICBINDINGS_INCLUDE_DIRS ${EP_BASE_DIR}/Source/boost-numeric-bindings)
endif()
endmacro()
# - Try to find EASYSTAR
# Once done, this will define
#
# EASYSTAR_FOUND - system has easystar
# EASYSTAR_INCLUDE_DIRS - the easystar include directories
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(EASYSTAR)
# Include dir
find_path(EASYSTAR_INCLUDE_DIR
NAMES easystar/easystar.xml
PATHS ${COMMON_INCLUDE_PATHS_EASYSTAR}
)
# 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(EASYSTAR_PROCESS_INCLUDES EASYSTAR_INCLUDE_DIR)
libfind_process(EASYSTAR)
# - Try to find JSBSIM
# Once done, this will define
#
# JSBSIM_FOUND - system has scicoslab
# JSBSIM_INCLUDE_DIRS - the scicoslab include directories
# JSBSIM_LIBRARIES - libraries to link to
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(JSBSIM)
# Include dir
find_path(JSBSIM_INCLUDE_DIR
NAMES JSBSim/initialization/FGTrimmer.h
PATHS ${COMMON_INCLUDE_PATHS_JSBSIM}
)
# data dir
find_path(JSBSIM_DATA_DIR_SEARCH
NAMES jsbsim/aircraft/aircraft_template.xml
PATHS ${COMMON_DATA_PATHS_JSBSIM}
)
set(JSBSIM_DATA_DIR ${JSBSIM_DATA_DIR_SEARCH}/jsbsim)
# Finally the library itself
find_library(JSBSIM_LIBRARY
NAMES JSBSim
PATHS ${COMMON_LIBRARY_PATHS_JSBSIM}
)
# 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(JSBSIM_PROCESS_INCLUDES JSBSIM_INCLUDE_DIR)
set(JSBSIM_PROCESS_LIBS JSBSIM_LIBRARY JSBSIM_LIBRARIES)
set(JSBSIM_INCLUDE_DIR ${JSBSIM_INCLUDE_DIR} ${JSBSIM_INCLUDE_DIR}/JSBSim)
set(JSBSIM_INCLUDES ${JSBSIM_INCLUDES} ${JSBSIM_INCLUDE_DIR}/JSBSim)
libfind_process(JSBSIM)
macro(build_jsbsim TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
if(NOT JSBSIM_FOUND)
ExternalProject_Add(jsbsim
GIT_REPOSITORY "git://github.com/jgoppert/jsbsim.git"
GIT_TAG ${TAG}
UPDATE_COMMAND ""
INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
)
set(JSBSIM_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include/jsbsim)
set(JSBSIM_DATA_DIR ${EP_DATADIR}/jsbsim)
# static lib prefix
if(WIN32)
set(STATIC_LIB_PREFIX "")
elseif(APPLE)
set(STATIC_LIB_PREFIX "lib")
elseif(UNIX)
set(STATIC_LIB_PREFIX "lib")
else()
message(FATAL_ERROR "unknown operating system")
endif()
set(JSBSIM_LIBRARIES ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/lib/${STATIC_LIB_PREFIX}jsbsim.a)
set(JSBSIM_FOUND TRUE)
endif()
endmacro()
# - Try to find MAVLINK
# Once done, this will define
#
# MAVLINK_FOUND - system has scicoslab
# MAVLINK_INCLUDE_DIRS - the scicoslab include directories
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(MAVLINK)
# Include dir
find_path(MAVLINK_INCLUDE_DIR
NAMES mavlink/mavlink_types.h
PATHS ${COMMON_INCLUDE_PATHS_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)
macro(build_mavlink TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
if( NOT MAVLINK_FOUND)
ExternalProject_Add(mavlink
GIT_REPOSITORY "git://github.com/pixhawk/mavlink.git"
GIT_TAG ${TAG}
UPDATE_COMMAND ""
INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
)
set(MAVLINK_INCLUDE_DIRS ${EP_INCLUDEDIR})
set(MAVLINK_DATA_DIR "")
set(MAVLINK_LIBRARIES "")
set(MAVLINK_FOUND TRUE)
endif()
endmacro()
# Locate plib
# This module defines
# PLIB_LIBRARY
# PLIB_FOUND, if false, do not try to link to plib
# PLIB_INCLUDE_DIR, where to find the headers
#
# $PLIB_DIR is an environment variable that would
# correspond to the ./configure --prefix=$PLIB_DIR
#
# Created David Guthrie with code by Robert Osfield.
FIND_PATH(PLIB_INCLUDE_DIR plib/js.h
$ENV{PLIB_DIR}/include
$ENV{PLIB_DIR}
$ENV{PLIB_ROOT}/include
${DELTA3D_EXT_DIR}/inc
$ENV{DELTA_ROOT}/ext/inc
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;PLIB_ROOT]/include
/usr/freeware/include
)
MACRO(FIND_PLIB_LIBRARY MYLIBRARY MYLIBRARYNAMES)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAMES}
PATHS
$ENV{PLIB_DIR}/lib
$ENV{PLIB_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{PLIB_ROOT}/lib
${DELTA3D_EXT_DIR}/lib
$ENV{DELTA_ROOT}/ext/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;PLIB_ROOT]/lib
/usr/freeware/lib64
)
ENDMACRO(FIND_PLIB_LIBRARY MYLIBRARY MYLIBRARYNAMES)
SET(PLIB_RELEASE_JS_LIB_NAMES js plibjs)
SET(PLIB_RELEASE_UL_LIB_NAMES ul plibul)
SET(PLIB_DEBUG_JS_LIB_NAMES js_d plibjs_d)
SET(PLIB_DEBUG_UL_LIB_NAMES ul_d plibul_d)
FIND_PLIB_LIBRARY(PLIB_JS_LIBRARY "${PLIB_RELEASE_JS_LIB_NAMES}")
FIND_PLIB_LIBRARY(PLIB_JS_LIBRARY_DEBUG "${PLIB_DEBUG_JS_LIB_NAMES}")
FIND_PLIB_LIBRARY(PLIB_UL_LIBRARY "${PLIB_RELEASE_UL_LIB_NAMES}")
FIND_PLIB_LIBRARY(PLIB_UL_LIBRARY_DEBUG "${PLIB_DEBUG_UL_LIB_NAMES}")
SET(PLIB_FOUND "NO")
IF(PLIB_JS_LIBRARY AND PLIB_INCLUDE_DIR)
SET(PLIB_FOUND "YES")
ENDIF(PLIB_JS_LIBRARY AND PLIB_INCLUDE_DIR)
# - Try to find SCICOSLAB
# Once done, this will define
#
# SCICOSLAB_FOUND - system has scicoslab
# SCICOSLAB_INCLUDE_DIRS - the scicoslab include directories
# SCICOSLAB_CONTRIB_DIR - the scicoslab contrib directory
include(LibFindMacros)
# find scicos
if (APPLE)
execute_process(COMMAND mdfind "kMDItemKind == Application && kMDItemDisplayName == ScicosLabGtk"
COMMAND head -1
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE SCICOS_APP_BUNDLE
ERROR_VARIABLE ERROR_MESSAGE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (RESULT)
MESSAGE(FATAL_ERROR "Could not locate 'ScicosLabGtk.app' - ${ERROR_MESSAGE}")
endif (RESULT)
execute_process(COMMAND find ${SCICOS_APP_BUNDLE} -name routines
COMMAND head -1
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE SCICOSLAB_GUESS_INCLUDE_DIRS
ERROR_VARIABLE ERROR_MESSAGE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (RESULT)
MESSAGE(FATAL_ERROR "Could not locate 'scicos_block4.h' in ScicosLabGtk.app - ${ERROR_MESSAGE}")
endif (RESULT)
execute_process(COMMAND find ${SCICOS_APP_BUNDLE} -name contrib
COMMAND head -1
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE SCICOSLAB_GUESS_CONTRIB_DIRS
ERROR_VARIABLE ERROR_MESSAGE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (RESULT)
MESSAGE(FATAL_ERROR "Could not locate 'loader.sce' in ScicosLabGtk.app - ${ERROR_MESSAGE}")
endif (RESULT)
elseif(UNIX)
set(SCICOSLAB_GUESS_INCLUDE_DIRS
/usr/lib/scicoslab-gtk-4.4b7/routines
/usr/lib/scicoslab-gtk-4.4/routines
/usr/lib/scicoslab-gtk-4.4.1/routines
)
set(SCICOSLAB_GUESS_CONTRIB_DIRS
/usr/lib/scicoslab-gtk-4.4b7/contrib
/usr/lib/scicoslab-gtk-4.4/contrib
/usr/lib/scicoslab-gtk-4.4.1/contrib
)
elseif(WIN32)
message(FATAL_ERROR "scicoslab cmake find module doesn't work for windows")
endif()
# Include dir
find_path(SCICOSLAB_INCLUDE_DIR
NAMES scicos/scicos_block4.h
PATHS ${SCICOSLAB_GUESS_INCLUDE_DIRS}
)
# Contrib dir
find_path(SCICOSLAB_CONTRIB_DIR
NAMES loader.sce
PATHS ${SCICOSLAB_GUESS_CONTRIB_DIRS}
)
message(STATUS "contrib dir ${SCICOSLAB_CONTRIB_DIR}")
# 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(SCICOSLAB_PROCESS_INCLUDES SCICOSLAB_INCLUDE_DIR)
libfind_process(SCICOSLAB)
# vim:ts=4:sw=4:expandtab
# - Try to find SIMGEAR
# Once done, this will define
#
# SIMGEAR_FOUND - system has scicoslab
# SIMGEAR_INCLUDE_DIRS - the scicoslab include directories
# SIMGEAR_LIBRARIES - libraries to link to
include(LibFindMacros)
include(MacroCommonPaths)
MacroCommonPaths(SIMGEAR)
# Include dir
find_path(SIMGEAR_INCLUDE_DIR
NAMES simgear/version.h
PATHS ${COMMON_INCLUDE_PATHS_SIMGEAR}
)
# Finally the library itself
find_library(SIMGEAR_LIBRARY
NAMES sgio
PATHS ${COMMON_LIBRARY_PATHS_SIMGEAR}
)
# 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(SIMGEAR_PROCESS_INCLUDES SIMGEAR_INCLUDE_DIR)
set(SIMGEAR_PROCESS_LIBS SIMGEAR_LIBRARY SIMGEAR_LIBRARIES)
libfind_process(SIMGEAR)
# 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)
# - MACRO_ADD_COMPILE_FLAGS(target_name flag1 ... flagN)
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_COMPILE_FLAGS _target)
get_target_property(_flags ${_target} COMPILE_FLAGS)
if (_flags)
set(_flags ${_flags} ${ARGN})
else (_flags)
set(_flags ${ARGN})
endif (_flags)
set_target_properties(${_target} PROPERTIES COMPILE_FLAGS ${_flags})
endmacro (MACRO_ADD_COMPILE_FLAGS)
# - MACRO_ADD_LINK_FLAGS(target_name flag1 ... flagN)
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_LINK_FLAGS _target)
get_target_property(_flags ${_target} LINK_FLAGS)
if (_flags)
set(_flags "${_flags} ${ARGN}")
else (_flags)
set(_flags "${ARGN}")
endif (_flags)
set_target_properties(${_target} PROPERTIES LINK_FLAGS "${_flags}")
endmacro (MACRO_ADD_LINK_FLAGS)
# - MACRO_ADD_PLUGIN(name [WITH_PREFIX] file1 .. fileN)
#
# Create a plugin from the given source files.
# If WITH_PREFIX is given, the resulting plugin will have the
# prefix "lib", otherwise it won't.
#
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_PLUGIN _target_NAME _with_PREFIX)
if (${_with_PREFIX} STREQUAL "WITH_PREFIX")
set(_first_SRC)
else (${_with_PREFIX} STREQUAL "WITH_PREFIX")
set(_first_SRC ${_with_PREFIX})
endif (${_with_PREFIX} STREQUAL "WITH_PREFIX")
add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
if (_first_SRC)
set_target_properties(${_target_NAME} PROPERTIES PREFIX "")
endif (_first_SRC)
endmacro (MACRO_ADD_PLUGIN _name _sources)
# - Check whether the C compiler supports a given flag in the
# context of a stack checking compiler option.
# CHECK_C_COMPILER_FLAG_SSP(FLAG VARIABLE)
#
# FLAG - the compiler flag
# VARIABLE - variable to store the result
#
# This actually calls the check_c_source_compiles macro.
# See help for CheckCSourceCompiles for a listing of variables
# that can modify the build.
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckCSourceCompiles)
MACRO (CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT)
SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
CHECK_C_SOURCE_COMPILES("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT})
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
ENDMACRO (CHECK_C_COMPILER_FLAG_SSP)
macro(MacroCommonPaths NAME)
set(COMMON_INCLUDE_PATHS_${NAME}
$ENV{${NAME}_DIR}/include
$ENV{${NAME}_DIR}
$ENV{${NAME}_ROOT}/include
$ENV{${NAME}_ROOT}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\\Manager\\Environment;${NAME}_DIR]/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\\Manager\\Environment;${NAME}_ROOT]/include
/usr/freeware/include
)
set(COMMON_LIB_PATHS_${NAME}
$ENV{${NAME}_DIR}/lib
$ENV{${NAME}_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\\Manager\\Environment;${NAME}_DIR]/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\\Manager\\Environment;${NAME}_ROOT]/lib
/usr/freeware/lib64
)
set(COMMON_DATA_PATHS_${NAME}
$ENV{${NAME}_DIR}/share
$ENV{${NAME}_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/share
/usr/share
/sw/share
/opt/local/share
/opt/csw/share
/opt/share
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\\Manager\\Environment;${NAME}_DIR]/share
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\\Manager\\Environment;${NAME}_ROOT]/share
/usr/freeware/share64
)
endmacro(MacroCommonPaths)
# vim:ts=4:sw=4:expandtab
# - macro_copy_file(_src _dst)
# Copies a file to ${_dst} only if ${_src} is different (newer) than ${_dst}
#
# Example:
# macro_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/icon.png ${CMAKE_CURRENT_BINARY_DIR}/.)
# Copies file icon.png to ${CMAKE_CURRENT_BINARY_DIR} directory
#
# Copyright (c) 2006-2007 Wengo
# Copyright (c) 2006-2008 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING file.
macro (macro_copy_file _src _dst)
# Removes all path containing .svn or CVS or CMakeLists.txt during the copy
if (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
if (CMAKE_VERBOSE_MAKEFILE)
message(STATUS "Copy file from ${_src} to ${_dst}")
endif (CMAKE_VERBOSE_MAKEFILE)
# Creates directory if necessary
get_filename_component(_path ${_dst} PATH)
file(MAKE_DIRECTORY ${_path})
execute_process(
COMMAND
${CMAKE_COMMAND} -E copy_if_different ${_src} ${_dst}
OUTPUT_QUIET
)
endif (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
endmacro (macro_copy_file)
# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource)
if (_insource)
file(REMOVE [CMakeCache.txt CMakeFiles])
message(FATAL_ERROR "${_errorMessage}")
endif (_insource)
endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)
# vim:ts=4:sw=4:expandtab
macro(MacroFindOrBuild 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(MacroFindOrBuild)
macro(MacroSetDefault VAR DEFAULT)
if (NOT DEFINED ${VAR})
set(${VAR} ${DEFAULT})
endif()
endmacro(MacroSetDefault)
arktools cmake modules
=============
This repository contains the cmake modules used by arktools.
The python scripts do not function unless they are in an arktool.
From an arktool (ex. arktools/arkscicos) run:
```console
./cmake/updateArkcmake.py
```
# - Run Doxygen
#
# Adds a doxygen target that runs doxygen to generate the html
# and optionally the LaTeX API documentation.
# The doxygen target is added to the doc target as dependency.
# i.e.: the API documentation is built with:
# make doc
#
# USAGE: INCLUDE IN PROJECT
#
# set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# include(UseDoxygen)
# Add the Doxyfile.in and UseDoxygen.cmake files to the projects source directory.
#
#
# Variables you may define are:
# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored. Defaults to "doc".
#
# DOXYFILE_LATEX_DIR - Directory where the Doxygen LaTeX output is stored. Defaults to "latex".
#
# DOXYFILE_HTML_DIR - Directory where the Doxygen html output is stored. Defaults to "html".
#
#
# Copyright (c) 2009-2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
# Copyright (c) 2010 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
macro(usedoxygen_set_default name value)
if(NOT DEFINED "${name}")
set("${name}" "${value}")
endif()
endmacro()
find_package(Doxygen)
if(DOXYGEN_FOUND)
find_file(DOXYFILE_IN
NAMES
doxy.config.in
PATHS
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_ROOT}/Modules/
NO_DEFAULT_PATH)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
endif()
if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
usedoxygen_set_default(DOXYFILE_HTML_DIR "html")
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
set(DOXYFILE_LATEX FALSE)
set(DOXYFILE_PDFLATEX FALSE)
set(DOXYFILE_DOT FALSE)
find_package(LATEX)
if(LATEX_COMPILER AND MAKEINDEX_COMPILER)
set(DOXYFILE_LATEX TRUE)
usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex")
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
if(PDFLATEX_COMPILER)
set(DOXYFILE_PDFLATEX TRUE)
endif()
if(DOXYGEN_DOT_EXECUTABLE)
set(DOXYFILE_DOT TRUE)
endif()
add_custom_command(TARGET doxygen
POST_BUILD
COMMAND ${CMAKE_MAKE_PROGRAM}
WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
endif()
configure_file(${DOXYFILE_IN} ${CMAKE_CURRENT_BINARY_DIR}/doxy.config ESCAPE_QUOTES IMMEDIATE @ONLY)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doxy.trac.in)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxy.trac.in ${CMAKE_CURRENT_BINARY_DIR}/doxy.trac ESCAPE_QUOTES IMMEDIATE @ONLY)
add_custom_target(doxygen-trac ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxy.trac)
endif()
get_target_property(DOC_TARGET doc TYPE)
if(NOT DOC_TARGET)
add_custom_target(doc)
endif()
add_dependencies(doc doxygen)
endif()
#!/usr/bin/python
# Author: Lenna X. Peterson (github.com/lennax)
# based on bash script by James Goppert (github.com/jgoppert)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# USAGE: #
# $ ./autobuild.py [1-9] #
# Then follow menu #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# TODO: Error handling:
## check cmake success, etc.
## catch CMake Warning:
#Manually-specified variables were not used by the project:
#BUILD_TYPE
# (missing gprof flags)
import sys # for sys.argv[] and sys.platform
import os # for chdir()
import subprocess # for check_call()
import shutil # for rmtree()
from optparse import OptionParser # for parsing options
try:
from get_build_path import get_build_path
except ImportError:
print "Could not find 'get_build_path.py' "
print "in '%s'" % os.path.dirname(os.path.abspath(__file__))
print "This module is required."
raise SystemExit
## Move to directory containing CMakeLists.txt and src/
build_path = get_build_path()
if build_path:
os.chdir(build_path)
else:
print "The script was unable to find a build directory."
raise SystemExit
makeargs = "-j8"
cmakecall = ["cmake", ".."]
build_dir = "build"
## Parse command line options
## TODO: add makeargs/cmakeargs etc.
## (with 'action="append"' to append arg(s) to list)
usage = "usage: %prog [options] [1-9]"
parser = OptionParser(usage=usage)
parser.set_defaults(verbose=False, makeargs="-j8")
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose",
help="Verbose mode")
parser.add_option("-c", "--cmake",
action="store", dest="cm",
help="Specify one or more arguments for CMake")
#parser.add_option("--makeargs",
# action="store", type="string", dest="makeargs",
# help="Argument to `make` [default '-j8']")
(options, args) = parser.parse_args()
if options.verbose:
os.environ['VERBOSE'] = "1"
### Split cmakeargs, reassemble, and insert into cmake call
if options.cm:
cm_raw = options.cm
cm_list = cm_raw.split("-D")
if cm_list[0] == "":
cm_list.pop(0)
for cm in cm_list:
cm = cm.lstrip()
cmakearg = "-D" + cm
cmakecall.insert(1, cmakearg)
#if options.makeargs:
# makeargs = options.makeargs
def install_build(cmakecall, exitVal=True):
if not os.path.isdir(build_dir):
os.mkdir(build_dir)
os.chdir(build_dir)
subprocess.check_call(cmakecall)
subprocess.check_call(["make", makeargs])
if exitVal == True:
raise SystemExit
def dev_build():
cmakecall.insert(1, "-DDEV_MODE::bool=TRUE")
install_build(cmakecall)
def grab_deps():
if 'linux' in sys.platform:
try:
subprocess.check_call('sudo apt-get install cmake', shell=True)
except:
print "Error installing dependencies: ", sys.exc_info()[0]
print "apt-get is available on Debian and Ubuntu"
raise SystemExit
elif 'darwin' in sys.platform:
try:
subprocess.check_call('sudo port install cmake', shell=True)
except:
print "Error installing dependencies: ", sys.exc_info()[0]
print "Please install Macports (http://www.macports.org)"
raise SystemExit
else:
print "Platform not recognized (did not match linux or darwin)"
print "Script doesn't download dependencies for this platform"
raise SystemExit
def package_source():
install_build(cmakecall, exitVal=False)
subprocess.check_call(["make", "package_source"])
raise SystemExit
def package():
install_build(cmakecall, exitVal=False)
subprocess.check_call(["make", "package"])
raise SystemExit
def remake():
if not os.path.isdir(build_dir):
print "Directory '%s' does not exist" % build_dir
print "You must make before you can remake."
return 1
os.chdir(build_dir)
subprocess.check_call(["make", makeargs])
raise SystemExit
def clean():
if 'posix' in os.name:
print "Cleaning '%s' with rm -rf" % build_dir
subprocess.check_call(["rm", "-rf", build_dir])
else:
print "Cleaning '%s' with shutil.rmtree()" % build_dir
print "(may be very slow)"
shutil.rmtree(build_dir, ignore_errors=True)
print "Build cleaned"
# requires PROFILE definition in CMakeLists.txt:
# set(CMAKE_BUILD_TYPE PROFILE)
# set(CMAKE_CXX_FLAGS_PROFILE "-g -pg")
# set(CMAKE_C_FLAGS_PROFILE "-g -pg")
def profile():
cmakecall.insert(1, "-DDEV_MODE::bool=TRUE")
cmakecall.insert(2, "-DBUILD_TYPE=PROFILE")
install_build(cmakecall)
def menu():
print "1. developer build: used for development."
print "2. install build: used for building before final installation to the system."
print "3. grab dependencies: installs all the required packages for debian based systems (ubuntu maverick/ debian squeeze,lenny) or darwin with macports."
print "4. package source: creates a source package for distribution."
print "5. package: creates binary packages for distribution."
print "6. remake: calls make again after project has been configured as install or in source build."
print "7. clean: removes the build directory."
print "8. profile: compiles for gprof."
print "9. end."
opt = raw_input("Please choose an option: ")
return opt
try:
loop_num = 0
# continues until a function raises system exit or ^C
while (1):
if len(args) == 1 and loop_num == 0:
opt = args[0]
loop_num += 1
else:
opt = menu()
try:
opt = int(opt)
except ValueError:
pass
if opt == 1:
print "You chose developer build"
dev_build()
elif opt == 2:
print "You chose install build"
install_build(cmakecall)
elif opt == 3:
print "You chose to install dependencies"
grab_deps()
elif opt == 4:
print "You chose to package the source"
package_source()
elif opt == 5:
print "You chose to package the binary"
package()
elif opt == 6:
print "You chose to re-call make on the previously configured build"
remake()
elif opt == 7:
print "You chose to clean the build"
clean()
elif opt == 8:
# requires definition in CMakeLists.txt (see def above)
print "You chose to compile for gprof"
profile()
elif opt == 9:
raise SystemExit
else:
print "Invalid option. Please try again: "
except KeyboardInterrupt:
print "\n"
#!/usr/bin/python
# Author: Lenna X. Peterson (github.com/lennax)
# Determines appropriate path for CMake
# Looks for "CMakeLists.txt" and "src/"
# ( BUILDFILE and SRCDIR in find_build_dir() )
# Searches the following paths:
# 1 Path of call
# 2 Path where script is located
# 3 Path above 2 (parent directory)
# 4 Path above 3 (grandparent directory)
import os # for getcwd(), os.path
def get_build_path():
build_dir=""
## Initialize search paths
call_dir = os.getcwd()
script_dir = os.path.dirname(os.path.abspath(__file__))
script_mom = os.path.abspath(script_dir + os.sep + os.pardir)
script_grandma = os.path.abspath(script_mom + os.sep + os.pardir)
if script_mom == call_dir:
script_mom = ""
if script_grandma == call_dir:
script_grandma = ""
## Define function to search for required components for build
def find_build_dir(search_dir):
BUILDFILE = "CMakeLists.txt"
#SRCDIR = "src"
os.chdir(search_dir)
if os.path.isfile(BUILDFILE):
return search_dir
return False
## Class to emulate if temp = x
# (checking equality of x while assigning it to temp)
# Borrowed from Alex Martelli
class Holder(object):
def set(self, value):
self.value = value
return value
def get(self):
return self.value
temp = Holder()
## Search paths for build components
if temp.set(find_build_dir(call_dir)):
build_dir = temp.get()
elif temp.set(find_build_dir(script_dir)):
build_dir = temp.get()
elif script_mom and temp.set(find_build_dir(script_mom)):
build_dir = temp.get()
elif script_grandma and temp.set(find_build_dir(script_grandma)):
build_dir = temp.get()
else:
return 0
#print "I go now. Good luck, everybody!"
return build_dir
# git cheat sheet #
git is a distributed version control system (DVCS). Version control is useful for software development for many reasons. Each version, or commit, acts as history of the software. If something breaks, it is easy to go back to a previous version that worked. git is also very useful for writing software as a team. Each commit is labeled with an author, so other authors can see who made what change.
git can be used in a variety of ways, but in this lab, we use a simple setup. The main, shared code is stored on either github (public, for open source projects), bitbucket (private), or our lab server (for projects that cannot be online). These repositories are considered "origin master". Users use the 'clone' command once to make a local copy of the repository, 'pull' to get updated changes, and 'commit' and 'push' to contribute their changes.
Following is a list of basic commands for git.
## Initial setup ##
To fetch a project for the first time (aka clone a repository):
_substitute appropriate address_
```console
git clone git@github.com:jgoppert/jsbsim.git
cd jsbsim
```
To setup your username and password (so everyone knows who did such great work!):
```console
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@youremail.com"
```
## Daily use ##
**Required:** Always do this before beginning any work to get any changes someone else may have made (this can avoid a lot of headaches):
```console
git pull
```
To see current un-committed changes:
```console
git diff
```
**Required:** To add all new and changed files, then commit changes:
(the only time you would omit push would be if you are working offline)
```console
git add .
git commit -a
git push
```
If you get an error from the push command:
```console
git push origin master
```
## Intermediate use ##
To only commit changes to the file "new":
(example: you changed trim states but do not want to save them)
```console
git add new
git commit
git push
```
Reverting all changes since last commit:
```console
git reset --hard
```
## Using branches ##
A great idea if you think you might break everything!
```console
git branch experiment
git checkout experiment
```
To switch back to the main files:
```console
git checkout master
```
To combine the code from the branch back into the main files (this may cause conflicts, which will be clearly marked in the file):
```console
git merge experiment
```
# cmake/modules/language_support.cmake
#
# Temporary additional general language support is contained within this
# file.
# This additional function definition is needed to provide a workaround for
# CMake bug 9220.
# On debian testing (cmake 2.6.2), I get return code zero when calling
# cmake the first time, but cmake crashes when running a second time
# as follows:
#
# -- The Fortran compiler identification is unknown
# CMake Error at /usr/share/cmake-2.6/Modules/CMakeFortranInformation.cmake:7 (GET_FILENAME_COMPONENT):
# get_filename_component called with incorrect number of arguments
# Call Stack (most recent call first):
# CMakeLists.txt:3 (enable_language)
#
# My workaround is to invoke cmake twice. If both return codes are zero,
# it is safe to invoke ENABLE_LANGUAGE(Fortran OPTIONAL)
function(workaround_9220 language language_works)
#message("DEBUG: language = ${language}")
set(text
"project(test NONE)
cmake_minimum_required(VERSION 2.6.0)
enable_language(${language} OPTIONAL)
"
)
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/language_tests/${language})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language})
file(WRITE ${CMAKE_BINARY_DIR}/language_tests/${language}/CMakeLists.txt
${text})
execute_process(
COMMAND ${CMAKE_COMMAND} .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language}
RESULT_VARIABLE return_code
OUTPUT_QUIET
ERROR_QUIET
)
if(return_code EQUAL 0)
# Second run
execute_process (
COMMAND ${CMAKE_COMMAND} .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language}
RESULT_VARIABLE return_code
OUTPUT_QUIET
ERROR_QUIET
)
if(return_code EQUAL 0)
set(${language_works} ON PARENT_SCOPE)
else(return_code EQUAL 0)
set(${language_works} OFF PARENT_SCOPE)
endif(return_code EQUAL 0)
else(return_code EQUAL 0)
set(${language_works} OFF PARENT_SCOPE)
endif(return_code EQUAL 0)
endfunction(workaround_9220)
# Temporary tests of the above function.
#workaround_9220(CXX CXX_language_works)
#message("CXX_language_works = ${CXX_language_works}")
#workaround_9220(CXXp CXXp_language_works)
#message("CXXp_language_works = ${CXXp_language_works}")
# Using Unix and vi #
A few basic Unix commands are all that is necessary to be able to work with files.
First, all of these commands must be typed into the Terminal. Its icon is a black square with '>_' in white. On Debian, it is located at Applications > Accessories > Terminal. After typing the command, press Enter.
'ls' lists the files in the current directory. The '-al' option shows hidden files and shows extra information in a list (directories have a d in front of them). Specifying a path will show the files in that directory.
```console
ls
ls -al
ls -al Projects
```
'pwd' shows the absolute path to the current directory.
```console
pwd
```
'cd' means change directory. It can be used in several ways.
Used alone, it moves to the home directory of the current user. This is useful if you are looking at files somewhere else and need to go back to the home directory without typing the whole path.
```console
cd
```
If there are directories inside the current directory (use 'ls -al', directories have d in front of them), you can move to them with a relative path:
```console
cd Projects/jsbsim
```
If you want to move to a directory *outside* of the current directory, use an absolute path (the same thing that would be returned by 'pwd', notice that it begins with a slash):
```console
cd /usr/local
```
Another important symbol is the tilde (~), which means the home directory of the current user (the same place 'cd' will move to):
```console
cd ~/Projects/jsbsim
```
'cp' is copy and 'mv' is move, which is also used to rename files.
To move a file from the current directory into the directory 'src/':
```console
mv testfile src/
```
To rename a file:
```console
mv testfile release
```
To copy a file:
```console
cp release test
```
#!/usr/bin/python
# Author: Lenna X. Peterson (github.com/lennax)
# Based on bash script by James Goppert (github.com/jgoppert)
#
# script used to update cmake modules from git repo, can't make this
# a submodule otherwise it won't know how to interpret the CMakeLists.txt
# # # # # # subprocess# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import os # for os.path
import subprocess # for check_call()
clone_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
print clone_path
os.chdir(clone_path)
subprocess.check_call(["git", "clone", "git://github.com/arktools/arkcmake.git","arkcmake_tmp"])
subprocess.check_call(["rm", "-rf", "arkcmake_tmp/.git"])
if os.path.isdir("arkcmake"):
subprocess.check_call(["rm", "-rf", "arkcmake"])
subprocess.check_call(["mv", "arkcmake_tmp", "arkcmake"])
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=$@CMAKE_INSTALL_PREFIX@
Name: @PROJECT_NAME@
Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
Version: @APPLICATION_VERSION@
Cflags: -I@CMAKE_INSTALL_PREFIX@/include/@PROJECT_NAME@
This diff is collapsed.
MAVLink Micro Air Vehicle Message Marshalling Library
The mavlink_to_html_table.xsl file is used to transform the MAVLink XML into a human-readable HTML table for online documentation.
For more information, please visit:
http://pixhawk.ethz.ch/software/mavlink
(c) 2009-2010 Lorenz Meier / PIXHAWK Team
table.sortable {
spacing: 5px;
border: 1px solid #656575;
width: 100%;
}
table.sortable th {
margin: 5px;
}
tr:nth-child(odd) { background-color:#eee; }
tr:nth-child(even) { background-color:#fff; }
table.sortable thead {
background-color:#eee;
color:#666666;
font-weight: bold;
cursor: default;
}
table.sortable td {
margin: 5px 5px 20px 5px;
vertical-align: top;
}
table.sortable td.mavlink_name {
color:#226633;
font-weight: bold;
width: 25%;
vertical-align: top;
}
table.sortable td.mavlink_mission_param {
color:#334455;
font-weight: bold;
width: 25%;
}
table.sortable td.mavlink_type {
color:#323232;
font-weight: normal;
width: 12%;
}
table.sortable td.mavlink_comment {
color:#555555;
font-weight: normal;
width: 60%;
}
p.description {
color:#808080;
font-weight: normal;
}
\ No newline at end of file
<?php>
// Requires the installation of php5-xsl
// e.g. on Debian/Ubuntu: sudo apt-get install php5-xsl
// Load the file from the repository / server.
// Update this URL if the file location changes
$xml_file_name = "http://github.com/pixhawk/mavlink/raw/master/mavlink_standard_message.xml";
// Load the XSL transformation file from the repository / server.
// This file can be updated by any client to adjust the table
$xsl_file_name= "http://github.com/pixhawk/mavlink/raw/master/doc/mavlink_to_html_table.xsl";
// Load data XML file
$xml = file_get_contents($xml_file_name);
$xml_doc = new DomDocument;
$xml_doc->loadXML($xml);
// Load stylesheet XSL file
$xsl = file_get_contents($xsl_file_name);
$xsl_doc = new DomDocument;
$xsl_doc->loadXML($xsl);
$xsltproc = new XsltProcessor();
$xsltproc->importStylesheet($xsl_doc);
// process the files and write the output to $out_file
if ($html = $xsltproc->transformToXML($xml_doc))
{
echo $html;
}
else
{
trigger_error('XSL transformation failed.',E_USER_ERROR);
}
</php>
<h2> Messages XML Definition </h2>
Messages are defined by the <a href="http://github.com/pixhawk/mavlink/blob/master/mavlink_standard_message.xml">mavlink_standard_message.xml</a> file. The C packing/unpacking code is generated from this specification, as well as the HTML documentaiton in the section above.<br />
<br />
<i>The XML displayed here is updated on every commit and therefore up-to-date.</i>
<?php>
//require_once("inc/geshi.php");
//$xml_file_name = "http://github.com/pixhawk/mavlink/raw/master/mavlink_standard_message.xml";
//
//// Load data XML file
//$xml = file_get_contents($xml_file_name);
//
//// Show the current code
//$geshi_xml = new GeSHi($xml, 'xml');
//$display_xml = $geshi_xml->parse_code();
//
//echo $display_xml;
</php>
\ No newline at end of file
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="//include">
<h1>MAVLink Include Files</h1>
<p><strong><em>Including files: </em><xsl:value-of select="." /></strong></p>
</xsl:template>
<xsl:template match="//enums">
<h1>MAVLink Type Enumerations</h1>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="//messages">
<h1>MAVLink Messages</h1>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="//message">
<h3 class="mavlink_message_name"><xsl:value-of select="@name" /> (#<xsl:value-of select="@id" />)</h3>
<p class="description"><xsl:value-of select="description" /></p>
<table class="sortable">
<thead>
<tr>
<th class="mavlink_field_header">Field Name</th>
<th class="mavlink_field_header">Type</th>
<th class="mavlink_field_header">Description</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="field" />
</tbody>
</table>
</xsl:template>
<xsl:template match="//field">
<tr class="mavlink_field">
<td class="mavlink_name" valign="top"><xsl:value-of select="@name" /></td>
<td class="mavlink_type" valign="top"><xsl:value-of select="@type" /></td>
<td class="mavlink_comment"><xsl:value-of select="." /></td>
</tr>
</xsl:template>
<xsl:template match="//version">
<h1>MAVLink Protocol Version</h1>
<p>This file has protocol version: <xsl:value-of select="." />. The version numbers range from 1-255.</p>
</xsl:template>
<xsl:template match="//enum">
<h3 class="mavlink_message_name"><xsl:value-of select="@name" /></h3>
<p class="description"><xsl:value-of select="description" /></p>
<table class="sortable">
<thead>
<tr>
<th class="mavlink_field_header">CMD ID</th>
<th class="mavlink_field_header">Field Name</th>
<th class="mavlink_field_header">Description</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="entry" />
</tbody>
</table>
</xsl:template>
<xsl:template match="//entry">
<tr class="mavlink_field">
<td class="mavlink_type" valign="top"><xsl:value-of select="@value" /></td>
<td class="mavlink_name" valign="top"><xsl:value-of select="@name" /></td>
<td class="mavlink_comment"><xsl:value-of select="description" /></td>
</tr>
<tr>
<td></td>
<xsl:apply-templates select="param" />
</tr>
<tr>
<td colspan="3"><br /></td>
</tr>
</xsl:template>
<xsl:template match="//param">
<tr>
<td></td>
<td class="mavlink_mission_param" valign="top">Mission Param #<xsl:value-of select="@index" /></td>
<td class="mavlink_comment"><xsl:value-of select="." /></td>
</tr>
</xsl:template>
</xsl:stylesheet>
A more detailed version of this quickstart is available at:
http://qgroundcontrol.org/dev/mavlink_linux_integration_tutorial
MAVLINK UDP QUICKSTART INSTRUCTIONS
===================================
MAVLink UDP Example for *nix system (Linux, MacOS, BSD, etc.)
To compile with GCC, just enter:
gcc -I ../../include/common -o mavlink_udp mavlink_udp.c
To run, type:
./mavlink_udp
If you run QGroundControl on the same machine, a MAV should pop up.
/*******************************************************************************
Copyright (C) 2010 Bryan Godbolt godbolt ( a t ) ualberta.ca
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
/*
This program sends some data to qgroundcontrol using the mavlink protocol. The sent packets
cause qgroundcontrol to respond with heartbeats. Any settings or custom commands sent from
qgroundcontrol are printed by this program along with the heartbeats.
I compiled this program sucessfully on Ubuntu 10.04 with the following command
gcc -I ../../pixhawk/mavlink/include -o udp-server udp-server-test.c
the rt library is needed for the clock_gettime on linux
*/
/* These headers are for QNX, but should all be standard on unix/linux */
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if (defined __QNX__) | (defined __QNXNTO__)
/* QNX specific headers */
#include <unix.h>
#else
/* Linux / MacOS POSIX timer headers */
#include <sys/time.h>
#include <time.h>
#include <arpa/inet.h>
#endif
/* This assumes you have the mavlink headers on your include path
or in the same folder as this source file */
#include <mavlink.h>
#define BUFFER_LENGTH 2041 // minimum buffer size that can be used with qnx (I don't know why)
uint64_t microsSinceEpoch();
int main(int argc, char* argv[])
{
char help[] = "--help";
char target_ip[100];
float position[6] = {};
int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
struct sockaddr_in gcAddr;
struct sockaddr_in locAddr;
//struct sockaddr_in fromAddr;
uint8_t buf[BUFFER_LENGTH];
ssize_t recsize;
socklen_t fromlen;
int bytes_sent;
mavlink_message_t msg;
uint16_t len;
int i = 0;
//int success = 0;
unsigned int temp = 0;
// Check if --help flag was used
if ((argc == 2) && (strcmp(argv[1], help) == 0))
{
printf("\n");
printf("\tUsage:\n\n");
printf("\t");
printf("%s", argv[0]);
printf(" <ip address of QGroundControl>\n");
printf("\tDefault for localhost: udp-server 127.0.0.1\n\n");
exit(EXIT_FAILURE);
}
// Change the target ip if parameter was given
strcpy(target_ip, "127.0.0.1");
if (argc == 2)
{
strcpy(target_ip, argv[1]);
}
memset(&locAddr, 0, sizeof(locAddr));
locAddr.sin_family = AF_INET;
locAddr.sin_addr.s_addr = INADDR_ANY;
locAddr.sin_port = htons(14551);
/* Bind the socket to port 14551 - necessary to receive packets from qgroundcontrol */
if (-1 == bind(sock,(struct sockaddr *)&locAddr, sizeof(struct sockaddr)))
{
perror("error bind failed");
close(sock);
exit(EXIT_FAILURE);
}
/* Attempt to make it non blocking */
if (fcntl(sock, F_SETFL, O_NONBLOCK | FASYNC) < 0)
{
fprintf(stderr, "error setting nonblocking: %s\n", strerror(errno));
close(sock);
exit(EXIT_FAILURE);
}
memset(&gcAddr, 0, sizeof(gcAddr));
gcAddr.sin_family = AF_INET;
gcAddr.sin_addr.s_addr = inet_addr(target_ip);
gcAddr.sin_port = htons(14550);
for (;;)
{
/*Send Heartbeat */
mavlink_msg_heartbeat_pack(1, 200, &msg, MAV_TYPE_HELICOPTER, MAV_AUTOPILOT_GENERIC, MAV_MODE_GUIDED_ARMED, 0, MAV_STATE_ACTIVE);
len = mavlink_msg_to_send_buffer(buf, &msg);
bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof(struct sockaddr_in));
/* Send Status */
mavlink_msg_sys_status_pack(1, 200, &msg, 0, 0, 0, 500, 11000, -1, -1, 0, 0, 0, 0, 0, 0);
len = mavlink_msg_to_send_buffer(buf, &msg);
bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof (struct sockaddr_in));
/* Send Local Position */
mavlink_msg_local_position_ned_pack(1, 200, &msg, microsSinceEpoch(),
position[0], position[1], position[2],
position[3], position[4], position[5]);
len = mavlink_msg_to_send_buffer(buf, &msg);
bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof(struct sockaddr_in));
/* Send attitude */
mavlink_msg_attitude_pack(1, 200, &msg, microsSinceEpoch(), 1.2, 1.7, 3.14, 0.01, 0.02, 0.03);
len = mavlink_msg_to_send_buffer(buf, &msg);
bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof(struct sockaddr_in));
memset(buf, 0, BUFFER_LENGTH);
recsize = recvfrom(sock, (void *)buf, BUFFER_LENGTH, 0, (struct sockaddr *)&gcAddr, &fromlen);
if (recsize > 0)
{
// Something received - print out all bytes and parse packet
mavlink_message_t msg;
mavlink_status_t status;
printf("Bytes Received: %d\nDatagram: ", (int)recsize);
for (i = 0; i < recsize; ++i)
{
temp = buf[i];
printf("%02x ", (unsigned char)temp);
if (mavlink_parse_char(MAVLINK_COMM_0, buf[i], &msg, &status))
{
// Packet received
printf("\nReceived packet: SYS: %d, COMP: %d, LEN: %d, MSG ID: %d\n", msg.sysid, msg.compid, msg.len, msg.msgid);
}
}
printf("\n");
}
memset(buf, 0, BUFFER_LENGTH);
sleep(1); // Sleep one second
}
}
/* QNX timer version */
#if (defined __QNX__) | (defined __QNXNTO__)
uint64_t microsSinceEpoch()
{
struct timespec time;
uint64_t micros = 0;
clock_gettime(CLOCK_REALTIME, &time);
micros = (uint64_t)time.tv_sec * 100000 + time.tv_nsec/1000;
return micros;
}
#else
uint64_t microsSinceEpoch()
{
struct timeval tv;
uint64_t micros = 0;
gettimeofday(&tv, NULL);
micros = ((uint64_t)tv.tv_sec) * 1000000 + tv.tv_usec;
return micros;
}
#endif
#!/bin/bash
# this script generates all the include files with pymavlink
# settings
wireProtocol=1.0
pymavlinkTag=51f3d6713e9a5b94c232ab9bf9d08095a0c97866
# download pymavlink
topDir=$PWD
rm -rf include
rm -rf pymavlink
git clone https://github.com/mavlink/pymavlink.git -b master pymavlink
cd pymavlink && git checkout $pymavlinkTag && rm -rf .git
# generate includes using message definitions
cd $topDir
for file in $(find message_definitions -name "*.xml")
do
echo generating mavlink includes for definition: $file
./pymavlink/generator/mavgen.py --lang=C --wire-protocol=$wireProtocol --output=include $file
done
# cleanup
rm -rf pymavlink
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment