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
+9 -8
View File
@@ -41,22 +41,21 @@ endif(WIN32)
if(MSVC)
set(CMAKE_CXX_FLAGS "/EHsc /LD /MP")
message("simu: using MSVC with ${CMAKE_CXX_FLAGS}")
else()
if (${CMAKE_VERSION} VERSION_LESS 3.1.0})
message("simu: adding -std=gnu++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif()
if(MINGW)
# struct packing breaks on MinGW w/out -mno-ms-bitfields: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 & http://stackoverflow.com/questions/24015852/struct-packing-and-alignment-with-mingw
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-ms-bitfields -mwindows")
message("simu: using MinGW with ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-ms-bitfields")
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
endif()
if((NOT WIN32) AND FOX_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
use_cxx11() # ensure gnu++11 in CXX_FLAGS with CMake < 3.1
if(FOX_FOUND)
if(SIMU_DISKIO)
add_definitions(-DSIMU_DISKIO)
set(SIMU_SRC ${SIMU_SRC} ${FATFS_DIR}/FatFs/ff.c ${FATFS_DIR}/option/ccsbcs.c)
@@ -90,3 +89,5 @@ if(APPLE)
endforeach()
add_custom_target(opentx-simulators-bundle DEPENDS ${SIMULATOR_BUNDLES})
endif(APPLE)
PrintTargetReport("simu/libsimulator")