cmake: better gcc + gsdx integration

Only set fabi-version on older GCC (5.0 and below)
Disable broken optimization for GCC7+ (until we find a better solution)
This commit is contained in:
Gregory Hainaut 2017-05-11 23:14:06 +02:00
parent ec63b04719
commit 05763b3669
2 changed files with 17 additions and 5 deletions

View File

@ -69,6 +69,8 @@ function(check_compiler_version version_warn version_err)
message(WARNING "PCSX2 will stop supporting GCC ${GCC_VERSION} in the near future. Please upgrade to at least GCC ${version_warn}.")
endif()
endif()
set(GCC_VERSION "${GCC_VERSION}" PARENT_SCOPE)
endif()
endfunction()

View File

@ -20,8 +20,23 @@ if(USE_ICC)
set(CommonFlags "${CommonFlags} -restrict")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
# Newer version default to a correct ABI
if (${GCC_VERSION} VERSION_LESS "5.1")
set(GSdxFinalFlags ${GSdxFinalFlags} -fabi-version=6)
endif()
# github issue 1937
if (${GCC_VERSION} VERSION_GREATER "7.0")
set(GSdxFinalFlags ${GSdxFinalFlags} -fno-gcse-lm -fno-tree-pre)
endif()
endif()
set(GSdxFinalFlags ${CommonFlags})
if(CMAKE_COMPILER_IS_GNUCXX AND (${GCC_VERSION} VERSION_LESS "5.0"))
set(GSdxFinalFlags ${GSdxFinalFlags} -fabi-version=6)
endif()
if(XDG_STD)
set(GSdxFinalFlags ${GSdxFinalFlags} -DXDG_STD)
endif()
@ -34,11 +49,6 @@ if(LIBLZMA_FOUND)
set(GSdxFinalFlags ${GSdxFinalFlags} -DLZMA_SUPPORTED)
endif()
#Clang doesn't support a few common flags that GCC does.
if(NOT USE_CLANG)
set(GSdxFinalFlags ${GSdxFinalFlags} -fabi-version=6)
endif()
if(OPENCL_API)
set(GSdxFinalFlags ${GSdxFinalFlags} -DENABLE_OPENCL)
endif()