build: removed obsolete cmake rules

these have not been maintained for over a year
This commit is contained in:
Andrew Tridgell 2013-04-23 11:07:53 +10:00
parent 1c980981e4
commit 8ec1eaa8b1
11 changed files with 0 additions and 2347 deletions

View File

@ -1,51 +0,0 @@
set(CMAKE_TOOLCHAIN_FILE ../cmake/ArduinoToolchain.cmake) # Arduino Toolchain
cmake_minimum_required(VERSION 2.8)
project(ArduCopter C CXX)
set(PROJECT_VERSION_MAJOR "2")
set(PROJECT_VERSION_MINOR "6")
set(PROJECT_VERSION_PATCH "0")
set(PROJECT_DESCRIPTION "ArduPilotMega based Rotor-craft Autopilot.")
# macro path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")
include(CMakeParseArguments)
include(APMOption)
# options
include(options.cmake)
include_directories(${CMAKE_BINARY_DIR})
add_definitions(-DUSE_CMAKE_APM_CONFIG)
apm_option_generate_config(FILE "APM_Config_cmake.h" BUILD_FLAGS APM_BUILD_FLAGS)
add_definitions(${APM_BUILD_FLAGS})
message(STATUS "build flags: ${APM_BUILD_FLAGS}")
#configure_file(APM_Config2.h.cmake APM_Config2.h)
# 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.")
# built variables
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(FIRMWARE_NAME "${PROJECT_NAME}-${CONFIG_APM_HARDWARE}-${APM_PROCESSOR}-${HIL_MODE}")
# modify flags from default toolchain flags
set(APM_OPT_FLAGS "-Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${APM_OPT_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${APM_OPT_FLAGS} -Wno-reorder")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${APM_OPT_FLAGS} -Wl,--relax")
# build apm project
set(ARDUINO_EXTRA_LIBRARIES_PATH ${CMAKE_SOURCE_DIR}/../libraries)
set(${FIRMWARE_NAME}_SKETCH ${CMAKE_SOURCE_DIR}/../${PROJECT_NAME})
set(${FIRMWARE_NAME}_BOARD ${APM_PROCESSOR})
set(${FIRMWARE_NAME}_PORT ${APM_PROGRAMMING_PORT})
generate_arduino_firmware(${FIRMWARE_NAME})
install(FILES ${CMAKE_BINARY_DIR}/${FIRMWARE_NAME}.hex DESTINATION "/")
# cpack
include(APMCPackConfig)

View File

@ -1,163 +0,0 @@
#
# This files is used by cmake to present options to the
# user in the cmake-gui, it can also be used directly to
# set options in the cmake command line.
#
# This file generates APM_Config_cmake.h
# which overrides the APM_Config.h file. When disributing
# to the Arduino IDE user. APM_Confg_cmake.h could be copied to
# APM_Config.h, but this is not necessary. The
# advantage would be that the Arduino user would have
# a more up-to-date/ complete list of options and the developers
# using cmake have a nice gui/ command-line interface.
#
apm_option("APM_PROGRAMMING_PORT" TYPE STRING
DESCRIPTION "Programming upload port?"
DEFAULT "/dev/ttyACM0")
apm_option("CONFIG_APM_HARDWARE" TYPE STRING
DESCRIPTION "APM Hardware?"
OPTIONS "APM_HARDWARE_APM2" "APM_HARDWARE_APM1"
DEFAULT "APM_HARDWARE_APM2")
apm_option("APM2_BETA_HARDWARE" TYPE BOOL DEFINE_ONLY
DESCRIPTION "Is this an APM 2.0 Beta board?"
DEFAULT OFF)
apm_option("APM_PROCESSOR" TYPE STRING
DESCRIPTION "ArduPilotMega processor (2560 for APM2 and later APM1)?"
DEFAULT "mega2560"
OPTIONS "mega" "mega2560")
apm_option("LOGGING_ENABLED" TYPE BOOL
DESCRIPTION "Enable logging?"
DEFAULT OFF)
apm_option("GPS_PROTOCOL" TYPE STRING
DESCRIPTION "GPS protocol?"
DEFAULT "GPS_PROTOCOL_AUTO"
OPTIONS
"GPS_PROTOOCL_NONE"
"GPS_PROTOCOL_AUTO"
"GPS_PROTOCOL_NONE"
"GPS_PROTOCOL_IMU"
"GPS_PROTOCOL_MTK"
"GPS_PROTOCOL_MTK19"
"GPS_PROTOCOL_UBLOX"
"GPS_PROTOCOL_SIRF"
"GPS_PROTOCOL_NMEA")
apm_option("AIRSPEED_SENSOR" TYPE BOOL
DESCRIPTION "Enable airspeed sensor?"
DEFAULT OFF)
apm_option("PITOT_ENABLED" TYPE BOOL
DESCRIPTION "Enable pitot static system?"
DEFAULT OFF)
apm_option("CONFIG_SONAR" TYPE BOOL
DESCRIPTION "Enable sonar?"
DEFAULT ON)
apm_option("AIRSPEED_RATIO" TYPE STRING ADVANCED
DESCRIPTION "Airspeed ratio?"
DEFAULT "1.9936")
#apm_option("MAGNETOMETER" TYPE BOOL
#DESCRIPTION "Enable airspeed sensor?"
#DEFAULT OFF)
#apm_option("MAG_ORIENTATION" TYPE STRING ADVANCED
#DESCRIPTION "Magnetometer orientation?"
#DEFAULT "AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
#OPTIONS
#"AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
#"AP_COMPASS_COMPONENTS_DOWN_PINS_BACK"
#"AP_COMPASS_COMPONENTS_UP_PINS_FORWARD"
#"AP_COMPASS_COMPONENTS_UP_PINS_BACK")
apm_option("HIL_MODE" TYPE STRING
DESCRIPTION "Hardware-in-the-loop- mode?"
DEFAULT "HIL_MODE_DISABLED"
OPTIONS
"HIL_MODE_DISABLED"
"HIL_MODE_ATTITUDE"
"HIL_MODE_SENSORS")
apm_option("MAV_SYSTEM_ID" TYPE STRING ADVANCED
DESCRIPTION "MAVLink System ID?"
DEFAULT "1")
apm_option("SERIAL0_BAUD" TYPE STRING ADVANCED
DESCRIPTION "Serial 0 baudrate?"
DEFAULT "115200"
OPTIONS "57600" "115200")
apm_option("SERIAL3_BAUD" TYPE STRING ADVANCED
DESCRIPTION "Serial 3 baudrate?"
DEFAULT "57600"
OPTIONS "57600" "115200")
apm_option("BATTERY_EVENT" TYPE BOOL ADVANCED
DESCRIPTION "Enable low voltage/ high discharge warnings?"
DEFAULT OFF)
apm_option("LOW_VOLTAGE" TYPE STRING ADVANCED
DESCRIPTION "Voltage to consider low (volts)?"
DEFAULT "9.6")
apm_option("VOLT_DIV_RATIO" TYPE STRING ADVANCED
DESCRIPTION "Voltage division ratio?"
DEFAULT "3.56")
apm_option("CUR_AMPS_PER_VOLT" TYPE STRING ADVANCED
DESCRIPTION "Current amps/volt?"
DEFAULT "27.32")
apm_option("CUR_AMPS_OFFSET" TYPE STRING ADVANCED
DESCRIPTION "Current amps offset?"
DEFAULT "0.0")
# arducopter specific
apm_option("FRAME_CONFIG" TYPE STRING
DESCRIPTION "Vehicle type?"
DEFAULT "QUAD_FRAME"
OPTIONS
"QUAD_FRAME"
"TRI_FRAME"
"HEXA_FRAME"
"Y6_FRAME"
"OCTA_FRAME"
"OCTA_QUAD_FRAME"
"HELI_FRAME"
)
apm_option("FRAME_ORIENTATION" TYPE STRING
DESCRIPTION "Vehicle type?"
DEFAULT "PLUS_FRAME"
OPTIONS
"PLUS_FRAME"
"X_FRAME"
"V_FRAME"
)
apm_option("CH7_OPTION" TYPE STRING
DESCRIPTION "Channel 7 option?"
DEFAULT "CH7_SAVE_WP"
OPTIONS
"CH7_DO_NOTHING"
"CH7_DO_NOTHING"
"CH7_FLIP"
"CH7_SIMPLE_MODE"
"CH7_RTL"
"CH7_SAVE_TRIM"
"CH7_DO_NOTHING"
"CH7_SAVE_WP"
"CH7_DO_NOTHING"
"CH7_CAMERA_TRIGGER"
"CH7_SONAR")
apm_option("ACCEL_ALT_HOLD" TYPE BOOL ADVANCED
DESCRIPTION "Disabled by default, work in progress."
DEFAULT OFF)

View File

@ -1,52 +0,0 @@
set(CMAKE_TOOLCHAIN_FILE ../cmake/ArduinoToolchain.cmake) # Arduino Toolchain
cmake_minimum_required(VERSION 2.8)
project(ArduPlane C CXX)
set(PROJECT_VERSION_MAJOR "2")
set(PROJECT_VERSION_MINOR "3")
set(PROJECT_VERSION_PATCH "3")
set(PROJECT_DESCRIPTION "ArduPilotMega based Airplane Autopilot.")
# macro path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")
include(CMakeParseArguments)
include(APMOption)
# options
include(options.cmake)
include_directories(${CMAKE_BINARY_DIR})
add_definitions(-DUSE_CMAKE_APM_CONFIG)
apm_option_generate_config(FILE "APM_Config_cmake.h" BUILD_FLAGS APM_BUILD_FLAGS)
add_definitions(${APM_BUILD_FLAGS})
message(STATUS "build flags: ${APM_BUILD_FLAGS}")
#configure_file(APM_Config2.h.cmake APM_Config2.h)
# 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.")
# built variables
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(FIRMWARE_NAME "${PROJECT_NAME}-${CONFIG_APM_HARDWARE}-${APM_PROCESSOR}-${HIL_MODE}")
# modify flags from default toolchain flags
set(APM_OPT_FLAGS "-Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${APM_OPT_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${APM_OPT_FLAGS} -Wno-reorder")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${APM_OPT_FLAGS} -Wl,--relax")
# build apm project
set(ARDUINO_EXTRA_LIBRARIES_PATH ${CMAKE_SOURCE_DIR}/../libraries)
set(${FIRMWARE_NAME}_SKETCH ${CMAKE_SOURCE_DIR}/../${PROJECT_NAME})
set(${FIRMWARE_NAME}_BOARD ${APM_PROCESSOR})
set(${FIRMWARE_NAME}_PORT ${APM_PROGRAMMING_PORT})
set(${FIRMWARE_NAME}_SRCS ${CMAKE_BINARY_DIR}/APM_Config_cmake.h)
generate_arduino_firmware(${FIRMWARE_NAME})
install(FILES ${CMAKE_BINARY_DIR}/${FIRMWARE_NAME}.hex DESTINATION "/")
# cpack
include(APMCPackConfig)

View File

@ -1,197 +0,0 @@
#
# This files is used by cmake to present options to the
# user in the cmake-gui, it can also be used directly to
# set options in the cmake command line.
#
# This file generates APM_Config_cmake.h
# which overrides the APM_Config.h file. When disributing
# to the Arduino IDE user. APM_Confg_cmake.h could be copied to
# APM_Config.h, but this is not necessary. The
# advantage would be that the Arduino user would have
# a more up-to-date/ complete list of options and the developers
# using cmake have a nice gui/ command-line interface.
#
apm_option("APM_PROGRAMMING_PORT" TYPE STRING
DESCRIPTION "Programming upload port?"
DEFAULT "/dev/ttyACM0")
apm_option("CONFIG_APM_HARDWARE" TYPE STRING
DESCRIPTION "APM Hardware?"
OPTIONS "APM_HARDWARE_APM2" "APM_HARDWARE_APM1"
DEFAULT "APM_HARDWARE_APM2")
apm_option("APM2_BETA_HARDWARE" TYPE BOOL DEFINE_ONLY
DESCRIPTION "Is this an APM 2.0 Beta board?"
DEFAULT OFF)
apm_option("APM_PROCESSOR" TYPE STRING
DESCRIPTION "ArduPilotMega processor (2560 for APM2 and later APM1)?"
DEFAULT "mega2560"
OPTIONS "mega" "mega2560")
apm_option("LOGGING_ENABLED" TYPE BOOL
DESCRIPTION "Enable logging?"
DEFAULT OFF)
apm_option("GPS_PROTOCOL" TYPE STRING
DESCRIPTION "GPS protocol?"
DEFAULT "GPS_PROTOCOL_AUTO"
OPTIONS
"GPS_PROTOOCL_NONE"
"GPS_PROTOCOL_AUTO"
"GPS_PROTOCOL_NONE"
"GPS_PROTOCOL_IMU"
"GPS_PROTOCOL_MTK"
"GPS_PROTOCOL_MTK19"
"GPS_PROTOCOL_UBLOX"
"GPS_PROTOCOL_SIRF"
"GPS_PROTOCOL_NMEA")
apm_option("AIRSPEED_SENSOR" TYPE BOOL
DESCRIPTION "Enable airspeed sensor?"
DEFAULT OFF)
apm_option("PITOT_ENABLED" TYPE BOOL
DESCRIPTION "Enable pitot static system?"
DEFAULT OFF)
apm_option("SONAR_ENABLED" TYPE BOOL
DESCRIPTION "Enable sonar?"
DEFAULT OFF)
apm_option("AIRSPEED_RATIO" TYPE STRING ADVANCED
DESCRIPTION "Airspeed ratio?"
DEFAULT "1.9936")
#apm_option("MAGNETOMETER" TYPE BOOL
#DESCRIPTION "Enable airspeed sensor?"
#DEFAULT OFF)
#apm_option("MAG_ORIENTATION" TYPE STRING ADVANCED
#DESCRIPTION "Magnetometer orientation?"
#DEFAULT "AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
#OPTIONS
#"AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
#"AP_COMPASS_COMPONENTS_DOWN_PINS_BACK"
#"AP_COMPASS_COMPONENTS_UP_PINS_FORWARD"
#"AP_COMPASS_COMPONENTS_UP_PINS_BACK")
apm_option("HIL_MODE" TYPE STRING
DESCRIPTION "Hardware-in-the-loop- mode?"
DEFAULT "HIL_MODE_DISABLED"
OPTIONS
"HIL_MODE_DISABLED"
"HIL_MODE_ATTITUDE"
"HIL_MODE_SENSORS")
apm_option("MAV_SYSTEM_ID" TYPE STRING ADVANCED
DESCRIPTION "MAVLink System ID?"
DEFAULT "1")
apm_option("SERIAL0_BAUD" TYPE STRING ADVANCED
DESCRIPTION "Serial 0 baudrate?"
DEFAULT "115200"
OPTIONS "57600" "115200")
apm_option("SERIAL3_BAUD" TYPE STRING ADVANCED
DESCRIPTION "Serial 3 baudrate?"
DEFAULT "57600"
OPTIONS "57600" "115200")
apm_option("BATTERY_EVENT" TYPE BOOL ADVANCED
DESCRIPTION "Enable low voltage/ high discharge warnings?"
DEFAULT OFF)
apm_option("LOW_VOLTAGE" TYPE STRING ADVANCED
DESCRIPTION "Voltage to consider low (volts)?"
DEFAULT "9.6")
apm_option("VOLT_DIV_RATIO" TYPE STRING ADVANCED
DESCRIPTION "Voltage division ratio?"
DEFAULT "3.56")
apm_option("CUR_AMPS_PER_VOLT" TYPE STRING ADVANCED
DESCRIPTION "Current amps/volt?"
DEFAULT "27.32")
apm_option("CUR_AMPS_OFFSET" TYPE STRING ADVANCED
DESCRIPTION "Current amps offset?"
DEFAULT "0.0")
apm_option("HIGH_DISCHARGE" TYPE STRING ADVANCED
DESCRIPTION "What to consider high discharge rate (milliamps)?"
DEFAULT "1760")
apm_option("INPUT_VOLTAGE" TYPE STRING ADVANCED
DESCRIPTION "Voltage measured at the process (V)? (affects ADC measurements)"
DEFAULT "4.68")
set(RADIO_CHANNELS "1" "2" "3" "4" "5" "6" "7" "8")
apm_option("FLIGHT_MODE_CHANNEL" TYPE STRING ADVANCED
DESCRIPTION "The radio channel to control the flight mode."
DEFAULT "8"
OPTIONS ${RADIO_CHANNELS})
set(FLIGHT_MODES
MANUAL STABILIZE
FLY_BY_WIRE_A
FLY_BY_WIRE_B
RTL
AUTO
LOITER CIRCLE)
set(FLIGHT_MODES_RADIO_PWM 1165 1295 1425 1555 1685 1815)
set(FLIGHT_MODES_DEFAULT
RTL
RTL
STABILIZE
STABILIZE
MANUAL
MANUAL)
foreach(MODE 1 2 3 4 5 6)
math(EXPR INDEX "${MODE} -1")
list(GET FLIGHT_MODES_RADIO_PWM ${INDEX} RADIO_PWM)
list(GET FLIGHT_MODES_DEFAULT ${INDEX} FLIGHT_MODE_DEFAULT)
apm_option("FLIGHT_MODE_${MODE}" TYPE STRING ADVANCED
DESCRIPTION "Flight mode ${MODE} (pwm ${RADIO_PWM} ms)?"
DEFAULT "${FLIGHT_MODE_DEFAULT}"
OPTIONS ${FLIGHT_MODES})
endforeach()
#set(FLAP_1_SPEED "0" CACHE STRING "Speed below which flaps are deployed (m/s)?")
#set(FLAP_1_PERCENT "0" CACHE STRING "Flap deployment percentage (%)?")
#set(FLAP_2_SPEED "0" CACHE STRING "Speed below which flaps are deployed (m/s)?")
#set(FLAP_2_PERCENT "0" CACHE STRING "Flap deployment percentage (%)?")
#set(THROTTLE_FAILSAFE "ENABLED" CACHE STRING "Enable throttle shuttoff when radio below failsafe value?")
#set_property(CACHE THROTTLE_FAILSAFE PROPERTY STRINGS ENABLED DISABLED)
#set(THROTTLE_FS_VALUE "950" CACHE STRING "Radio value at which to disable throttle (ms).")
#set(GCS_HEARTBEAT_FAILSAFE "DISABLED" CACHE STRING "Enable failsafe when ground station communication lost?")
#set_property(CACHE GCS_HEARTBEAT_FAILSAFE PROPERTY STRINGS ENABLED DISABLED)
#set(SHORT_FAILSAFE_ACTION "0" CACHE STRING "Failsafe mode RTL, then return to AUTO/LOITER")
#set(LONG_FAILSAFE_ACTION "0" CACHE STRING "Failsafe mode RTL")
#set(AUTO_TRIM "DISABLED" CACHE STRING "Update trim with manual radio input when leaving MANUAL mode?")
#set_property(CACHE AUTO_TRIM PROPERTY STRINGS ENABLED DISABLED)
#set(THROTTLE_REVERSE "DISABLED" CACHE STRING "Reverse throttle output signal?")
#set_property(CACHE THROTTLE_REVERSE PROPERTY STRINGS ENABLED DISABLED)
#set(ENABLE_STICK_MIXING "DISABLED" CACHE STRING "Enable manual input in autopilot modes?")
#set_property(CACHE THROTTLE_REVERSE PROPERTY STRINGS ENABLED DISABLED)
#set(THROTTLE_OUT "ENABLED" CACHE STRING "Disabled throttle output? (useful for debugging)?")
#set_property(CACHE THROTTLE_OUT PROPERTY STRINGS ENABLED DISABLED)
#set(GROUND_START_DELAY "0" CACHE STRING "Delay between power-up and INS calibration (s)?")
#set(ENABLE_AIR_START "DISABLED" CACHE STRING "Enable in-air restart?")
#set_property(CACHE ENABLE_AIR_START PROPERTY STRINGS ENABLED DISABLED)

View File

@ -1,11 +0,0 @@
set(CMAKE_SYSTEM_NAME Arduino)
set(CMAKE_C_COMPILER avr-gcc)
set(CMAKE_CXX_COMPILER avr-g++)
# Add current directory to CMake Module path automatically
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/Platform/Arduino.cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR})
endif()

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +0,0 @@
# packaging settings
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_VENDOR "DIYDRONES")
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.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/../COPYING.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/../README.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_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}")
set(CPACK_SOURCE_GENERATOR "ZIP")
set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_NAME "${FIRMWARE_NAME}")
include(CPack)

View File

@ -1,131 +0,0 @@
# apm_option: options parsing for ardupilotmega
#
# OPTIONS:
# ADVANCED - indicates this option is advaned (hidden in gui unless advanced selected)
# DEFINE_ONLY - this flag is either indicates that the variable is defined if true, and not defined if false
# BUILD_FLAG - this flag forces the variable to be added to build flags, for files that
# don't include the config header
#
# SINGLE INPUT ARGUMENTS: (can only pass one arguments)
# TYPE - the type of the argument (BOOL for on/off variables/ STRING for all others)
# DESCRIPTION - description of option, shown as tool-tip and written in config file
# DEFAULT - the default value of the option
#
# MULTIPLE VARIABLE ARGUMENTS: (can pass a lit of items)
# OPTIONS - values that this option may take, if only a finite set is possible, creates combo-box in gui
# DEPENDS - a list of booleans that this argument depends on, can be used to disable options when the
# are not appropriate
#
# Author: James Goppert
#
function(apm_option NAME)
cmake_parse_arguments(ARG
"ADVANCED;DEFINE_ONLY;BUILD_FLAG"
"TYPE;DESCRIPTION;DEFAULT" "OPTIONS;DEPENDS" ${ARGN})
#message(STATUS "parsing argument: ${NAME}")
# if option dependencies not met, hide the option
foreach(DEPEND ${ARG_DEPENDS})
if (NOT ${${DEPEND}})
#message(STATUS "\tfailed dep: ${DEPEND}")
set(ARG_TYPE "INTERNAL")
set("${NAME}" "${ARG_DEFAULT}" CACHE INTERNAL "${ARG_DESCRIPTION}" FORCE)
return()
endif()
endforeach()
# set variable
set("${NAME}" "${ARG_DEFAULT}" CACHE "${ARG_TYPE}" "${ARG_DESCRIPTION}")
# force variable reinit if it was internal (hidden)
get_property(VAR_TYPE CACHE ${NAME} PROPERTY TYPE)
if ("${VAR_TYPE}" STREQUAL "INTERNAL")
#message(STATUS "\tVAR_TYPE: ${VAR_TYPE}")
set("${NAME}" "${ARG_DEFAULT}" CACHE "${ARG_TYPE}" "${ARG_DESCRIPTION}" FORCE)
# if a build flag, initialize it and add it to the global options list
elseif(${ARG_BUILD_FLAG})
#message(STATUS "build flag found for item ${NAME}")
set(APM_BUILD_FLAGS_LIST ${APM_BUILD_FLAGS_LIST} ${NAME} CACHE INTERNAL "list of all build flags")
list(REMOVE_DUPLICATES APM_BUILD_FLAGS_LIST)
# if not hidden, and not a build flag, add it to the global options list
else()
set(APM_OPTIONS_LIST ${APM_OPTIONS_LIST} ${NAME} CACHE INTERNAL "list of all options")
list(REMOVE_DUPLICATES APM_OPTIONS_LIST)
endif()
# set list of options
if (NOT "${ARG_OPTIONS}" STREQUAL "")
set_property(CACHE "${NAME}" PROPERTY STRINGS ${ARG_OPTIONS})
list(FIND ARG_OPTIONS "${ARG_DEFAULT}" ARG_POSITION)
if (ARG_POSITION EQUAL -1)
message(FATAL_ERROR "default value: ${ARG_DEFAULT} not in given set of options: ${ARG_OPTIONS}")
endif()
endif()
# mark as advanced if advanced option given
if(ARG_ADVANCED)
mark_as_advanced(FORCE "${NAME}")
endif()
if(ARG_DEFINE_ONLY)
set("${NAME}_DEFINE_ONLY" TRUE CACHE INTERNAL "Define only?" FORCE)
else()
set("${NAME}_DEFINE_ONLY" FALSE CACHE INTERNAL "Define only?" FORCE)
endif()
endfunction()
# apm_option_generate_config: generates a config file using the list of options.
#
# SINGLE INPUT ARGUMENTS: (can only pass one arguments)
# FILE - the file to write the config to
# BUILD_FLAGS - variable to store build flags in
#
# Author: James Goppert
#
function(apm_option_generate_config)
cmake_parse_arguments(ARG "" "FILE;BUILD_FLAGS" "" ${ARGN})
# options
if (NOT "${APM_OPTIONS_LIST}" STREQUAL "")
list(REMOVE_DUPLICATES APM_OPTIONS_LIST)
endif()
file (WRITE "${CMAKE_BINARY_DIR}/${ARG_FILE}" "//automatically generated, do not edit\n")
file (APPEND "${CMAKE_BINARY_DIR}/${ARG_FILE}" "#define OFF 0\n#define ON 1\n")
foreach(ITEM ${APM_OPTIONS_LIST})
#message(STATUS "option: ${ITEM}")
get_property(ITEM_VALUE CACHE ${ITEM} PROPERTY VALUE)
get_property(ITEM_HELP CACHE ${ITEM} PROPERTY HELPSTRING)
if (${${ITEM}_DEFINE_ONLY})
if (${ITEM_VALUE})
file(APPEND "${CMAKE_BINARY_DIR}/${ARG_FILE}" "\n#define ${ITEM} // ${ITEM_HELP}")
else()
file(APPEND "${CMAKE_BINARY_DIR}/${ARG_FILE}" "\n//#define ${ITEM} // ${ITEM_HELP}")
endif()
else()
file(APPEND "${CMAKE_BINARY_DIR}/${ARG_FILE}" "\n#define ${ITEM} ${ITEM_VALUE} // ${ITEM_HELP}")
endif()
endforeach()
# build flags
if (NOT "${APM_BUILD_FLAGS_LIST}" STREQUAL "")
list(REMOVE_DUPLICATES APM_BUILD_FLAGS_LIST)
endif()
foreach(ITEM ${APM_BUILD_FLAGS_LIST})
#message(STATUS "build flags: ${ITEM}")
set(${ARG_BUILD_FLAGS} "" CACHE INTERNAL "build flags" FORCE)
get_property(ITEM_VALUE CACHE ${ITEM} PROPERTY VALUE)
if (${${ITEM}_DEFINE_ONLY})
if (${ITEM_VALUE})
set(${ARG_BUILD_FLAGS} ${${ARG_BUILD_FLAGS}} "-D${ITEM}" CACHE INTERNAL "build flags")
endif()
else()
set(${ARG_BUILD_FLAGS} ${${ARG_BUILD_FLAGS}} "-D${ITEM}=${ITEM_VALUE}" CACHE INTERNAL "build flags")
endif()
endforeach()
endfunction()

View File

@ -1,19 +0,0 @@
# - 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

View File

@ -1,144 +0,0 @@
# - 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 a dependency.
# i.e.: the API documentation is built with:
# make doc
#
# USAGE: GLOBAL INSTALL
#
# Install it with:
# cmake ./ && sudo make install
# Add the following to the CMakeLists.txt of your project:
# include(UseDoxygen OPTIONAL)
# Optionally copy Doxyfile.in in the directory of CMakeLists.txt and edit it.
#
# 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.
#
#
# CONFIGURATION
#
# To configure Doxygen you can edit Doxyfile.in and set some variables in cmake.
# Variables you may define are:
# DOXYFILE_SOURCE_DIR - Path where the Doxygen input files are.
# Defaults to the current source directory.
# DOXYFILE_EXTRA_SOURCES - Additional source diretories/files for Doxygen to scan.
# The Paths should be in double quotes and separated by space. e.g.:
# "${CMAKE_CURRENT_BINARY_DIR}/foo.c" "${CMAKE_CURRENT_BINARY_DIR}/bar/"
#
# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored.
# Defaults to "${CMAKE_CURRENT_BINARY_DIR}/doc".
#
# DOXYFILE_LATEX - ON/OFF; Set to "ON" if you want the LaTeX documentation
# to be built.
# DOXYFILE_LATEX_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
# the Doxygen LaTeX output is stored. Defaults to "latex".
#
# DOXYFILE_HTML_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
# the Doxygen html output is stored. Defaults to "html".
#
#
# Copyright (c) 2009, 2010, 2011 Tobias Rautenkranz <tobias@rautenkranz.ch>
#
# 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 type docstring)
if(NOT DEFINED "${name}")
set("${name}" "${value}" CACHE "${type}" "${docstring}")
endif()
endmacro()
find_package(Doxygen)
if(DOXYGEN_FOUND)
find_file(DOXYFILE_IN "Doxyfile.in"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/"
NO_DEFAULT_PATH
DOC "Path to the doxygen configuration template file")
set(DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
endif()
if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc"
PATH "Doxygen output directory")
usedoxygen_set_default(DOXYFILE_HTML_DIR "html"
STRING "Doxygen HTML output directory")
usedoxygen_set_default(DOXYFILE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
PATH "Input files source directory")
usedoxygen_set_default(DOXYFILE_EXTRA_SOURCE_DIRS ""
STRING "Additional source files/directories separated by space")
set(DOXYFILE_SOURCE_DIRS "\"${DOXYFILE_SOURCE_DIR}\" ${DOXYFILE_EXTRA_SOURCES}")
usedoxygen_set_default(DOXYFILE_LATEX YES BOOL "Generate LaTeX API documentation" OFF)
usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex" STRING "LaTex output directory")
mark_as_advanced(DOXYFILE_OUTPUT_DIR DOXYFILE_HTML_DIR DOXYFILE_LATEX_DIR
DOXYFILE_SOURCE_DIR DOXYFILE_EXTRA_SOURCE_DIRS DOXYFILE_IN)
set_property(DIRECTORY
APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
add_custom_target(doxygen
COMMAND "${DOXYGEN_EXECUTABLE}"
"${DOXYFILE}"
COMMENT "Writing documentation to ${DOXYFILE_OUTPUT_DIR}..."
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
set(DOXYFILE_DOT "NO")
if(DOXYGEN_DOT_EXECUTABLE)
set(DOXYFILE_DOT "YES")
endif()
## LaTeX
set(DOXYFILE_PDFLATEX "NO")
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
if(DOXYFILE_LATEX STREQUAL "ON")
set(DOXYFILE_GENERATE_LATEX "YES")
find_package(LATEX)
find_program(DOXYFILE_MAKE make)
mark_as_advanced(DOXYFILE_MAKE)
if(LATEX_COMPILER AND MAKEINDEX_COMPILER AND DOXYFILE_MAKE)
if(PDFLATEX_COMPILER)
set(DOXYFILE_PDFLATEX "YES")
endif()
add_custom_command(TARGET doxygen
POST_BUILD
COMMAND "${DOXYFILE_MAKE}"
COMMENT "Running LaTeX for Doxygen documentation in ${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}..."
WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
else()
set(DOXYGEN_LATEX "NO")
endif()
else()
set(DOXYFILE_GENERATE_LATEX "NO")
endif()
configure_file("${DOXYFILE_IN}" "${DOXYFILE}" @ONLY)
get_target_property(DOC_TARGET doc TYPE)
if(NOT DOC_TARGET)
add_custom_target(doc)
endif()
add_dependencies(doc doxygen)
endif()

View File

@ -1,4 +0,0 @@
#!/bin/bash
git clone git://github.com/jgoppert/arduino-cmake.git tmp
cp -rf tmp/cmake/* .
rm -rf tmp