Build system updates, including -Werror on TravisCI (#4202)

* [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.
This commit is contained in:
Max Paperno
2017-01-08 09:44:33 +01:00
committed by Bertrand Songis
parent 54742fcad9
commit 1f788723f9
15 changed files with 387 additions and 173 deletions
+3 -1
View File
@@ -1,4 +1,5 @@
set(TIMERS 3 CACHE STRING "Timers count (2 or 3)")
set_property(CACHE TIMERS PROPERTY STRINGS 2 3)
option(CLI "Command Line Interface" OFF)
option(DEBUG "Debug mode" OFF)
option(LOG_TELEMETRY "Telemetry Logs on SD card" OFF)
@@ -82,7 +83,8 @@ add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE -DGAUGES)
add_definitions(-DREQUIRED_SDCARD_VERSION="${SDCARD_VERSION}")
include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable)
foreach(LANGUAGE ${TTS_LANGUAGES})
set(SRC ${SRC} translations/tts_${LANGUAGE}.cpp)
string(TOLOWER ${LANGUAGE} lang_lower)
set(SRC ${SRC} translations/tts_${lang_lower}.cpp)
endforeach()
set(SRC
${SRC}
@@ -1,7 +1,10 @@
set(LUA "NO" CACHE STRING "Lua scripts (YES/NO/NO_MODEL_SCRIPTS)")
option(LUA_COMPILER "Pre-compile and save Lua scripts" OFF)
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)
+12 -7
View File
@@ -5,9 +5,14 @@ option(GRAPHICS "Additional graphics" ON)
option(BOLD "Bold font" ON)
option(BATTGRAPH "Battery graph" OFF)
option(HAPTIC "Haptic support" OFF)
set(TTS "EN" CACHE STRING "TTS language")
set(LCD "DEFAULT" CACHE STRING "LCD type (DEFAULT/ST7565P/ST7565R/ERC12864FSF/ST7920/KS108)")
set(DSM2 "NO" CACHE STRING "LCD type (NO/PPM/SERIAL)")
set(TTS "EN" CACHE STRING "TTS language, one of: ${TTS_LANGUAGES}")
set_property(CACHE TTS PROPERTY STRINGS ${TTS_LANGUAGES})
set(LCD_TYPES DEFAULT ST7565P ST7565R ERC12864FSF ST7920 KS108)
set(LCD "DEFAULT" CACHE STRING "LCD type (${LCD_TYPES})")
set_property(CACHE LCD PROPERTY STRINGS ${LCD_TYPES})
set(DSM2 "NO" CACHE STRING "DSM2 support/interface (NO/PPM/SERIAL)")
set_property(CACHE DSM2 PROPERTY STRINGS NO PPM SERIAL)
set(LUA NO)
set(PULSES_SRC pulses_avr.cpp)
set(SRC ${SRC} main_avr.cpp)
@@ -38,10 +43,10 @@ if(VOICE)
add_definitions(-DVOICE)
set(TARGET_SRC ${TARGET_SRC} voice.cpp)
foreach(LANGUAGE ${TTS_LANGUAGES})
string(TOUPPER ${LANGUAGE} LANGUAGE_CAPITALIZED)
if(TTS STREQUAL ${LANGUAGE_CAPITALIZED})
add_definitions(-DTTS_${LANGUAGE_CAPITALIZED})
set(SRC ${SRC} translations/tts_${LANGUAGE}.cpp)
if(TTS STREQUAL ${LANGUAGE})
add_definitions(-DTTS_${LANGUAGE})
string(TOLOWER ${LANGUAGE} lang_lower)
set(SRC ${SRC} translations/tts_${lang_lower}.cpp)
endif()
endforeach()
endif()