Merge pull request #9556 from JosJuice/cmake-msvc-latest

CMake: Build with -std:c++latest for MSVC
This commit is contained in:
Léo Lam 2021-03-04 12:12:06 +01:00 committed by GitHub
commit 9c6c77351f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -16,7 +16,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING) add_definitions(-D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
endif() endif()
set(CMAKE_CXX_STANDARD 17) if (MSVC)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest")
else()
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

View File

@ -347,6 +347,13 @@ if (WIN32)
) )
endif() endif()
if (MSVC)
# Disable some warnings
# 5054: operator '+': deprecated between enumerations of different types (in Qt headers)
target_compile_options(dolphin-emu PRIVATE /wd5054)
endif()
if(WIN32) if(WIN32)
target_sources(dolphin-emu PRIVATE DolphinQt.manifest DolphinQt.rc) target_sources(dolphin-emu PRIVATE DolphinQt.manifest DolphinQt.rc)
@ -356,8 +363,6 @@ if(WIN32)
WIN32_EXECUTABLE TRUE WIN32_EXECUTABLE TRUE
) )
target_compile_options(dolphin-emu PRIVATE "-D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING")
# Copy Sys dir # Copy Sys dir
add_custom_command(TARGET dolphin-emu POST_BUILD add_custom_command(TARGET dolphin-emu POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/Data/Sys" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys" COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/Data/Sys" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys"