]> Dogcows Code - chaz/tint2/commitdiff
*add* include svn revision in the VERSION_STRING if building with cmake
authorAndreas Fink <andreas.fink85@googlemail.com>
Wed, 9 Jun 2010 15:31:18 +0000 (15:31 +0000)
committerAndreas Fink <andreas.fink85@googlemail.com>
Wed, 9 Jun 2010 15:31:18 +0000 (15:31 +0000)
CMakeLists.txt
get_svnrev.sh [new file with mode: 0755]
src/systray/systraybar.c
src/tint.c
src/tint2conf/main.c

index b521e98e14616b379b9e70baa0c36523aeabb80a..d10ea3e1f0b4585cb7287d7b382e264219bcfe5d 100644 (file)
@@ -16,7 +16,8 @@ if( NOT IMLIB_BUILD_WITH_X )
   message( FATAL_ERROR "Imlib is not build with x support" )
 endif( NOT IMLIB_BUILD_WITH_X )
 
-include_directories( src
+include_directories( ${PROJECT_BINARY_DIR}
+                     src
                      src/battery
                      src/clock
                      src/systray
@@ -55,7 +56,9 @@ if( ENABLE_BATTERY )
 endif( ENABLE_BATTERY )
 
 if( ENABLE_TINT2CONF )
+  add_definitions( -DBUILD_CMAKE )
   add_subdirectory( src/tint2conf )
+  add_dependencies( tint2conf version )
 endif( ENABLE_TINT2CONF )
 
 
@@ -64,6 +67,8 @@ set( DATADIR ${CMAKE_INSTALL_PREFIX}/share CACHE PATH "Directory for shared data
 set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" )
 set( DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/tint2 CACHE PATH "Directory for documentation files" )
 
+add_custom_target( version ALL "${PROJECT_SOURCE_DIR}/get_svnrev.sh" "\"${PROJECT_SOURCE_DIR}\"" )
+
 add_executable(tint2 ${SOURCES})
 link_directories( ${X11_LIBRARY_DIRS}
                   ${X11_LIBRARY_DIRS}
@@ -82,6 +87,7 @@ target_link_libraries( tint2 ${X11_LIBRARIES}
                              ${IMLIB2_LIBRARIES}
                              rt )
 
+add_dependencies(tint2 version)
 set_target_properties(tint2 PROPERTIES COMPILE_FLAGS -Wall)
 set_target_properties(tint2 PROPERTIES LINK_FLAGS -Wl,--as-needed)
 
diff --git a/get_svnrev.sh b/get_svnrev.sh
new file mode 100755 (executable)
index 0000000..c6466ab
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+FALLBACK="0.10-svn"
+
+if [[ $# -eq 0 ]]; then
+  DIR=.
+else
+  DIR=$1
+fi
+
+if [[ -f version.h ]]; then
+  REV_OLD=$(cat version.h  | cut -d" " -f3)
+else
+  REV_OLD=""
+fi
+
+if [[ -x "$(which svnversion 2>/dev/null)" && -d "${DIR}/.svn" ]] ; then
+  REV=\"$(svnversion -n ${DIR})\"
+else
+  REV=${FALLBACK}
+fi
+
+if [[ ${REV_OLD} != ${REV} ]]; then
+  echo "Building new version.h"
+  echo "#define VERSION_STRING "${REV}"" > version.h
+fi
+
+
index c8c0b6b6ea3b33963e236be0b6a70cc0872528aa..aec5752e603efe84451988c5918938e517ead7f7 100644 (file)
@@ -436,7 +436,6 @@ gboolean add_icon(Window id)
                XSendEvent(server.dsp, id, False, 0xFFFFFF, &e);
        }
 
-       printf("Adding systray with window: %d\n", id);
        traywin = g_new0(TrayWindow, 1);
        traywin->id = parent_window;
        traywin->tray_id = id;
@@ -477,7 +476,6 @@ void remove_icon(TrayWindow *traywin)
 {
        XErrorHandler old;
 
-       printf("Removing systray with window: %d\n", traywin->tray_id);
        // remove from our list
        systray.list_icons = g_slist_remove(systray.list_icons, traywin);
        systray.area.resize = 1;
index cbd7dca1ba847741de85c6ccc934a51508a85399..23394d9ef5a3f6f64ce35b10c7a9b8321d9b682b 100644 (file)
@@ -31,7 +31,7 @@
 #include <Imlib2.h>
 #include <signal.h>
 
-#include "version.h"
+#include <version.h>
 #include "server.h"
 #include "window.h"
 #include "config.h"
index cf27bb9c79a1729c6909c500e83678a4b387f0df..d419e4601f2bcf39d49443259070e48db3e34406 100644 (file)
 #include <glib/gstdio.h>
 #include <glib/gi18n.h>
 
-#include "../version.h"
+#ifdef BUILD_CMAKE
+  #include "version.h"
+#else
+  #include "../version.h"
+#endif
 #include "common.h"
 #include "theme_view.h"
 
This page took 0.028936 seconds and 4 git commands to generate.