[CMake] Optimization-disabling compiler flags should be appended to CMAKE_C(XX)_FLAGS...
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Aug 2014 06:03:46 +0000 (06:03 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Aug 2014 06:03:46 +0000 (06:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135980

Reviewed by Martin Robinson.

CMAKE_C(XX)_FLAGS_RELEASE variables usually contain the -On flag which
overrides any other disabled optimization that was prepended to these
variables or was added to the CMAKE_C(XX)_FLAGS variables which CMake
lists first in the final list of compilation flags.

To avoid -On re-enabling optimizations that we'd like to keep disabled,
the specific compiler flags must be appended to CMAKE_C(XX)_FLAGS_RELEASE.

* Source/cmake/OptionsCommon.cmake:
* Source/cmake/OptionsEfl.cmake: Also do the appending with CMAKE_SHARED_LINKER_FLAGS_RELEASE.
* Source/cmake/OptionsGTK.cmake:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172698 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/cmake/OptionsCommon.cmake
Source/cmake/OptionsEfl.cmake
Source/cmake/OptionsGTK.cmake

index 5e89354..c24beee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2014-08-17  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CMake] Optimization-disabling compiler flags should be appended to CMAKE_C(XX)_FLAGS_RELEASE
+        https://bugs.webkit.org/show_bug.cgi?id=135980
+
+        Reviewed by Martin Robinson.
+
+        CMAKE_C(XX)_FLAGS_RELEASE variables usually contain the -On flag which
+        overrides any other disabled optimization that was prepended to these
+        variables or was added to the CMAKE_C(XX)_FLAGS variables which CMake
+        lists first in the final list of compilation flags.
+
+        To avoid -On re-enabling optimizations that we'd like to keep disabled,
+        the specific compiler flags must be appended to CMAKE_C(XX)_FLAGS_RELEASE.
+
+        * Source/cmake/OptionsCommon.cmake:
+        * Source/cmake/OptionsEfl.cmake: Also do the appending with CMAKE_SHARED_LINKER_FLAGS_RELEASE.
+        * Source/cmake/OptionsGTK.cmake:
+
 2014-08-15  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.5.3 release.
index 045c614..ffcdfe5 100644 (file)
@@ -25,8 +25,9 @@ endif ()
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
 if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -fno-strict-aliasing")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-exceptions -fno-strict-aliasing -fno-rtti")
+    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-exceptions -fno-strict-aliasing")
+    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-exceptions -fno-strict-aliasing -fno-rtti")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 endif ()
 
 option(DEBUG_FISSION "Use Debug Fission support")
index 4fd19f8..297608e 100644 (file)
@@ -275,20 +275,14 @@ endif ()
 
 set(CPACK_SOURCE_GENERATOR TBZ2)
 
-# Optimize binary size for release builds by removing dead sections on unix/gcc
+# Optimize binary size for release builds by removing dead sections on unix/gcc.
+# Push of rbp is needed after JSC JIT uses CStack.
 if (CMAKE_COMPILER_IS_GNUCC AND UNIX AND NOT APPLE)
-    set(CMAKE_C_FLAGS_RELEASE "-ffunction-sections -fdata-sections ${CMAKE_C_FLAGS_RELEASE}")
-    set(CMAKE_CXX_FLAGS_RELEASE "-ffunction-sections -fdata-sections -fno-rtti ${CMAKE_CXX_FLAGS_RELEASE}")
-    set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "-Wl,--gc-sections ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
+    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-tree-dce")
+    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fno-rtti -fno-omit-frame-pointer -fno-tree-dce")
+    set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
 endif ()
 
-# push of rbp is needed after JSC JIT uses CStack
-if (CMAKE_COMPILER_IS_GNUCC AND UNIX AND NOT APPLE)
-    set(CMAKE_C_FLAGS_RELEASE "-fno-omit-frame-pointer -fno-tree-dce ${CMAKE_C_FLAGS_RELEASE}")
-    set(CMAKE_CXX_FLAGS_RELEASE "-fno-omit-frame-pointer -fno-tree-dce ${CMAKE_CXX_FLAGS_RELEASE}")
-endif ()
-
-
 if (ENABLE_SPELLCHECK)
     find_package(Enchant REQUIRED)
 endif ()
index ff145fd..6583db6 100644 (file)
@@ -336,12 +336,12 @@ set(SHOULD_INSTALL_JS_SHELL ON)
 # Push of rbp is needed after JSC JIT uses CStack. See http://wkbug.com/127777.
 if (UNIX AND NOT APPLE)
     if (CMAKE_COMPILER_IS_GNUCXX)
-        set(CMAKE_C_FLAGS_RELEASE "-fno-omit-frame-pointer -fno-tree-dce ${CMAKE_C_FLAGS_RELEASE}")
-        set(CMAKE_CXX_FLAGS_RELEASE "-fno-omit-frame-pointer -fno-tree-dce ${CMAKE_CXX_FLAGS_RELEASE}")
+        set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-omit-frame-pointer -fno-tree-dce")
+        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-omit-frame-pointer -fno-tree-dce")
     endif ()
     if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
-        set(CMAKE_C_FLAGS_RELEASE "-fno-omit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
-        set(CMAKE_CXX_FLAGS_RELEASE "-fno-omit-frame-pointer ${CMAKE_CXX_FLAGS_RELEASE}")
+        set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-omit-frame-pointer")
+        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-omit-frame-pointer")
     endif ()
 endif ()