Mk/Uses/compiler.mk: Support newer C++ standards
* Add c++20-lang and c++2b-lang arguments * Respect LLVM_DEFAULT if it fullfills the requirements PR: 244810, 266029 Exp-run by: antoine Approved by: bapt, tcberner (mentor) Differential Revision: https://reviews.freebsd.org/D35889
This commit is contained in:
parent
b231953227
commit
5ca22080ae
1 changed files with 33 additions and 9 deletions
|
@ -8,6 +8,8 @@
|
|||
# c++11-lang: The port needs a compiler understanding C++11
|
||||
# c++14-lang: The port needs a compiler understanding C++14
|
||||
# c++17-lang: The port needs a compiler understanding C++17
|
||||
# c++20-lang: The port needs a compiler understanding C++20
|
||||
# c++2b-lang: The port needs a compiler understanding C++2b
|
||||
# gcc-c++11-lib:The port needs g++ compiler with a C++11 library
|
||||
# c++11-lib: The port needs a compiler understanding C++11 and with a C++11 ready standard library
|
||||
# c11: The port needs a compiler understanding C11
|
||||
|
@ -33,7 +35,8 @@ _INCLUDE_USES_COMPILER_MK= yes
|
|||
compiler_ARGS= env
|
||||
. endif
|
||||
|
||||
VALID_ARGS= c++11-lib c++11-lang c++14-lang c++17-lang c11 features env nestedfct c++0x gcc-c++11-lib
|
||||
VALID_ARGS= c++11-lib c++11-lang c++14-lang c++17-lang c++20-lang \
|
||||
c++2b-lang c11 features env nestedfct c++0x gcc-c++11-lib
|
||||
|
||||
_CC_hash:= ${CC:hash}
|
||||
_CXX_hash:= ${CXX:hash}
|
||||
|
@ -50,6 +53,10 @@ _COMPILER_ARGS+= features c++11-lang
|
|||
_COMPILER_ARGS+= features c++14-lang
|
||||
. elif ${compiler_ARGS} == c++17-lang
|
||||
_COMPILER_ARGS+= features c++17-lang
|
||||
. elif ${compiler_ARGS} == c++20-lang
|
||||
_COMPILER_ARGS+= features c++20-lang
|
||||
. elif ${compiler_ARGS} == c++2b-lang
|
||||
_COMPILER_ARGS+= features c++2b-lang
|
||||
. elif ${compiler_ARGS} == c11
|
||||
_COMPILER_ARGS+= features c11
|
||||
. elif ${compiler_ARGS} == features
|
||||
|
@ -129,7 +136,8 @@ COMPILER_FEATURES= libstdc++
|
|||
. endif
|
||||
|
||||
CSTD= c89 c99 c11 gnu89 gnu99 gnu11
|
||||
CXXSTD= c++98 c++0x c++11 c++14 c++17 gnu++98 gnu++11 gnu++14 gnu++17
|
||||
CXXSTD= c++98 c++0x c++11 c++14 c++17 c++20 c++2b \
|
||||
gnu++98 gnu++11 gnu++14 gnu++17 gnu++20 gnu++2b
|
||||
|
||||
. for std in ${CSTD} ${CXXSTD}
|
||||
_LANG=c
|
||||
|
@ -159,25 +167,41 @@ CHOSEN_COMPILER_TYPE= gcc
|
|||
. endif
|
||||
. endif
|
||||
|
||||
. if (${_COMPILER_ARGS:Mc++17-lang} && !${COMPILER_FEATURES:Mc++17}) || \
|
||||
. if (${_COMPILER_ARGS:Mc++2b-lang} && !${COMPILER_FEATURES:Mc++2b}) || \
|
||||
(${_COMPILER_ARGS:Mc++20-lang} && !${COMPILER_FEATURES:Mc++20}) || \
|
||||
(${_COMPILER_ARGS:Mc++17-lang} && !${COMPILER_FEATURES:Mc++17}) || \
|
||||
(${_COMPILER_ARGS:Mc++14-lang} && !${COMPILER_FEATURES:Mc++14}) || \
|
||||
(${_COMPILER_ARGS:Mc++11-lang} && !${COMPILER_FEATURES:Mc++11}) || \
|
||||
(${_COMPILER_ARGS:Mc++0x} && !${COMPILER_FEATURES:Mc++0x}) || \
|
||||
(${_COMPILER_ARGS:Mc11} && !${COMPILER_FEATURES:Mc11})
|
||||
. if ${_COMPILER_ARGS:Mc++2b-lang}
|
||||
_LLVM_MINVER= 14
|
||||
. elif ${_COMPILER_ARGS:Mc++20-lang}
|
||||
_LLVM_MINVER= 11
|
||||
. else
|
||||
_LLVM_MINVER= 0
|
||||
. endif
|
||||
. if (defined(FAVORITE_COMPILER) && ${FAVORITE_COMPILER} == gcc) || (${ARCH} != amd64 && ${ARCH} != i386) # clang not always supported on Tier-2
|
||||
USE_GCC= yes
|
||||
CHOSEN_COMPILER_TYPE= gcc
|
||||
. elif ${COMPILER_TYPE} == gcc
|
||||
. if ${ALT_COMPILER_TYPE} == clang
|
||||
. elif ${COMPILER_TYPE} == gcc || \
|
||||
(${COMPILER_VERSION:C/[0-9]$//}<${_LLVM_MINVER})
|
||||
. if ${ALT_COMPILER_TYPE} == clang && \
|
||||
(${ALT_COMPILER_VERSION:C/[0-9]$//}>=${_LLVM_MINVER})
|
||||
CPP= clang-cpp
|
||||
CC= clang
|
||||
CXX= clang++
|
||||
CHOSEN_COMPILER_TYPE= clang
|
||||
. else
|
||||
BUILD_DEPENDS+= ${LOCALBASE}/bin/clang10:devel/llvm10
|
||||
CPP= ${LOCALBASE}/bin/clang-cpp10
|
||||
CC= ${LOCALBASE}/bin/clang10
|
||||
CXX= ${LOCALBASE}/bin/clang++10
|
||||
. if ${LLVM_DEFAULT:C/^[789]0$/0/}<${_LLVM_MINVER}
|
||||
_LLVM_REQ= ${_LLVM_MINVER}
|
||||
. else
|
||||
_LLVM_REQ= ${LLVM_DEFAULT}
|
||||
. endif
|
||||
BUILD_DEPENDS+= clang${_LLVM_REQ}:devel/llvm${_LLVM_REQ}
|
||||
CPP= ${LOCALBASE}/bin/clang-cpp${_LLVM_REQ}
|
||||
CC= ${LOCALBASE}/bin/clang${_LLVM_REQ}
|
||||
CXX= ${LOCALBASE}/bin/clang++${_LLVM_REQ}
|
||||
CHOSEN_COMPILER_TYPE= clang
|
||||
. endif
|
||||
. endif
|
||||
|
|
Loading…
Reference in a new issue