From b24d4cce8d99dab50b301bb1ddff4779558d69a8 Mon Sep 17 00:00:00 2001 From: Forrest McDonald Date: Sat, 12 Jul 2014 09:52:27 -0700 Subject: [PATCH] Clang doesn't support some flags that GCC does, so conditionally check the compiler and add them if we are doing a GCC build --- common/src/Utilities/CMakeLists.txt | 8 +++++--- common/src/x86emitter/CMakeLists.txt | 8 +++++--- pcsx2/CMakeLists.txt | 11 +++++++---- plugins/GSdx/CMakeLists.txt | 6 +++++- plugins/zzogl-pg/opengl/CMakeLists.txt | 6 +++++- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt index c53539d04f..4bc3b7d0b4 100644 --- a/common/src/Utilities/CMakeLists.txt +++ b/common/src/Utilities/CMakeLists.txt @@ -11,10 +11,7 @@ set(Output Utilities) # set common flags set(CommonFlags - -fno-dse - -fno-guess-branch-probability -fno-strict-aliasing - -fno-tree-dse ) # set optimization flags @@ -58,6 +55,11 @@ set(OptimizationFlags -ftree-vrp -funit-at-a-time) +#Clang doesn't support a few common flags that GCC does. +if(NOT USE_CLANG) + add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse) +endif(NOT USE_CLANG) + # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) diff --git a/common/src/x86emitter/CMakeLists.txt b/common/src/x86emitter/CMakeLists.txt index 3bb115987d..cc7c6ae472 100644 --- a/common/src/x86emitter/CMakeLists.txt +++ b/common/src/x86emitter/CMakeLists.txt @@ -11,9 +11,6 @@ set(Output x86emitter) # set common flags set(CommonFlags - -fno-guess-branch-probability - -fno-dse - -fno-tree-dse -fno-strict-aliasing ) @@ -58,6 +55,11 @@ set(OptimizationFlags -ftree-vrp -funit-at-a-time) +#Clang doesn't support a few common flags that GCC does. +if(NOT USE_CLANG) + add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse) +endif(NOT USE_CLANG) + # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index da18c571ee..846092f4a9 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -12,14 +12,12 @@ set(CommonFlags # Disable this optimization for the moment -fno-omit-frame-pointer # END GCC-4.6 - -fno-guess-branch-probability - -fno-dse - -fno-tree-dse - -fno-strict-aliasing + -fno-strict-aliasing -Wno-parentheses -Wstrict-aliasing # Allow to track strict aliasing issue. -Wno-char-subscripts # only impact svu which is deprecated -Wno-missing-braces + -Wno-ignored-attributes ) # set optimization flags @@ -63,6 +61,11 @@ set(OptimizationFlags -ftree-vrp -funit-at-a-time) +#Clang doesn't support a few common flags that GCC does. +if(NOT USE_CLANG) + add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse) +endif(NOT USE_CLANG) + # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) set(Output pcsx2-dbg) diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index 57636731c4..1fe226758a 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -12,7 +12,6 @@ set(Output GSdx-0.1.16) set(CommonFlags -D_LINUX -fno-operator-names # because Xbyak uses and()/xor()/or()/not() function - -mpreferred-stack-boundary=2 -mfpmath=sse #-Wstrict-aliasing # Allow to track strict aliasing issue. -std=c++0x @@ -27,6 +26,11 @@ set(OptimizationFlags -DNDEBUG ) +#Clang doesn't support a few common flags that GCC does. +if(NOT USE_CLANG) + add_definitions(${CommonFlags} -mpreferred-stack-boundary=2) +endif(NOT USE_CLANG) + # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) add_definitions(${CommonFlags} -D_DEBUG -g -Wall) diff --git a/plugins/zzogl-pg/opengl/CMakeLists.txt b/plugins/zzogl-pg/opengl/CMakeLists.txt index 5e27853355..bfbd3e881e 100644 --- a/plugins/zzogl-pg/opengl/CMakeLists.txt +++ b/plugins/zzogl-pg/opengl/CMakeLists.txt @@ -16,7 +16,6 @@ set(Output zzogl-0.4.0) set(CommonFlags -pthread -DZEROGS_SSE2 - -fno-regmove -fno-strict-aliasing -Wstrict-aliasing # Allow to track strict aliasing issue. -Wunused-variable @@ -27,6 +26,11 @@ set(OptimizationFlags -DNDEBUG ) +#Clang doesn't support a few common flags that GCC does. +if(NOT USE_CLANG) + add_definitions(${CommonFlags} -fno-regmove) +endif(NOT USE_CLANG) + # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines