* [TravisCI] Build using avr-gcc 4.9.2 (up from 4.8.2). Relies on https://github.com/opentx/opentx/pull/4169 . Fixes all linker warnings, makes clean build. * [build] Add ARM/AVR compiler version check/display and a workaround for avr-gcc linker warnings when using WARNINGS_AS_ERRORS=true. * [TravisCI] Enable -Werror on all build targets (WARNINGS_AS_ERRORS=true). * [build] CMake script updates: Enable WARNINGS_AS_ERRORS option for all targets (not just firmware); Consolidate some C/CXX flag settings for firmware target, avoid duplication/redundancy; All warning flags are now passed to linker (GCC only); Add a "build report" for each main target showing compiler, flags, and defines, with verbosity controlled by new VERBOSE_CMAKELISTS option; Added properties to PCB, TRANSLATIONS, and a few other options (makes option selector lists in cmake-gui); Add macro for conditionally adding C++11 flag; Silence CMake >3.0 warnings about CMP0054 policy not being set; Reverts AVR linker -Werror workaround; Misc. cleanup/consolidation. * [build] More CMakeLists updates: Silence superfluous "CRT_SECURE" series MSVC warnings; Formalize finding pthread lib/dll on MSVC builds and fix some issues with install target script; Add property string lists to more options; Quotes some paths with possible spaces, & other minor cosmetics. * [build] firmware/bootloader: Remove remaining CMake default compiler flags and add FIRMWARE_C[XX}_FLAGS[_DEBUG] options for user to specify additional flags. Also move ASM language call to silence CMake warning w/MSVC. * [build] Workaround bogus "uninitialized" warnings from AVR linker. * [tests] Add custom printer for less verbose gtest output (use --verbose option to revert to gtest default). * [build] Use less verbose CMake output for TravisCI builds. Formalize search for gtest code and enable gtests target on WIN32-GCC. Minor language fix.
104 lines
3.2 KiB
CMake
104 lines
3.2 KiB
CMake
set(LUA "NO" CACHE STRING "Lua scripts (YES/NO/NO_MODEL_SCRIPTS)")
|
|
set_property(CACHE LUA PROPERTY STRINGS YES NO NO_MODEL_SCRIPTS)
|
|
set(LUA_SCRIPT_LOAD_MODE "" CACHE STRING "Script loading mode and compilation flags [btTxcd] (see loadScript() API docs). Blank for default ('bt' on radio, 'T' on SIMU/DEBUG builds)")
|
|
set(USB "JOYSTICK" CACHE STRING "USB option (JOYSTICK/MASSSTORAGE/SERIAL)")
|
|
set_property(CACHE USB PROPERTY STRINGS JOYSTICK MASSSTORAGE SERIAL)
|
|
option(LUA_COMPILER "Pre-compile and save Lua scripts" OFF)
|
|
|
|
set(ARCH ARM)
|
|
set(STM32USB_DIR ${THIRDPARTY_DIR}/STM32_USB-Host-Device_Lib_V2.2.0/Libraries)
|
|
add_definitions(-DSTM32 -DLUA_INPUTS -DVARIO -DSBUS -DCROSSFIRE)
|
|
include_directories(${RADIO_SRC_DIRECTORY}/targets/common/arm/stm32)
|
|
include_directories(${STM32USB_DIR}/STM32_USB_OTG_Driver/inc)
|
|
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Core/inc)
|
|
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/msc/inc)
|
|
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/hid/inc)
|
|
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/cdc/inc)
|
|
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Core/inc/)
|
|
include_directories(${STM32USB_DIR}/STM32_USB_OTG_Driver/inc)
|
|
set(STM32USB_SRC
|
|
STM32_USB_OTG_Driver/src/usb_core.c
|
|
STM32_USB_OTG_Driver/src/usb_dcd.c
|
|
STM32_USB_OTG_Driver/src/usb_dcd_int.c
|
|
STM32_USB_Device_Library/Core/src/usbd_core.c
|
|
STM32_USB_Device_Library/Core/src/usbd_ioreq.c
|
|
STM32_USB_Device_Library/Core/src/usbd_req.c
|
|
)
|
|
set(TARGET_SRC
|
|
${TARGET_SRC}
|
|
../common/arm/stm32/rtc_driver.cpp
|
|
../common/arm/stm32/cpu_id.cpp
|
|
${SERIAL2_DRIVER}
|
|
)
|
|
set(FIRMWARE_TARGET_SRC
|
|
${FIRMWARE_TARGET_SRC}
|
|
../common/arm/stm32/delays.cpp
|
|
../common/arm/stm32/usb_bsp.c
|
|
../common/arm/stm32/usbd_desc.c
|
|
../common/arm/stm32/usbd_usr.cpp
|
|
../common/arm/stm32/usb_driver.c
|
|
)
|
|
if(USB STREQUAL SERIAL)
|
|
add_definitions(-DUSB_SERIAL)
|
|
set(FIRMWARE_TARGET_SRC
|
|
${FIRMWARE_TARGET_SRC}
|
|
../common/arm/stm32/usbd_cdc.cpp
|
|
)
|
|
set(STM32USB_SRC
|
|
${STM32USB_SRC}
|
|
STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c
|
|
)
|
|
elseif(USB STREQUAL MASSSTORAGE)
|
|
add_definitions(-DUSB_MASS_STORAGE)
|
|
set(STM32USB_SRC
|
|
${STM32USB_SRC}
|
|
STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
|
|
STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c
|
|
STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c
|
|
STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
|
|
)
|
|
set(FIRMWARE_TARGET_SRC
|
|
${FIRMWARE_TARGET_SRC}
|
|
../common/arm/stm32/usbd_storage_msd.cpp
|
|
)
|
|
else()
|
|
add_definitions(-DUSB_JOYSTICK)
|
|
set(FIRMWARE_TARGET_SRC
|
|
${FIRMWARE_TARGET_SRC}
|
|
../common/arm/stm32/usbd_hid_joystick.c
|
|
)
|
|
endif()
|
|
if(GVARS)
|
|
set(GUI_SRC
|
|
${GUI_SRC}
|
|
${GVAR_SCREEN}
|
|
)
|
|
endif()
|
|
set(FIRMWARE_SRC
|
|
${FIRMWARE_SRC}
|
|
serial.cpp
|
|
syscalls.c
|
|
)
|
|
foreach(FILE ${STM32LIB_SRC})
|
|
set(FIRMWARE_SRC
|
|
${FIRMWARE_SRC}
|
|
${STM32LIB_DIR}/${FILE}
|
|
)
|
|
endforeach()
|
|
foreach(FILE ${STM32USB_SRC})
|
|
set(FIRMWARE_SRC
|
|
${FIRMWARE_SRC}
|
|
${STM32USB_DIR}/${FILE}
|
|
)
|
|
endforeach()
|
|
set(SRC
|
|
${SRC}
|
|
sbus.cpp
|
|
telemetry/crossfire.cpp
|
|
io/bootloader_flash.cpp
|
|
)
|
|
set(PULSES_SRC
|
|
${PULSES_SRC}
|
|
crossfire.cpp
|
|
)
|