Build: Switch to C++20

This commit is contained in:
Stenzek 2023-09-05 20:57:18 +10:00
parent 9b47561c89
commit 58b4946fb9
2 changed files with 10 additions and 3 deletions

View File

@ -142,9 +142,7 @@ if(ANDROID)
endif() endif()
# Detect C++ version support. # Warning disables.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
include(CheckCXXFlag) include(CheckCXXFlag)
check_cxx_flag(-Wall COMPILER_SUPPORTS_WALL) check_cxx_flag(-Wall COMPILER_SUPPORTS_WALL)
@ -229,8 +227,16 @@ if(BUILD_TESTS)
enable_testing() enable_testing()
endif() endif()
# Use C++17 for building dependencies (some aren't C++20-aware, e.g. reshadefx).
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Recursively include the source tree. # Recursively include the source tree.
add_subdirectory(dep) add_subdirectory(dep)
# Use C++20 for building the main libraries.
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory(src) add_subdirectory(src)
if(ANDROID) if(ANDROID)

View File

@ -3,6 +3,7 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories);$(SolutionDir)dep\gsl\include;$(SolutionDir)dep\fast_float\include;$(SolutionDir)dep\fmt\include;$(SolutionDir)dep\zlib\include;$(SolutionDir)dep\minizip\include;$(SolutionDir)dep\stb\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories);$(SolutionDir)dep\gsl\include;$(SolutionDir)dep\fast_float\include;$(SolutionDir)dep\fmt\include;$(SolutionDir)dep\zlib\include;$(SolutionDir)dep\minizip\include;$(SolutionDir)dep\stb\include</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>