Bump up C++ version to c++17 for gcc & clang (#3746)

Use target_compile_features to enforce c++17 standard
This commit is contained in:
Ty 2020-09-29 10:30:03 -04:00 committed by GitHub
parent 21c9d9d020
commit 5858f72748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 23 additions and 2 deletions

View File

@ -20,7 +20,7 @@ include(Pcsx2Utils)
check_no_parenthesis_in_path()
detectOperatingSystem()
check_compiler_version("4.8" "4.8")
check_compiler_version("7.0" "7.0")
#-------------------------------------------------------------------------------
# Include specific module

View File

@ -391,7 +391,7 @@ endif()
# Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS} ${PGO_FLAGS} ${PLUGIN_SUPPORT}")
# c++ only flags
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -std=c++11 -Wno-invalid-offsetof")
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof")
#-------------------------------------------------------------------------------
# Allow user to set some default flags

View File

@ -733,6 +733,7 @@ if(USE_VTUNE)
endif()
add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}")
target_compile_features(${Output} PRIVATE cxx_std_17)
if(COMMAND target_precompile_headers)
message("Using precompiled headers.")

View File

@ -262,12 +262,16 @@ else()
# Don't append -SSE2 on the first build to keep same name as SIMD build
add_pcsx2_plugin("${Output}" "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
add_pcsx2_plugin("${Output}-SSE4" "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags} -mssse3 -msse4 -msse4.1")
target_compile_features("${Output}-SSE4" PRIVATE cxx_std_17)
add_pcsx2_plugin("${Output}-AVX2" "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags} -mavx -mavx2 -mbmi -mbmi2")
target_compile_features("${Output}-AVX2" PRIVATE cxx_std_17)
else()
add_pcsx2_plugin(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
endif()
endif()
target_compile_features(${Output} PRIVATE cxx_std_17)
################################### Replay Loader
if(BUILD_REPLAY_LOADERS)
set(Replay pcsx2_GSReplayLoader)
@ -275,4 +279,5 @@ if(BUILD_REPLAY_LOADERS)
linux_replay.cpp
)
add_pcsx2_executable(${Replay} "${GSdxReplayLoaderFinalSources}" "${LIBC_LIBRARIES}" "${GSdxFinalFlags}")
target_compile_features(${Replay} PRIVATE cxx_std_17)
endif(BUILD_REPLAY_LOADERS)

View File

@ -75,3 +75,4 @@ set(GSnullFinalLibs
)
add_pcsx2_plugin(${Output} "${GSnullFinalSources}" "${GSnullFinalLibs}" "${GSnullFinalFlags}")
target_compile_features(${Output} PRIVATE cxx_std_17)

View File

@ -101,3 +101,4 @@ set(lilypadFinalSources
)
add_pcsx2_plugin(${Output} "${lilypadFinalSources}" "${lilypadFinalLibs}" "${lilypadFinalFlags}")
target_compile_features(${Output} PRIVATE cxx_std_17)

View File

@ -58,3 +58,4 @@ set(PadNullFinalLibs
)
add_pcsx2_plugin(${Output} "${PadNullFinalSources}" "${PadNullFinalLibs}" "${PadNullFinalFlags}")
target_compile_features(${Output} PRIVATE cxx_std_17)

View File

@ -54,3 +54,4 @@ set(SPU2nullFinalLibs
)
add_pcsx2_plugin(${Output} "${SPU2nullFinalSources}" "${SPU2nullFinalLibs}" "${SPU2nullFinalFlags}")
target_compile_features(${Output} PRIVATE cxx_std_17)

View File

@ -57,3 +57,5 @@ if(BUILTIN_USB)
else()
add_pcsx2_plugin(${Output} "${USBnullFinalSources}" "${USBnullFinalLibs}" "${USBnullFinalFlags}")
endif()
target_compile_features(${Output} PRIVATE cxx_std_17)

View File

@ -113,6 +113,7 @@ set(dev9ghzdrkFinalLibs
)
add_pcsx2_plugin(${Output} "${dev9ghzdrkFinalSources}" "${dev9ghzdrkFinalLibs}" "${dev9ghzdrkFinalFlags}")
target_compile_features(${Output} PRIVATE cxx_std_17)
#if(PACKAGE_MODE)
# install(FILES Linux/dev9ghzdrk.ui DESTINATION bin )

View File

@ -55,3 +55,5 @@ if(BUILTIN_DEV9)
else()
add_pcsx2_plugin(${Output} "${dev9nullFinalSources}" "${dev9nullFinalLibs}" "${dev9nullFinalFlags}")
endif()
target_compile_features(${Output} PRIVATE cxx_std_17)

View File

@ -143,3 +143,5 @@ if(BUILTIN_PAD)
else()
add_pcsx2_plugin(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
endif()
target_compile_features(${Output} PRIVATE cxx_std_17)

View File

@ -145,3 +145,5 @@ if(BUILTIN_PAD)
else()
add_pcsx2_plugin(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
endif()
target_compile_features(${Output} PRIVATE cxx_std_17)

View File

@ -156,3 +156,5 @@ if(BUILTIN_SPU2)
else()
add_pcsx2_plugin(${Output} "${spu2xFinalSources}" "${spu2xFinalLibs}" "${spu2xFinalFlags}")
endif()
target_compile_features(${Output} PRIVATE cxx_std_17)