Worked on ArduCopter cmake options.

This commit is contained in:
James Goppert 2012-04-19 16:05:08 -04:00
parent ba89f39781
commit 5390467f3d
4 changed files with 38 additions and 42 deletions

View File

@ -16,10 +16,13 @@ include(CMakeParseArguments)
include(APMOption)
# options
add_definitions(-DUSE_CMAKE_APM_CONFIG)
include(options.cmake)
include_directories(${CMAKE_BINARY_DIR})
apm_option_generate_config(FILE "APM_Config_cmake.h" OPTIONS ${APM_OPTIONS})
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)
@ -28,7 +31,7 @@ Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME}
# built variables
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(FIRMWARE_NAME "${PROJECT_NAME}-${APM_HARDWARE}-${APM_PROCESSOR}-${HIL_MODE}")
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")

View File

@ -30,9 +30,9 @@ apm_option("APM_PROCESSOR" TYPE STRING
DEFAULT "mega2560"
OPTIONS "mega" "mega2560")
apm_option("CLI_SLIDER_ENABLED" TYPE BOOL
DESCRIPTION "Enable command line interface switch?"
DEFAULT OFF)
#apm_option("CLI_SLIDER_ENABLED" TYPE BOOL
#DESCRIPTION "Enable command line interface switch?"
#DEFAULT OFF)
apm_option("LOGGING_ENABLED" TYPE BOOL
DESCRIPTION "Enable logging?"
@ -60,22 +60,30 @@ 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("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("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?"
@ -85,31 +93,11 @@ apm_option("HIL_MODE" TYPE STRING
"HIL_MODE_ATTITUDE"
"HIL_MODE_SENSORS")
apm_option("HIL_PORT" TYPE STRING
DESCRIPTION "Port for Hardware-in-the-loop communication"
DEFAULT "0"
OPTIONS "0" "1" "2" "3")
apm_option("HIL_PROTOCOL" TYPE STRING
DESCRIPTION "Hardware-in-the-loop protocol?"
DEFAULT "HIL_PROTOCOL_MAVLINK"
OPTIONS "HIL_PROTOCOL_MAVLINK" "HIL_PROTOCOL_XPLANE")
apm_option("GCS_PROTOCOL" TYPE STRING
DESCRIPTION "Ground station protocol?"
DEFAULT "GCS_PROTOCOL_MAVLINK"
OPTIONS "GCS_PROTOCOL_NONE" "GCS_PROTOCOL_MAVLINK")
apm_option("GCS_PORT" TYPE STRING ADVANCED
DESCRIPTION "Ground station port?"
DEFAULT "3"
OPTIONS "0" "1" "2" "3")
apm_option("MAV_SYSTEM_ID" TYPE STRING ADVANCED
DESCRIPTION "MAVLink System ID?"
DEFAULT "1")
apm_option("MAVLINKV10" TYPE BOOL DEFINE_ONLY
apm_option("MAVLINK10" TYPE BOOL DEFINE_ONLY BUILD_FLAG
DESCRIPTION "Use mavlink version 1.0?"
DEFAULT OFF)
@ -159,7 +147,7 @@ apm_option("FRAME_CONFIG" TYPE STRING
apm_option("FRAME_ORIENTATION" TYPE STRING
DESCRIPTION "Vehicle type?"
DEFAULT "QUAD_FRAME"
DEFAULT "PLUS_FRAME"
OPTIONS
"PLUS_FRAME"
"X_FRAME"

View File

@ -38,7 +38,7 @@ apm_option("LOGGING_ENABLED" TYPE BOOL
DESCRIPTION "Enable logging?"
DEFAULT OFF)
apm_option("QUATERNION_ENABLE" TYPE BOOL
apm_option("QUATERNION_ENABLE" TYPE BOOL ADVANCED
DESCRIPTION "Enable quaterion navigation?"
DEFAULT OFF)

View File

@ -91,7 +91,9 @@ function(apm_option_generate_config)
cmake_parse_arguments(ARG "" "FILE;BUILD_FLAGS" "" ${ARGN})
# options
list(REMOVE_DUPLICATES APM_OPTIONS_LIST)
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})
@ -110,9 +112,12 @@ function(apm_option_generate_config)
endforeach()
# build flags
list(REMOVE_DUPLICATES APM_BUILD_FLAGS_LIST)
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})