1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 09:45:37 +03:00

Fixed test build on Fedora and Ubuntu with native clang

This commit is contained in:
Mark Haslinghuis 2020-10-20 13:09:14 +02:00
parent b582411bcd
commit b88f948004
2 changed files with 18 additions and 8 deletions

View file

@ -43,12 +43,5 @@ In most Linux distributions the user won't have access to serial interfaces by d
Please log out and log in to active the settings. You should now be able to flash your target using Betaflight Configurator. Please log out and log in to active the settings. You should now be able to flash your target using Betaflight Configurator.
### Unit tests
To be able to run unit tests clang version 8 is required.
$ sudo apt get install clang-8 libblocksruntime-dev
$ make junittest
Credit goes to K.C. Budd, AKfreak for testing, and pulsar for doing the long legwork that yielded the original content of this document. Credit goes to K.C. Budd, AKfreak for testing, and pulsar for doing the long legwork that yielded the original content of this document.

View file

@ -428,6 +428,9 @@ CXX := clang++
#CC := gcc #CC := gcc
#CXX := g++ #CXX := g++
# These flags are needed for clang 10 (maybe even clang 9) to make test work
# -Wno-c99-extensions \
# -Wno-reorder
COMMON_FLAGS = \ COMMON_FLAGS = \
-g \ -g \
-Wall \ -Wall \
@ -438,11 +441,25 @@ COMMON_FLAGS = \
-O0 \ -O0 \
-DUNIT_TEST \ -DUNIT_TEST \
-isystem $(GTEST_DIR)/inc \ -isystem $(GTEST_DIR)/inc \
-MMD -MP -MMD -MP \
-Wno-c99-extensions \
-Wno-reorder
CC_VERSION = $(shell $(CC) -dumpversion) CC_VERSION = $(shell $(CC) -dumpversion)
CXX_VERSION = $(shell $(CXX) -dumpversion) CXX_VERSION = $(shell $(CXX) -dumpversion)
# Please revisit versions when new clang version arrive. Supported versions: { Linux: 7 - 10; OSX: 7- 12 }
# Travis reports CC_VERSION of 4.2.1
CC_VERSION_MAJOR := $(firstword $(subst ., ,$(CC_VERSION)))
CC_VERSION_CHECK_MIN := 4
CC_VERSION_CHECK_MAX := 10
ifdef MACOSX
CC_VERSION_CHECK_MAX := 12
endif
ifeq ($(shell expr $(CC_VERSION_MAJOR) \< $(CC_VERSION_CHECK_MIN) \| $(CC_VERSION_MAJOR) \> $(CC_VERSION_CHECK_MAX)),1)
$(error $(CC) $(CC_VERSION) is not supported. On most systems the correct compiler will be available as 'clang-10' and 'clang++-10, but Betaflight invokes 'clang' and 'clang++' to accommodate some operating systems that do not have proper clang compilers available. Please modify your system so that an appropriate version of clang is invoked as 'clang' and 'clang++'.)
endif
ifeq ($(shell $(CC) -v 2>&1 | grep -q "clang version" && echo "clang"),clang) ifeq ($(shell $(CC) -v 2>&1 | grep -q "clang version" && echo "clang"),clang)
COMMON_FLAGS += -fblocks COMMON_FLAGS += -fblocks
ifndef CYGWIN ifndef CYGWIN