SCons: Bump required C++ standard to C++17

As per #36436, we now need C++17's guaranteed copy elision feature to
solve ambiguities in Variant.

Core developers discussed the idea to move from C++14 to C++17 as our
minimum required C++ standard, and all agreed. Note that this doesn't
mean that Godot is going to be written in "modern C++", but we'll use
modern features where they make sense to simplify our "C with classes"
codebase. Apart from new code written recently, most of the codebase
still has to be ported to use newer features where relevant.

Proper support for C++17 means that we need recent compiler versions:

 - GCC 7+
 - Clang 6+
 - VS 2017 15.7+

Additionally, C++17's `std::shared_mutex` (conditionally used by
`vk_mem_alloc.h` when C++17 support is enabled) is only available in
macOS 10.12+, so we increase our minimum supported version.
This commit is contained in:
Rémi Verschelde 2020-02-22 18:15:47 +01:00
parent 92332eb23d
commit a4801674c5
4 changed files with 12 additions and 12 deletions

View file

@ -310,17 +310,17 @@ if selected_platform in platform_list:
env.Append(LINKFLAGS=str(LINKFLAGS).split())
# Set our C and C++ standard requirements.
# Prepending to make it possible to override
# C++17 is required as we need guaranteed copy elision as per GH-36436.
# Prepending to make it possible to override.
if not env.msvc:
# Specifying GNU extensions support explicitly, which are supported by
# both GCC and Clang. This mirrors GCC and Clang's current default
# compile flags if no -std is specified.
# both GCC and Clang. Both currently default to gnu11 and gnu++14.
env.Prepend(CFLAGS=['-std=gnu11'])
env.Prepend(CXXFLAGS=['-std=gnu++14'])
env.Prepend(CXXFLAGS=['-std=gnu++17'])
else:
# MSVC doesn't have clear C standard support, /std only covers C++.
# We apply it to CCFLAGS (both C and C++ code) in case it impacts C features.
env.Prepend(CCFLAGS=['/std:c++14', '/permissive-'])
env.Prepend(CCFLAGS=['/std:c++17', '/permissive-'])
# Platform specific flags
flag_list = platform_flags[selected_platform]

View file

@ -31,13 +31,13 @@
<key>NSHumanReadableCopyright</key>
<string>$copyright</string>
<key>LSMinimumSystemVersion</key>
<string>10.9.0</string>
<string>10.12.0</string>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>x86_64</key>
<string>10.9.0</string>
<string>10.12.0</string>
</dict>
<key>NSHighResolutionCapable</key>
$highres
</dict>
</plist>
</plist>

View file

@ -33,11 +33,11 @@
<key>NSHumanReadableCopyright</key>
<string>© 2007-2020 Juan Linietsky, Ariel Manzur &amp; Godot Engine contributors</string>
<key>LSMinimumSystemVersion</key>
<string>10.9.0</string>
<string>10.12.0</string>
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>x86_64</key>
<string>10.9.0</string>
<string>10.12.0</string>
</dict>
<key>NSHighResolutionCapable</key>
<true/>

View file

@ -164,5 +164,5 @@ def configure(env):
#env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED'])
env.Append(CCFLAGS=['-mmacosx-version-min=10.11'])
env.Append(LINKFLAGS=['-mmacosx-version-min=10.11'])
env.Append(CCFLAGS=['-mmacosx-version-min=10.12'])
env.Append(LINKFLAGS=['-mmacosx-version-min=10.12'])