mirror of https://github.com/ArduPilot/ardupilot
Worked on ArduCopter cmake options.
This commit is contained in:
parent
ba89f39781
commit
5390467f3d
|
@ -16,10 +16,13 @@ include(CMakeParseArguments)
|
||||||
include(APMOption)
|
include(APMOption)
|
||||||
|
|
||||||
# options
|
# options
|
||||||
add_definitions(-DUSE_CMAKE_APM_CONFIG)
|
|
||||||
include(options.cmake)
|
include(options.cmake)
|
||||||
include_directories(${CMAKE_BINARY_DIR})
|
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
|
# disallow in-source build
|
||||||
include(MacroEnsureOutOfSourceBuild)
|
include(MacroEnsureOutOfSourceBuild)
|
||||||
|
@ -28,7 +31,7 @@ Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME}
|
||||||
|
|
||||||
# built variables
|
# built variables
|
||||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
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
|
# modify flags from default toolchain flags
|
||||||
set(APM_OPT_FLAGS "-Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2")
|
set(APM_OPT_FLAGS "-Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2")
|
||||||
|
|
|
@ -30,9 +30,9 @@ apm_option("APM_PROCESSOR" TYPE STRING
|
||||||
DEFAULT "mega2560"
|
DEFAULT "mega2560"
|
||||||
OPTIONS "mega" "mega2560")
|
OPTIONS "mega" "mega2560")
|
||||||
|
|
||||||
apm_option("CLI_SLIDER_ENABLED" TYPE BOOL
|
#apm_option("CLI_SLIDER_ENABLED" TYPE BOOL
|
||||||
DESCRIPTION "Enable command line interface switch?"
|
#DESCRIPTION "Enable command line interface switch?"
|
||||||
DEFAULT OFF)
|
#DEFAULT OFF)
|
||||||
|
|
||||||
apm_option("LOGGING_ENABLED" TYPE BOOL
|
apm_option("LOGGING_ENABLED" TYPE BOOL
|
||||||
DESCRIPTION "Enable logging?"
|
DESCRIPTION "Enable logging?"
|
||||||
|
@ -60,22 +60,30 @@ apm_option("AIRSPEED_SENSOR" TYPE BOOL
|
||||||
DESCRIPTION "Enable airspeed sensor?"
|
DESCRIPTION "Enable airspeed sensor?"
|
||||||
DEFAULT OFF)
|
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
|
apm_option("AIRSPEED_RATIO" TYPE STRING ADVANCED
|
||||||
DESCRIPTION "Airspeed ratio?"
|
DESCRIPTION "Airspeed ratio?"
|
||||||
DEFAULT "1.9936")
|
DEFAULT "1.9936")
|
||||||
|
|
||||||
apm_option("MAGNETOMETER" TYPE BOOL
|
#apm_option("MAGNETOMETER" TYPE BOOL
|
||||||
DESCRIPTION "Enable airspeed sensor?"
|
#DESCRIPTION "Enable airspeed sensor?"
|
||||||
DEFAULT OFF)
|
#DEFAULT OFF)
|
||||||
|
|
||||||
apm_option("MAG_ORIENTATION" TYPE STRING ADVANCED
|
#apm_option("MAG_ORIENTATION" TYPE STRING ADVANCED
|
||||||
DESCRIPTION "Magnetometer orientation?"
|
#DESCRIPTION "Magnetometer orientation?"
|
||||||
DEFAULT "AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
|
#DEFAULT "AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
|
||||||
OPTIONS
|
#OPTIONS
|
||||||
"AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
|
#"AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
|
||||||
"AP_COMPASS_COMPONENTS_DOWN_PINS_BACK"
|
#"AP_COMPASS_COMPONENTS_DOWN_PINS_BACK"
|
||||||
"AP_COMPASS_COMPONENTS_UP_PINS_FORWARD"
|
#"AP_COMPASS_COMPONENTS_UP_PINS_FORWARD"
|
||||||
"AP_COMPASS_COMPONENTS_UP_PINS_BACK")
|
#"AP_COMPASS_COMPONENTS_UP_PINS_BACK")
|
||||||
|
|
||||||
apm_option("HIL_MODE" TYPE STRING
|
apm_option("HIL_MODE" TYPE STRING
|
||||||
DESCRIPTION "Hardware-in-the-loop- mode?"
|
DESCRIPTION "Hardware-in-the-loop- mode?"
|
||||||
|
@ -85,31 +93,11 @@ apm_option("HIL_MODE" TYPE STRING
|
||||||
"HIL_MODE_ATTITUDE"
|
"HIL_MODE_ATTITUDE"
|
||||||
"HIL_MODE_SENSORS")
|
"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
|
apm_option("MAV_SYSTEM_ID" TYPE STRING ADVANCED
|
||||||
DESCRIPTION "MAVLink System ID?"
|
DESCRIPTION "MAVLink System ID?"
|
||||||
DEFAULT "1")
|
DEFAULT "1")
|
||||||
|
|
||||||
apm_option("MAVLINKV10" TYPE BOOL DEFINE_ONLY
|
apm_option("MAVLINK10" TYPE BOOL DEFINE_ONLY BUILD_FLAG
|
||||||
DESCRIPTION "Use mavlink version 1.0?"
|
DESCRIPTION "Use mavlink version 1.0?"
|
||||||
DEFAULT OFF)
|
DEFAULT OFF)
|
||||||
|
|
||||||
|
@ -159,7 +147,7 @@ apm_option("FRAME_CONFIG" TYPE STRING
|
||||||
|
|
||||||
apm_option("FRAME_ORIENTATION" TYPE STRING
|
apm_option("FRAME_ORIENTATION" TYPE STRING
|
||||||
DESCRIPTION "Vehicle type?"
|
DESCRIPTION "Vehicle type?"
|
||||||
DEFAULT "QUAD_FRAME"
|
DEFAULT "PLUS_FRAME"
|
||||||
OPTIONS
|
OPTIONS
|
||||||
"PLUS_FRAME"
|
"PLUS_FRAME"
|
||||||
"X_FRAME"
|
"X_FRAME"
|
||||||
|
|
|
@ -38,7 +38,7 @@ apm_option("LOGGING_ENABLED" TYPE BOOL
|
||||||
DESCRIPTION "Enable logging?"
|
DESCRIPTION "Enable logging?"
|
||||||
DEFAULT OFF)
|
DEFAULT OFF)
|
||||||
|
|
||||||
apm_option("QUATERNION_ENABLE" TYPE BOOL
|
apm_option("QUATERNION_ENABLE" TYPE BOOL ADVANCED
|
||||||
DESCRIPTION "Enable quaterion navigation?"
|
DESCRIPTION "Enable quaterion navigation?"
|
||||||
DEFAULT OFF)
|
DEFAULT OFF)
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,9 @@ function(apm_option_generate_config)
|
||||||
cmake_parse_arguments(ARG "" "FILE;BUILD_FLAGS" "" ${ARGN})
|
cmake_parse_arguments(ARG "" "FILE;BUILD_FLAGS" "" ${ARGN})
|
||||||
|
|
||||||
# options
|
# options
|
||||||
|
if (NOT "${APM_OPTIONS_LIST}" STREQUAL "")
|
||||||
list(REMOVE_DUPLICATES APM_OPTIONS_LIST)
|
list(REMOVE_DUPLICATES APM_OPTIONS_LIST)
|
||||||
|
endif()
|
||||||
file (WRITE "${CMAKE_BINARY_DIR}/${ARG_FILE}" "//automatically generated, do not edit\n")
|
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")
|
file (APPEND "${CMAKE_BINARY_DIR}/${ARG_FILE}" "#define OFF 0\n#define ON 1\n")
|
||||||
foreach(ITEM ${APM_OPTIONS_LIST})
|
foreach(ITEM ${APM_OPTIONS_LIST})
|
||||||
|
@ -110,9 +112,12 @@ function(apm_option_generate_config)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# build flags
|
# build flags
|
||||||
|
if (NOT "${APM_BUILD_FLAGS_LIST}" STREQUAL "")
|
||||||
list(REMOVE_DUPLICATES APM_BUILD_FLAGS_LIST)
|
list(REMOVE_DUPLICATES APM_BUILD_FLAGS_LIST)
|
||||||
|
endif()
|
||||||
foreach(ITEM ${APM_BUILD_FLAGS_LIST})
|
foreach(ITEM ${APM_BUILD_FLAGS_LIST})
|
||||||
#message(STATUS "build flags: ${ITEM}")
|
#message(STATUS "build flags: ${ITEM}")
|
||||||
|
set(${ARG_BUILD_FLAGS} "" CACHE INTERNAL "build flags" FORCE)
|
||||||
get_property(ITEM_VALUE CACHE ${ITEM} PROPERTY VALUE)
|
get_property(ITEM_VALUE CACHE ${ITEM} PROPERTY VALUE)
|
||||||
if (${${ITEM}_DEFINE_ONLY})
|
if (${${ITEM}_DEFINE_ONLY})
|
||||||
if (${ITEM_VALUE})
|
if (${ITEM_VALUE})
|
||||||
|
|
Loading…
Reference in New Issue