Fix clang12 support on Linux/MacOS

Add support for clang 13
This commit is contained in:
Štěpán Dalecký 2021-10-03 15:56:26 +02:00
parent d2613e2e6a
commit 40abe65bc0
1 changed files with 4 additions and 13 deletions

View File

@ -462,28 +462,19 @@ CXX_VERSION = $(shell $(CXX) -dumpversion)
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)
# Please revisit versions when new clang version arrive. Supported versions: { Linux: 7 - 11; OSX: 7- 12 } # Please revisit versions when new clang version arrive. Supported versions: { Linux / OSX: 7 - 13 }
# Travis reports CC_VERSION of 4.2.1 # Travis reports CC_VERSION of 4.2.1
CC_VERSION_MAJOR := $(firstword $(subst ., ,$(CC_VERSION))) CC_VERSION_MAJOR := $(firstword $(subst ., ,$(CC_VERSION)))
CC_VERSION_CHECK_MIN := 7 CC_VERSION_CHECK_MIN := 7
CC_VERSION_CHECK_MAX := 11 CC_VERSION_CHECK_MAX := 13
# Added flags for clang 11 (linux) are not backwards compatible: # Added flags for clang 11 - 13 are not backwards compatible
# -fcommon ifeq ($(shell expr $(CC_VERSION_MAJOR) \> 10 \& $(CC_VERSION_MAJOR) \< 14), 1)
# -Wno-void-pointer-to-int-cast
ifneq ($(OSFAMILY), macosx)
ifeq ($(CC_VERSION_MAJOR), 11)
COMMON_FLAGS += \ COMMON_FLAGS += \
-fcommon \ -fcommon \
-Wno-void-pointer-to-int-cast -Wno-void-pointer-to-int-cast
endif endif
endif
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) 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).) $(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 endif