From 05763b3669a19e5de5d6dc22609941fb9d811d72 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Thu, 11 May 2017 23:14:06 +0200 Subject: [PATCH] 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) --- cmake/Pcsx2Utils.cmake | 2 ++ plugins/GSdx/CMakeLists.txt | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/cmake/Pcsx2Utils.cmake b/cmake/Pcsx2Utils.cmake index 36a9794154..9b71029b2b 100644 --- a/cmake/Pcsx2Utils.cmake +++ b/cmake/Pcsx2Utils.cmake @@ -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() diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index 0d6acbbf37..718a81573a 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -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()