1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00

Merge pull request #10265 from mikeller/use_clang_8_for_tests

This commit is contained in:
Michael Keller 2020-10-26 00:02:09 +13:00
parent 3835fdcebd
commit 9af26257b0
2 changed files with 40 additions and 8 deletions

View file

@ -29,9 +29,16 @@ env:
# - TARGET=AIORACERF3
# - TARGET=...
addons:
apt:
update: true
packages:
- clang-10
- lcov
- libc6-i386
- libblocksruntime-dev
before_install:
- sudo apt-get update
- sudo apt-get install -y lcov libc6-i386 libblocksruntime-dev
- |
echo "Target branch: $TRAVIS_BRANCH"
echo "Commit range: $TRAVIS_COMMIT_RANGE"
@ -53,9 +60,6 @@ install:
before_script:
- make arm_sdk_version
- clang --version
- clang++ --version
- gcc --version
script: ./.travis.sh

View file

@ -420,11 +420,22 @@ rx_spi_spektrum_unittest_DEFINES := \
GTEST_DIR = ../../lib/test/gtest
# Use clang/clang++ by default
CC := clang-10
CXX := clang++-10
ifeq ($(shell which $(CC) 2>/dev/null),)
$(info Falling back to 'clang'.)
CC := clang
CXX := clang++
endif
#CC := gcc
#CXX := g++
# These flags are needed for clang 10 (maybe even clang 9) to make test work
# -Wno-c99-extensions \
# -Wno-reorder
COMMON_FLAGS = \
-g \
-Wall \
@ -441,17 +452,34 @@ CC_VERSION = $(shell $(CC) -dumpversion)
CXX_VERSION = $(shell $(CXX) -dumpversion)
ifeq ($(shell $(CC) -v 2>&1 | grep -q "clang version" && echo "clang"),clang)
# 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 := 7
CC_VERSION_CHECK_MAX := 10
ifeq ($(OSFAMILY), macosx)
# MacOS comes with Apple's own flavour of clang that does not adhere to the official versioning
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. The officially supported version of clang is 'clang-10'. If this is not found, 'clang' is used as a fallback. The version of the compiler must be between $(CC_VERSION_CHECK_MIN) and $(CC_VERSION_CHECK_MAX).)
endif
COMMON_FLAGS += -fblocks
ifndef CYGWIN
ifndef MACOSX
ifneq ($(OSFAMILY), macosx)
LDFLAGS += -lBlocksRuntime
endif
endif
endif
$(info CC version: $(shell $(CC) --version))
$(info CXX version: $(shell $(CXX) --version))
USE_PTHREAD = YES
USE_COVERAGE = YES
ifdef MACOSX
ifeq ($(OSFAMILY), macosx)
USE_PTHREAD =
endif
ifdef CYGWIN
@ -482,7 +510,7 @@ CXX_FLAGS += $(COVERAGE_FLAGS)
C_FLAGS += -D_GNU_SOURCE
# Set up the parameter group linker flags according to OS
ifdef MACOSX
ifeq ($(OSFAMILY), macosx)
LDFLAGS += -Wl,-map,$(OBJECT_DIR)/$@.map
else
LDFLAGS += -Wl,-T,$(TEST_DIR)/pg.ld -Wl,-Map,$(OBJECT_DIR)/$@.map