[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 16/23: Improve build system.

noreply at xfce.org noreply at xfce.org
Sat Aug 20 18:34:14 CEST 2016


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

gottcode pushed a commit to annotated tag v1.2.1
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 54ecbf94ea29bf9ec0a3b06dbd92c606fe1eda3d
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Oct 31 08:42:55 2013 -0400

    Improve build system.
---
 CMakeLists.txt             |  33 ++++++++---
 INSTALL                    |  17 +++++-
 src/CMakeLists.txt         | 138 ++++++++++++++++++++++-----------------------
 src/panel_plugin.cpp       |   2 +-
 xfce4-popup-whiskermenu.in |   2 +-
 5 files changed, 110 insertions(+), 82 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 989fb26..055101d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,13 +1,30 @@
 cmake_minimum_required(VERSION 2.8)
 if(${CMAKE_VERSION} VERSION_LESS "2.8.8")
-    cmake_policy(SET CMP0002 OLD)
+	cmake_policy(SET CMP0002 OLD)
 endif()
 
 project(whiskermenu)
 
+# version number
+set(whiskermenu_version_major "1")
+set(whiskermenu_version_minor "2")
+set(whiskermenu_version_micro "0")
+set(whiskermenu_version_tag "git")
+set(whiskermenu_version "${whiskermenu_version_major}.${whiskermenu_version_minor}.${whiskermenu_version_micro}")
+if(${whiskermenu_version_tag} MATCHES "git")
+	if(NOT DEFINED whiskermenu_version_build)
+		execute_process(COMMAND git describe
+			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+			OUTPUT_VARIABLE whiskermenu_version_build)
+		string(REGEX REPLACE "^.*-g" "" whiskermenu_version_build "${whiskermenu_version_build}")
+	endif()
+	set(whiskermenu_version "${whiskermenu_version}.${whiskermenu_version_tag}-${whiskermenu_version_build}")
+endif()
+
 # options
 option(ENABLE_WERROR "Enable -Werror flag for development" OFF)
 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)
 
 include(GNUInstallDirs)
 
@@ -17,16 +34,16 @@ add_subdirectory(icons)
 
 # popup script
 configure_file(${PROJECT_SOURCE_DIR}/xfce4-popup-whiskermenu.in
-    ${PROJECT_BINARY_DIR}/xfce4-popup-whiskermenu ESCAPE_QUOTES @ONLY)
+	${PROJECT_BINARY_DIR}/xfce4-popup-whiskermenu ESCAPE_QUOTES @ONLY)
 install(PROGRAMS ${PROJECT_BINARY_DIR}/xfce4-popup-whiskermenu
-    DESTINATION ${CMAKE_INSTALL_BINDIR})
+	DESTINATION ${CMAKE_INSTALL_BINDIR})
 install(FILES ${PROJECT_SOURCE_DIR}/xfce4-popup-whiskermenu.1
-    DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
+	DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
 
 # uninstall target
 configure_file(
-    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake.in
-    ${CMAKE_CURRENT_BINARY_DIR}/cmake/uninstall.cmake
-    IMMEDIATE @ONLY)
+	${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake.in
+	${CMAKE_CURRENT_BINARY_DIR}/cmake/uninstall.cmake
+	IMMEDIATE @ONLY)
 add_custom_target(uninstall
-    ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/uninstall.cmake)
+	${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/uninstall.cmake)
diff --git a/INSTALL b/INSTALL
index 66c1a15..569d691 100644
--- a/INSTALL
+++ b/INSTALL
@@ -37,7 +37,7 @@ You should create different directories for each type of build:
 
   1. `mkdir debug && cd debug' to create a location for building.
 
-  2. `cmake -DCMAKE_BUILD_TYPE=Debugfull ..' to configure the sources.
+  2. `cmake -DCMAKE_BUILD_TYPE=Debug ..' to configure the sources.
 
   3. `make' to compile the plugin.
 
@@ -46,7 +46,7 @@ More CMake Options
 
 -DCMAKE_BUILD_TYPE=<type>
     Choose the type of build. Possible values are:
-      'Release' 'RelWithDebInfo' 'Debug' 'Debugfull' 'Profile'
+      'None' 'Debug' 'Release' 'RelWithDebInfo' 'MinSizeRel'
 
 -DCMAKE_INSTALL_PREFIX=<path>
     Choose the base location where the plugin is installed
@@ -67,3 +67,16 @@ More CMake Options
 -DCMAKE_INSTALL_LOCALEDIR=<path>
     Choose where the localization files are installed
     (defaults to $CMAKE_INSTALL_DATADIR/locale).
+
+-DCMAKE_INSTALL_MANDIR=<path>
+    Choose where manual pages are installed
+    (defaults to $CMAKE_INSTALL_DATADIR/man).
+
+-ENABLE_WERROR=[OFF]
+    Make compiler treat warnings as errors for development.
+
+-ENABLE_AS_NEEDED=[ON]
+    Pass -Wl,--as-needed to the linker to reduce symbols in plugin.
+
+-ENABLE_LINKER_OPTIMIZED_HASH_TABLES=[ON]
+    Pass -Wl,-O1 to the linker to optimize hash tables in plugin.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e60e6f9..14e966d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,98 +1,96 @@
 set(WHISKERMENU_FLAGS "-Wall -Wextra")
 if(ENABLE_WERROR)
-    set(WHISKERMENU_FLAGS "${WHISKERMENU_FLAGS} -Werror")
+	set(WHISKERMENU_FLAGS "${WHISKERMENU_FLAGS} -Werror")
 endif()
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WHISKERMENU_FLAGS}")
-set(CMAKE_CXX_FLAGS "-fvisibility=hidden ${WHISKERMENU_FLAGS} ${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden ${WHISKERMENU_FLAGS}")
+
 if(ENABLE_AS_NEEDED)
-    set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_SHARED_LINKER_FLAGS}")
+	set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
+endif()
+if(ENABLE_LINKER_OPTIMIZED_HASH_TABLES)
+	set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-O1")
 endif()
 
 find_package(GTK2 REQUIRED)
 find_package(PkgConfig REQUIRED)
 pkg_check_modules(exo REQUIRED exo-1)
 pkg_check_modules(garcon REQUIRED garcon-1)
-pkg_check_modules(libxfce4panel REQUIRED libxfce4panel-1.0>=4.8)
-pkg_check_modules(libxfce4ui REQUIRED libxfce4ui-1>=4.8)
-pkg_check_modules(libxfce4util REQUIRED libxfce4util-1.0>=4.8)
-
-if (NOT DEFINED DISABLE_DEPRECATED)
-    if(${libxfce4panel_VERSION} VERSION_LESS "4.10")
-        set(DISABLE_DEPRECATED OFF)
-    else()
-        set(DISABLE_DEPRECATED ON)
-    endif()
-endif()
+pkg_check_modules(libxfce4panel REQUIRED libxfce4panel-1.0>=4.7)
+pkg_check_modules(libxfce4ui REQUIRED libxfce4ui-1>=4.7)
+pkg_check_modules(libxfce4util REQUIRED libxfce4util-1.0>=4.7)
 
 include_directories(
-    ${exo_INCLUDE_DIRS}
-    ${garcon_INCLUDE_DIRS}
-    ${libxfce4panel_INCLUDE_DIRS}
-    ${libxfce4ui_INCLUDE_DIRS}
-    ${libxfce4util_INCLUDE_DIRS}
-    ${GTK2_INCLUDE_DIRS})
+	${exo_INCLUDE_DIRS}
+	${garcon_INCLUDE_DIRS}
+	${libxfce4panel_INCLUDE_DIRS}
+	${libxfce4ui_INCLUDE_DIRS}
+	${libxfce4util_INCLUDE_DIRS}
+	${GTK2_INCLUDE_DIRS})
 
 link_directories(
-    ${exo_LIBRARY_DIRS}
-    ${garcon_LIBRARY_DIRS}
-    ${libxfce4panel_LIBRARY_DIRS}
-    ${libxfce4ui_LIBRARY_DIRS}
-    ${libxfce4util_LIBRARY_DIRS})
+	${exo_LIBRARY_DIRS}
+	${garcon_LIBRARY_DIRS}
+	${libxfce4panel_LIBRARY_DIRS}
+	${libxfce4ui_LIBRARY_DIRS}
+	${libxfce4util_LIBRARY_DIRS})
 
 add_definitions(
-    -DGETTEXT_PACKAGE="xfce4-whiskermenu-plugin"
-    -DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
-    -DGSEAL_ENABLE=1
-    -DGDK_DISABLE_SINGLE_INCLUDES=1
-    -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES=1
-    -DGTK_DISABLE_SINGLE_INCLUDES=1
-    -DGTK_MULTIHEAD_SAFE=1
-    ${exo_CFLAGS_OTHER}
-    ${garcon_CFLAGS_OTHER}
-    ${libxfce4panel_CFLAGS_OTHER}
-    ${libxfce4ui_CFLAGS_OTHER}
-    ${libxfce4util_CFLAGS_OTHER})
+	-DGETTEXT_PACKAGE="xfce4-whiskermenu-plugin"
+	-DPACKAGE_LOCALE_DIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
+	-DG_LOG_DOMAIN="whiskermenu"
+	-DGSEAL_ENABLE
+	-DGDK_DISABLE_SINGLE_INCLUDES
+	-DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES
+	-DGTK_DISABLE_SINGLE_INCLUDES
+	-DGTK_MULTIHEAD_SAFE
+	${exo_CFLAGS_OTHER}
+	${garcon_CFLAGS_OTHER}
+	${libxfce4panel_CFLAGS_OTHER}
+	${libxfce4ui_CFLAGS_OTHER}
+	${libxfce4util_CFLAGS_OTHER})
 
-if(${DISABLE_DEPRECATED})
-    add_definitions(
-        -DG_DISABLE_DEPRECATED=1
-        -DGDK_DISABLE_DEPRECATED=1
-        -DGDK_PIXBUF_DISABLE_DEPRECATED=1
-        -DGTK_DISABLE_DEPRECATED=1)
+if(${libxfce4panel_VERSION} VERSION_GREATER "4.9")
+	add_definitions(
+		-DG_DISABLE_DEPRECATED
+		-DGDK_DISABLE_DEPRECATED
+		-DGDK_PIXBUF_DISABLE_DEPRECATED
+		-DGTK_DISABLE_DEPRECATED)
 endif()
 
 add_library(whiskermenu MODULE
-    applications_page.cpp
-    category.cpp
-    configuration_dialog.cpp
-    favorites_page.cpp
-    icon_size.cpp
-    launcher.cpp
-    launcher_model.cpp
-    launcher_view.cpp
-    list_page.cpp
-    menu.cpp
-    page.cpp
-    panel_plugin.cpp
-    query.cpp
-    recent_page.cpp
-    register_plugin.c
-    resizer_widget.cpp
-    search_page.cpp
-    section_button.cpp)
+	applications_page.cpp
+	category.cpp
+	configuration_dialog.cpp
+	favorites_page.cpp
+	icon_size.cpp
+	launcher.cpp
+	launcher_model.cpp
+	launcher_view.cpp
+	list_page.cpp
+	menu.cpp
+	page.cpp
+	panel_plugin.cpp
+	query.cpp
+	recent_page.cpp
+	register_plugin.c
+	resizer_widget.cpp
+	search_page.cpp
+	section_button.cpp)
 
 target_link_libraries(whiskermenu
-    ${exo_LIBRARIES}
-    ${garcon_LIBRARIES}
-    ${libxfce4panel_LIBRARIES}
-    ${libxfce4ui_LIBRARIES}
-    ${libxfce4util_LIBRARIES}
-    ${GTK2_LIBRARIES})
+	${exo_LIBRARIES}
+	${garcon_LIBRARIES}
+	${libxfce4panel_LIBRARIES}
+	${libxfce4ui_LIBRARIES}
+	${libxfce4util_LIBRARIES}
+	${GTK2_LIBRARIES})
 
 string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER)
-if(CMAKE_BUILD_TYPE_TOLOWER MATCHES release)
-    add_definitions(-DG_DISABLE_ASSERT=1)
-    add_custom_command(TARGET whiskermenu POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:whiskermenu>)
+if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "release|minsizerel")
+	add_definitions(-DG_DISABLE_ASSERT)
+	add_custom_command(TARGET whiskermenu
+		POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:whiskermenu>)
 endif()
 
 install(TARGETS whiskermenu LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/xfce4/panel/plugins)
diff --git a/src/panel_plugin.cpp b/src/panel_plugin.cpp
index a65054b..d5b5bf0 100644
--- a/src/panel_plugin.cpp
+++ b/src/panel_plugin.cpp
@@ -31,7 +31,7 @@ using namespace WhiskerMenu;
 
 extern "C" void whiskermenu_construct(XfcePanelPlugin* plugin)
 {
-	xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
+	xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
 	new PanelPlugin(plugin);
 }
 
diff --git a/xfce4-popup-whiskermenu.in b/xfce4-popup-whiskermenu.in
index 90cbf11..1d81213 100644
--- a/xfce4-popup-whiskermenu.in
+++ b/xfce4-popup-whiskermenu.in
@@ -35,7 +35,7 @@ case "$1" in
     exit 0
     ;;
   -V|--version)
-    echo "$(basename $0) 1.2.0"
+    echo "$(basename $0) @whiskermenu_version@"
     echo "Copyright (C) 2013 Graeme Gott"
     exit 0
     ;;

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


More information about the Xfce4-commits mailing list