From: Andreas Fink Date: Wed, 9 Jun 2010 15:31:18 +0000 (+0000) Subject: *add* include svn revision in the VERSION_STRING if building with cmake X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=b60f1947e2397dc695dafda288b2989b4415ce02;p=chaz%2Ftint2 *add* include svn revision in the VERSION_STRING if building with cmake --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b521e98..d10ea3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 index 0000000..c6466ab --- /dev/null +++ b/get_svnrev.sh @@ -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 + + diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index c8c0b6b..aec5752 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -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; diff --git a/src/tint.c b/src/tint.c index cbd7dca..23394d9 100644 --- a/src/tint.c +++ b/src/tint.c @@ -31,7 +31,7 @@ #include #include -#include "version.h" +#include #include "server.h" #include "window.h" #include "config.h" diff --git a/src/tint2conf/main.c b/src/tint2conf/main.c index cf27bb9..d419e46 100644 --- a/src/tint2conf/main.c +++ b/src/tint2conf/main.c @@ -28,7 +28,11 @@ #include #include -#include "../version.h" +#ifdef BUILD_CMAKE + #include "version.h" +#else + #include "../version.h" +#endif #include "common.h" #include "theme_view.h"