[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 03/06: Use link time optimization if available.

noreply at xfce.org noreply at xfce.org
Wed Jan 22 21:48:23 CET 2020


This is an automated email from the git hooks/post-receive script.

g   o   t   t   c   o   d   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-whiskermenu-plugin.

commit cd0f2116a4672397b5fd5e90c8c3ba82780a3fd0
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Jan 16 16:07:44 2020 -0500

    Use link time optimization if available.
---
 CMakeLists.txt              |  3 ++-
 INSTALL                     |  3 +++
 panel-plugin/CMakeLists.txt | 12 ++++++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a42695e..0fff3a1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.9)
 
 project(whiskermenu)
 
@@ -23,6 +23,7 @@ endif()
 option(ENABLE_VISIBILITY "Enable ELF visibility attributes" ON)
 option(ENABLE_AS_NEEDED "Enable -Wl,--as-needed for the linker" ON)
 option(ENABLE_LINKER_OPTIMIZED_HASH_TABLES "Enable -Wl,-O1 for the linker" ON)
+option(ENABLE_LINK_TIME_OPTIMIZATION "Enable link time optimization" ON)
 option(ENABLE_DEVELOPER_MODE "Enable strict checks to help with development" OFF)
 
 include(GNUInstallDirs)
diff --git a/INSTALL b/INSTALL
index 2a3cf62..2c2784f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -81,6 +81,9 @@ More CMake Options
 -DENABLE_LINKER_OPTIMIZED_HASH_TABLES=[ON]
     Pass -Wl,-O1 to the linker to optimize hash tables in plugin.
 
+-DENABLE_LINK_TIME_OPTIMIZATION=[ON]
+    Reduce size by optimizing entire plugin at link time.
+
 -DENABLE_DEVELOPER_MODE=[OFF]
     Enable strict checks which are not needed by users of the plugin
     but are useful for development.
diff --git a/panel-plugin/CMakeLists.txt b/panel-plugin/CMakeLists.txt
index 14178f0..5344a4f 100644
--- a/panel-plugin/CMakeLists.txt
+++ b/panel-plugin/CMakeLists.txt
@@ -105,8 +105,16 @@ target_link_libraries(whiskermenu
 	${libxfce4util_LIBRARIES})
 
 string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER)
-if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "release|minsizerel")
-	add_definitions(-DNDEBUG -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT)
+if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "release|minsizerel|relwithdebinfo")
+	if(ENABLE_LINK_TIME_OPTIMIZATION)
+		include(CheckIPOSupported)
+		check_ipo_supported(RESULT result)
+		if(result)
+			set_property(TARGET whiskermenu PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
+		endif()
+	endif()
+
+	add_definitions(-DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT)
 	add_custom_command(TARGET whiskermenu
 		POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:whiskermenu>)
 endif()

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list