aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnermolaev <snermolaev@yandex-team.com>2024-03-08 06:50:53 +0300
committersnermolaev <snermolaev@yandex-team.com>2024-03-08 07:04:24 +0300
commitffdf61ee8c757756f6215215dbb7f8504afacad1 (patch)
tree29b1cbc1876b3a70472ae976deaa4db951092fc6
parent9cf3699e784fcc4323a7d4deb34c33d6bf917031 (diff)
downloadydb-ffdf61ee8c757756f6215215dbb7f8504afacad1.tar.gz
customizable c++ version
87c41673da119e1384d9b3fffedae5d40c385e0c
-rw-r--r--build/conf/compilers/gnu_compiler.conf4
-rw-r--r--build/conf/compilers/msvc_compiler.conf2
-rw-r--r--build/conf/settings.conf2
-rwxr-xr-xbuild/ymake_conf.py6
4 files changed, 9 insertions, 5 deletions
diff --git a/build/conf/compilers/gnu_compiler.conf b/build/conf/compilers/gnu_compiler.conf
index 676237c00e..66e0711df7 100644
--- a/build/conf/compilers/gnu_compiler.conf
+++ b/build/conf/compilers/gnu_compiler.conf
@@ -1,3 +1,5 @@
+_STD_CXX=-std=$_STD_CXX_VERSION
+
_OPTIMIZE_RELEASE=
when ($_BUILD_RELEASE == "yes") {
when ($_BUILD_SIZE_OPTIMIZED == "yes") {
@@ -72,7 +74,7 @@ when ($OS_EMSCRIPTEN == "yes") {
}
CFLAGS+=$_C_FLAGS $DEBUG_INFO_FLAGS $_C_FOPTIONS $C_WARNING_OPTS $GCC_PREPROCESSOR_OPTS $USER_CFLAGS $USER_CFLAGS_GLOBAL
-CXXFLAGS+=$CFLAGS $_CXX_STD $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL
+CXXFLAGS+=$CFLAGS $_STD_CXX $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL
CONLYFLAGS+=$USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL
CXX_COMPILER=${quo:CXX_COMPILER_UNQUOTED}
NOGCCSTACKCHECK=yes
diff --git a/build/conf/compilers/msvc_compiler.conf b/build/conf/compilers/msvc_compiler.conf
index afd649f575..9455570d59 100644
--- a/build/conf/compilers/msvc_compiler.conf
+++ b/build/conf/compilers/msvc_compiler.conf
@@ -1,3 +1,5 @@
+_STD_CXX=/std:$_STD_CXX_VERSION
+
MSVC_INLINE_OPTIMIZED=yes
when ($MSVC_INLINE_OPTIMIZED == "yes") {
MSVC_INLINE_FLAG=/Zc:inline
diff --git a/build/conf/settings.conf b/build/conf/settings.conf
index 2985714069..90a9069a02 100644
--- a/build/conf/settings.conf
+++ b/build/conf/settings.conf
@@ -41,7 +41,6 @@ _FOLDABLE_VARS=\
_CROSS_SUFFIX \
_CXX_DEFINES \
_CXX_FLAGS \
- _CXX_STD \
_C_ARGS \
_C_CPP_KV_STYLE \
_C_FLAGS \
@@ -105,5 +104,6 @@ _FOLDABLE_VARS=\
_SONAME_OPTION \
_START_GROUP \
_STD_CXX \
+ _STD_CXX_VERSION \
# end of _FOLDABLE_VARS list
diff --git a/build/ymake_conf.py b/build/ymake_conf.py
index ad167ec746..6ed60f3353 100755
--- a/build/ymake_conf.py
+++ b/build/ymake_conf.py
@@ -504,7 +504,7 @@ class Options(object):
self.toolchain_params = self.options.toolchain_params
self.presets = parse_presets(self.options.presets)
- userify_presets(self.presets, ('CFLAGS', 'CXXFLAGS', 'CONLYFLAGS', 'LDFLAGS', 'GO_COMPILE_FLAGS', 'GO_LINK_FLAGS'))
+ userify_presets(self.presets, ('CFLAGS', 'CXXFLAGS', 'CONLYFLAGS', 'LDFLAGS', 'GO_COMPILE_FLAGS', 'GO_LINK_FLAGS', 'STD_CXX_VERSION'))
Instance = None
@@ -1588,7 +1588,7 @@ class GnuCompiler(Compiler):
emit('WERROR_MODE', self.tc.werror_mode)
emit('_C_FLAGS', self.c_flags)
emit('_C_FOPTIONS', self.c_foptions)
- emit('_CXX_STD', '-std={}'.format(self.tc.cxx_std))
+ emit('_STD_CXX_VERSION', preset('USER_STD_CXX_VERSION') or self.tc.cxx_std)
append('C_DEFINES', self.c_defines)
append('C_WARNING_OPTS', self.c_warnings)
append('CXX_WARNING_OPTS', self.cxx_warnings)
@@ -2111,7 +2111,7 @@ class MSVCCompiler(MSVC, Compiler):
if self.build.is_ide:
emit('CFLAGS_PER_TYPE', '@[debug|$CFLAGS_DEBUG]@[release|$CFLAGS_RELEASE]')
- emit('_STD_CXX', '/std:{}'.format(self.tc.cxx_std))
+ emit('_STD_CXX_VERSION', preset('USER_STD_CXX_VERSION') or self.tc.cxx_std)
emit('_MSVC_FLAGS', flags)