Skip to content

Commit

Permalink
Initial import of mavconn
Browse files Browse the repository at this point in the history
  • Loading branch information
pixhawk-students committed Nov 23, 2010
1 parent f2970eb commit 292e52c
Show file tree
Hide file tree
Showing 679 changed files with 128,804 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debug*eclipse
release*eclipse
build
84 changes: 84 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
##======================================================================## PIXHAWK Micro Air Vehicle Flying Robotics Toolkit# Please see our website at <http://pixhawk.ethz.ch># ## Original Authors:# @author Reto Grieder <www.orxonox.net># @author Fabian Landau <www.orxonox.net># Contributing Authors (in alphabetical order):# # Todo:### (c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch># # This file is part of the PIXHAWK project# # PIXHAWK 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.# # PIXHAWK 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 PIXHAWK. If not, see <http://www.gnu.org/licenses/>.# ##========================================================================

CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)

# Keep devs from using the root directory as binary directory (messes up the source tree)
IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
MESSAGE(FATAL_ERROR "Please do not use the root directory as CMake output directory!
mkdir build; cd build; cmake ..
And you will have to clean the source directory by deleting CMakeCache.txt and the folder CMakeFiles")
ENDIF()


PROJECT(Pixhawk C CXX)

# If this is set to true, CMake shows the compiler and linker commands
#SET(CMAKE_VERBOSE_MAKEFILE true)

# This sets where to look for modules (e.g. "Find*.cmake" files)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

# Library finding
INCLUDE(LibraryConfig)

# General build and compiler options and configurations
INCLUDE(BuildConfig)

# PRINT macro
MACRO(PRINT)
MESSAGE(STATUS ${ARGN})
ENDMACRO(PRINT)

# Create the actual project
ADD_SUBDIRECTORY(src)

# Configure the binary output directory. Do this after src!
ADD_SUBDIRECTORY(cmake/bin)

# Configure the media file directory
ADD_SUBDIRECTORY(cmake/media)

# Configure the config file directory
ADD_SUBDIRECTORY(cmake/config)

# Last but not least: Try to make doxygen target
ADD_SUBDIRECTORY(cmake/doc)

# Output
SET(_output_blanks " ")
MESSAGE(STATUS "")
MESSAGE(STATUS "---------------------------------------------------")
MESSAGE(STATUS "Executable: Build: Condition:")
MESSAGE(STATUS "---------------------------------------------------")
FOREACH(_name ${__executables})
STRING(TOUPPER ${_name} _name_upper)
STRING(LENGTH ${_name} _name_length)
MATH(EXPR _name_length "30 - ${_name_length}")
STRING(SUBSTRING ${_output_blanks} 0 ${_name_length} _blanks)
IF (NOT ${_name_upper}_BUILD)
SET(_condition ${${_name_upper}_CONDITION})
ELSE ()
SET(_condition " (satisfied)")
ENDIF ()
MESSAGE(STATUS "${_name}${_blanks}${${_name_upper}_BUILD} ${_condition}")
ENDFOREACH(_name)

MESSAGE(STATUS "")
MESSAGE(STATUS "---------------------------------------------------")
MESSAGE(STATUS "Library: Build: Condition:")
MESSAGE(STATUS "---------------------------------------------------")
FOREACH(_name ${__libraries})
STRING(TOUPPER ${_name} _name_upper)
STRING(TOUPPER ${_name} _name_upper)
STRING(LENGTH ${_name} _name_length)
MATH(EXPR _name_length "30 - ${_name_length}")
STRING(SUBSTRING ${_output_blanks} 0 ${_name_length} _blanks)
IF (NOT ${_name_upper}_BUILD)
SET(_condition ${${_name_upper}_CONDITION})
ELSE ()
SET(_condition " (satisfied)")
ENDIF ()
MESSAGE(STATUS "${_name}${_blanks}${${_name_upper}_BUILD} ${_condition}")
ENDFOREACH(_name)
MESSAGE(STATUS "")

Expand Down
129 changes: 129 additions & 0 deletions cmake/BinaryUtilities.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
SET(__libraries CACHE INTERNAL "list of all libraries")
SET(__executables CACHE INTERNAL "list of all executables")

FUNCTION(_PIXHAWK_LIBRARY_INTERN _build _name _mode)
IF (_build)
SET(_build TRUE)
ELSE ()
SET(_build FALSE)
ENDIF ()

IF (_build)
ADD_LIBRARY(${_name} ${_mode} ${ARGN})

IF (NOT _mode STREQUAL "STATIC")
PIXHAWK_INSTALL(${_name})
ENDIF ()
ENDIF ()

STRING(TOUPPER ${_name} _name_upper)
SET(${_name_upper}_FOUND ${_build} CACHE INTERNAL "TRUE if the library ${_name} will be built.")
SET(${_name_upper}_BUILD ${_build} CACHE INTERNAL "TRUE if the library ${_name} will be built.")

LIST(APPEND __libraries ${_name})
SET(__libraries ${__libraries} CACHE INTERNAL "list of all libraries")
ENDFUNCTION(_PIXHAWK_LIBRARY_INTERN)

FUNCTION(_PIXHAWK_EXECUTABLE_INTERN _build _name)
IF (_build)
SET(_build TRUE)
ELSE ()
SET(_build FALSE)
ENDIF ()

IF (_build)
ADD_EXECUTABLE(${_name} ${ARGN})
PIXHAWK_INSTALL(${_name})
ENDIF ()

STRING(TOUPPER ${_name} _name_upper)
SET(${_name_upper}_BUILD ${_build} CACHE INTERNAL "TRUE if the library ${_name} will be built.")

LIST(APPEND __executables ${_name})
SET(__executables ${__executables} CACHE INTERNAL "list of all executables")
ENDFUNCTION(_PIXHAWK_EXECUTABLE_INTERN)

FUNCTION(PIXHAWK_LIBRARY _name _mode)
_PIXHAWK_LIBRARY_INTERN(TRUE ${_name} ${_mode} ${ARGN})
ENDFUNCTION(PIXHAWK_LIBRARY)

FUNCTION(PIXHAWK_EXECUTABLE _name)
_PIXHAWK_EXECUTABLE_INTERN(TRUE ${_name} ${ARGN})
ENDFUNCTION(PIXHAWK_EXECUTABLE)

FUNCTION(PIXHAWK_LINK_LIBRARIES _name)
STRING(TOUPPER ${_name} _name_upper)
IF (${_name_upper}_BUILD)
TARGET_LINK_LIBRARIES(${_name} ${ARGN})
ENDIF ()
ENDFUNCTION(PIXHAWK_LINK_LIBRARIES)

FUNCTION(_PIXHAWK_GET_FILES_AND_CONDITIONS _conditionvar _filesvar _name)
SET(_firstarg 1)

SET(_condition)
SET(_files)

SET(_parsing_condition FALSE)
SET(_parsing_files FALSE)

FOREACH(_arg ${ARGN})
STRING(TOUPPER ${_arg} _arg_upper)

IF (_firstarg EQUAL 1 AND NOT _arg_upper STREQUAL "CONDITION" AND NOT _arg_upper STREQUAL "FILES")
SET(_parsing_files TRUE)
ENDIF ()
SET(_firstarg 0)
IF (_arg_upper STREQUAL "FILES")
SET(_parsing_condition FALSE)
ENDIF ()

IF (_parsing_condition)
IF (_arg_upper STREQUAL "TRUE")
LIST(APPEND _condition 1)
ELSEIF (_arg_upper STREQUAL "FALSE")
LIST(APPEND _condition 0)
ELSE ()
LIST(APPEND _condition ${_arg})
ENDIF ()
ELSEIF (_parsing_files)
LIST(APPEND _files ${_arg})
ENDIF ()

IF (_arg_upper STREQUAL "CONDITION")
SET(_condition)
SET(_parsing_condition TRUE)
ENDIF ()
IF (_arg_upper STREQUAL "FILES")
SET(_files)
SET(_parsing_files TRUE)
ENDIF ()
ENDFOREACH(_arg)

IF (NOT DEFINED _condition)
SET(_condition 1)
ENDIF ()

SET(${_filesvar} ${_files} PARENT_SCOPE)

IF (${_condition})
SET(${_conditionvar} 1 PARENT_SCOPE)
ELSE ()
SET(${_conditionvar} 0 PARENT_SCOPE)
ENDIF ()

STRING(TOUPPER ${_name} _name_upper)
SET(${_name_upper}_CONDITION ${_condition} CACHE INTERNAL "The condition of the binary ${_name}.")
ENDFUNCTION(_PIXHAWK_GET_FILES_AND_CONDITIONS)

FUNCTION(PIXHAWK_LIBRARY_CONDITIONAL _name _mode)
_PIXHAWK_GET_FILES_AND_CONDITIONS(_condition _files ${_name} ${ARGN})
_PIXHAWK_LIBRARY_INTERN(${_condition} ${_name} ${_mode} ${_files})
ENDFUNCTION(PIXHAWK_LIBRARY_CONDITIONAL _name _mode)

FUNCTION(PIXHAWK_EXECUTABLE_CONDITIONAL _name)
_PIXHAWK_GET_FILES_AND_CONDITIONS(_condition _files ${_name} ${ARGN})
_PIXHAWK_EXECUTABLE_INTERN(${_condition} ${_name} ${_files})
ENDFUNCTION(PIXHAWK_EXECUTABLE_CONDITIONAL _name _mode)


Loading

0 comments on commit 292e52c

Please sign in to comment.