mirror of https://github.com/ArduPilot/ardupilot
Switched to project specific cmake lists.
This is better since each project has very different options.
This commit is contained in:
parent
ee84a6d301
commit
26e3d6ae45
|
@ -0,0 +1,18 @@
|
|||
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 "3")
|
||||
set(PROJECT_VERSION_PATCH "3")
|
||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||
|
||||
set(PROJECT_DESCRIPTION "ArduPilotMega based Quadrotor Autopilot.")
|
||||
|
||||
# macro path
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")
|
||||
|
||||
# common project setup
|
||||
include(APMProject)
|
|
@ -0,0 +1,121 @@
|
|||
# options
|
||||
apm_option("APM_PROGRAMMING_PORT" TYPE STRING
|
||||
DESCRIPTION "Programming upload port?"
|
||||
DEFAULT "/dev/ttyUSB0")
|
||||
|
||||
apm_option("APM_BOARD" TYPE STRING
|
||||
DESCRIPTION "ArduPilotMega board?"
|
||||
DEFAULT "mega2560"
|
||||
OPTIONS "mega" "mega2560")
|
||||
|
||||
apm_option("APM_FRAME" TYPE STRING
|
||||
DESCRIPTION "Vehicle type?"
|
||||
DEFAULT "PLANE_FRAME"
|
||||
OPTIONS
|
||||
"PLANE FRAME"
|
||||
"HELI_FRAME"
|
||||
"HEXA_FRAME"
|
||||
"OCTA_FRAME"
|
||||
"Y6_FRAME"
|
||||
)
|
||||
|
||||
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_MTK16"
|
||||
"GPS_PROTOCOL_UBLOX"
|
||||
"GPS_PROTOCOL_SIRF"
|
||||
"GPS_PROTOCOL_NMEA")
|
||||
|
||||
apm_option("AIRSPEED_SENSOR" TYPE BOOL
|
||||
DESCRIPTION "Enable airspeed sensor?"
|
||||
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("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("GPS_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?"
|
||||
DESCRIPTION "3"
|
||||
OPTIONS "0" "1" "2" "3")
|
||||
|
||||
apm_option("MAV_SYSTEM_ID" TYPE STRING ADVANCED
|
||||
DESCRIPTION "MAVLink System ID?"
|
||||
DESCRIPTION "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("CUR_AMPS_OFFSET" TYPE STRING ADVANCED
|
||||
DESCRIPTION "Current amps offset?"
|
||||
DEFAULT "0.0")
|
|
@ -1,73 +1,18 @@
|
|||
set(CMAKE_TOOLCHAIN_FILE cmake/ArduinoToolchain.cmake) # Arduino Toolchain
|
||||
set(CMAKE_TOOLCHAIN_FILE ../cmake/ArduinoToolchain.cmake) # Arduino Toolchain
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(ArduPilotMega C CXX)
|
||||
project(ArduPlane C CXX)
|
||||
|
||||
# set these for release
|
||||
set(PROJECT_VERSION_MAJOR "2")
|
||||
set(PROJECT_VERSION_MINOR "3")
|
||||
set(PROJECT_VERSION_PATCH "3")
|
||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||
|
||||
set(PROJECT_DESCRIPTION "ArduPilotMega based Airplane Autopilot.")
|
||||
|
||||
# macro path
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")
|
||||
|
||||
# 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.")
|
||||
|
||||
# macros
|
||||
include(CMakeParseArguments)
|
||||
include(APMOption)
|
||||
|
||||
# options
|
||||
apm_option("APM_PROGRAMMING_PORT" TYPE STRING
|
||||
DESCRIPTION "Programming upload port?"
|
||||
DEFAULT "/dev/ttyUSB0")
|
||||
|
||||
apm_option("APM_BOARD" TYPE STRING
|
||||
DESCRIPTION "ArduPilotMega board?"
|
||||
DEFAULT "mega2560"
|
||||
OPTIONS "mega" "mega2560")
|
||||
|
||||
apm_option("APM_PROJECT" TYPE STRING
|
||||
DESCRIPTION "ArduPilotMega project to build?"
|
||||
DEFAULT "ArduPlane"
|
||||
OPTIONS "ArduPlane" "ArduCopter")
|
||||
|
||||
include(options.cmake)
|
||||
|
||||
# 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(${APM_PROJECT}_SKETCH ${CMAKE_SOURCE_DIR}/${APM_PROJECT})
|
||||
set(${APM_PROJECT}_BOARD ${APM_BOARD})
|
||||
set(${APM_PROJECT}_PORT ${APM_PROGRAMMING_PORT})
|
||||
generate_arduino_firmware(${APM_PROJECT})
|
||||
|
||||
# packaging settings
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A universal autopilot system for the ArduPilotMega board.")
|
||||
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 "${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}")
|
||||
set(CPACK_SOURCE_GENERATOR "ZIP")
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
set(CPACK_PACKAGE_NAME "${APM_PROJECT}_${BOARD}_${HIL_MODE}")
|
||||
include(CPack)
|
||||
# common project setup
|
||||
include(APMProject)
|
||||
|
|
|
@ -4,19 +4,17 @@
|
|||
#option(CLI_SLIDER "Command-line-interface slider support?" OFF)
|
||||
#option(APM2 "Build for APM 2.0" OFF)
|
||||
|
||||
# set booleans for project
|
||||
foreach(PROJECT_NAME "ArduPlane;ArduCopter")
|
||||
if ("${APM_PROJECT}" STREQUAL "${PROJECT_NAME}")
|
||||
set(IS_${PROJECT_NAME} true)
|
||||
else()
|
||||
set(IS_${PROJECT_NAME} false)
|
||||
endif()
|
||||
endforeach()
|
||||
# options
|
||||
apm_option("APM_PROGRAMMING_PORT" TYPE STRING
|
||||
DESCRIPTION "Programming upload port?"
|
||||
DEFAULT "/dev/ttyUSB0")
|
||||
|
||||
apm_option("APM_BOARD" TYPE STRING
|
||||
DESCRIPTION "ArduPilotMega board?"
|
||||
DEFAULT "mega2560"
|
||||
OPTIONS "mega" "mega2560")
|
||||
|
||||
if (IS_ARDUCOPTER)
|
||||
endif()
|
||||
apm_option("APM_FRAME" TYPE STRING
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Vehicle type?"
|
||||
DEFAULT "PLANE_FRAME"
|
||||
OPTIONS
|
||||
|
@ -28,7 +26,6 @@ apm_option("APM_FRAME" TYPE STRING
|
|||
)
|
||||
|
||||
apm_option("GPS_PROTOCOL" TYPE STRING
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "GPS protocol?"
|
||||
DEFAULT "GPS_PROTOCOL_AUTO"
|
||||
OPTIONS
|
||||
|
@ -43,22 +40,18 @@ apm_option("GPS_PROTOCOL" TYPE STRING
|
|||
"GPS_PROTOCOL_NMEA")
|
||||
|
||||
apm_option("AIRSPEED_SENSOR" TYPE BOOL
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Enable airspeed sensor?"
|
||||
DEFAULT OFF)
|
||||
|
||||
apm_option("AIRSPEED_RATIO" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Airspeed ratio?"
|
||||
DEFAULT "1.9936")
|
||||
|
||||
apm_option("MAGNETOMETER" TYPE BOOL
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Enable airspeed sensor?"
|
||||
DEFAULT OFF)
|
||||
|
||||
apm_option("MAG_ORIENTATION" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Magnetometer orientation?"
|
||||
DEFAULT "AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD"
|
||||
OPTIONS
|
||||
|
@ -68,7 +61,6 @@ apm_option("MAG_ORIENTATION" TYPE STRING ADVANCED
|
|||
"AP_COMPASS_COMPONENTS_UP_PINS_BACK")
|
||||
|
||||
apm_option("HIL_MODE" TYPE STRING
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Hardware-in-the-loop- mode?"
|
||||
DEFAULT "HIL_MODE_DISABLED"
|
||||
OPTIONS
|
||||
|
@ -77,73 +69,60 @@ apm_option("HIL_MODE" TYPE STRING
|
|||
"HIL_MODE_SENSORS")
|
||||
|
||||
apm_option("HIL_PORT" TYPE STRING
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Port for Hardware-in-the-loop communication"
|
||||
DEFAULT "0"
|
||||
OPTIONS "0" "1" "2" "3")
|
||||
|
||||
apm_option("HIL_PROTOCOL" TYPE STRING
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Hardware-in-the-loop protocol?"
|
||||
DEFAULT "HIL_PROTOCOL_MAVLINK"
|
||||
OPTIONS "HIL_PROTOCOL_MAVLINK" "HIL_PROTOCOL_XPLANE")
|
||||
|
||||
apm_option("GPS_PROTOCOL" TYPE STRING
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Ground station protocol?"
|
||||
DEFAULT "GCS_PROTOCOL_MAVLINK"
|
||||
OPTIONS "GCS_PROTOCOL_NONE" "GCS_PROTOCOL_MAVLINK")
|
||||
|
||||
apm_option("GCS_PORT" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Ground station port?"
|
||||
DESCRIPTION "3"
|
||||
OPTIONS "0" "1" "2" "3")
|
||||
|
||||
apm_option("MAV_SYSTEM_ID" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "MAVLink System ID?"
|
||||
DESCRIPTION "1")
|
||||
|
||||
apm_option("SERIAL0_BAUD" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Serial 0 baudrate?"
|
||||
DEFAULT "115200"
|
||||
OPTIONS "57600" "115200")
|
||||
|
||||
apm_option("SERIAL3_BAUD" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Serial 3 baudrate?"
|
||||
DEFAULT "57600"
|
||||
OPTIONS "57600" "115200")
|
||||
|
||||
apm_option("BATTERY_EVENT" TYPE BOOL ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Enable low voltage/ high discharge warnings?"
|
||||
DEFAULT OFF)
|
||||
|
||||
apm_option("LOW_VOLTAGE" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Voltage to consider low (volts)?"
|
||||
DEFAULT "9.6")
|
||||
|
||||
apm_option("VOLT_DIV_RATIO" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Voltage division ratio?"
|
||||
DEFAULT "3.56")
|
||||
|
||||
apm_option("CUR_AMPS_PER_VOLT" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Current amps/volt?"
|
||||
DEFAULT "27.32")
|
||||
|
||||
apm_option("CUR_AMPS_OFFSET" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Current amps offset?"
|
||||
DEFAULT "0.0")
|
||||
|
||||
apm_option("CUR_AMPS_OFFSET" TYPE STRING ADVANCED
|
||||
DEPENDS IS_ARDUPLANE
|
||||
DESCRIPTION "Current amps offset?"
|
||||
DEFAULT "0.0")
|
||||
|
||||
|
|
12
README.txt
12
README.txt
|
@ -13,17 +13,17 @@ Building using make
|
|||
|
||||
Building using cmake
|
||||
-----------------------------------------------
|
||||
- cd ArduPlane (ArduCopter etc ..)
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -DBOARD=mega -DPORT=/dev/ttyUSB0
|
||||
- cmake .. -DAPM_BOARD=mega -DAPM_PORT=/dev/ttyUSB0
|
||||
You can select from mega/mega2560.
|
||||
If you have arduino installed in a non-standard location you by specify it by using:
|
||||
-DARDUINO_SDK_PATH=/path/to/arduino ..
|
||||
- make (will build every sketch)
|
||||
- make ArduPlane (will build just ArduPlane etc.)
|
||||
- make ArduPloat-upload (will upload the sketch)
|
||||
- make (will build the sketch)
|
||||
- make ArduPlane-upload (will upload the sketch ArduPlane etc.)
|
||||
|
||||
If you have a sync error during upload reset the board/power cycle the board
|
||||
If you have a sync error during upload reset the board or power cycle the board
|
||||
before the upload starts.
|
||||
|
||||
|
||||
|
@ -42,6 +42,8 @@ Building using eclipse
|
|||
cd /home/name/apm-build
|
||||
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ../apm-src -D BOARD=mega -D PORT=/dev/ttyUSB0
|
||||
|
||||
Here apm-src can be any sketch, ArduPlane/ ArduCopter etc.
|
||||
|
||||
Note: Unix can be substituted for MinGW/ MSYS/ NMake (for windows)
|
||||
(see http://www.vtk.org/Wiki/Eclipse_CDT4_Generator)
|
||||
|
||||
|
|
|
@ -454,7 +454,7 @@ function(find_arduino_libraries VAR_NAME SRCS)
|
|||
get_property(LIBRARY_SEARCH_PATH
|
||||
DIRECTORY # Property Scope
|
||||
PROPERTY LINK_DIRECTORIES)
|
||||
foreach(LIB_SEARCH_PATH ${LIBRARY_SEARCH_PATH} ${ARDUINO_LIBRARIES_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libraries)
|
||||
foreach(LIB_SEARCH_PATH ${LIBRARY_SEARCH_PATH} ${ARDUINO_LIBRARIES_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libraries ${ARDUINO_EXTRA_LIBRARIES_PATH})
|
||||
if(EXISTS ${LIB_SEARCH_PATH}/${INCLUDE_NAME}/${CMAKE_MATCH_1})
|
||||
list(APPEND ARDUINO_LIBS ${LIB_SEARCH_PATH}/${INCLUDE_NAME})
|
||||
break()
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
set(CMAKE_TOOLCHAIN_FILE cmake/ArduinoToolchain.cmake) # Arduino Toolchain
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(ArduPilotMega C CXX)
|
||||
|
||||
# set these for release
|
||||
set(PROJECT_VERSION_MAJOR "2")
|
||||
set(PROJECT_VERSION_MINOR "3")
|
||||
set(PROJECT_VERSION_PATCH "3")
|
||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||
|
||||
|
||||
# macro path
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
|
||||
|
||||
# disallow in-source build
|
||||
include(MacroEnsureOutOfSourceBuild)
|
||||
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build.
|
||||
|
@ -24,21 +8,7 @@ include(CMakeParseArguments)
|
|||
include(APMOption)
|
||||
|
||||
# options
|
||||
apm_option("APM_PROGRAMMING_PORT" TYPE STRING
|
||||
DESCRIPTION "Programming upload port?"
|
||||
DEFAULT "/dev/ttyUSB0")
|
||||
|
||||
apm_option("APM_BOARD" TYPE STRING
|
||||
DESCRIPTION "ArduPilotMega board?"
|
||||
DEFAULT "mega2560"
|
||||
OPTIONS "mega" "mega2560")
|
||||
|
||||
apm_option("APM_PROJECT" TYPE STRING
|
||||
DESCRIPTION "ArduPilotMega project to build?"
|
||||
DEFAULT "ArduPlane"
|
||||
OPTIONS "ArduPlane" "ArduCopter")
|
||||
|
||||
include(cmake/options-ArduPlane.cmake)
|
||||
include(options.cmake)
|
||||
|
||||
# modify flags from default toolchain flags
|
||||
set(APM_OPT_FLAGS "-Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat=2")
|
||||
|
@ -47,19 +17,20 @@ 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(${APM_PROJECT}_SKETCH ${CMAKE_SOURCE_DIR}/${APM_PROJECT})
|
||||
set(${APM_PROJECT}_BOARD ${APM_BOARD})
|
||||
set(${APM_PROJECT}_PORT ${APM_PROGRAMMING_PORT})
|
||||
generate_arduino_firmware(${APM_PROJECT})
|
||||
set(ARDUINO_EXTRA_LIBRARIES_PATH ${CMAKE_SOURCE_DIR}/../libraries)
|
||||
set(${PROJECT_NAME}_SKETCH ${CMAKE_SOURCE_DIR}/../${PROJECT_NAME})
|
||||
set(${PROJECT_NAME}_BOARD ${APM_BOARD})
|
||||
set(${PROJECT_NAME}_PORT ${APM_PROGRAMMING_PORT})
|
||||
generate_arduino_firmware(${PROJECT_NAME})
|
||||
|
||||
# packaging settings
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A universal autopilot system for the ArduPilotMega board.")
|
||||
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_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 "${APPLICATION_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${APPLICATION_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${APPLICATION_VERSION_PATCH}")
|
Loading…
Reference in New Issue