diff options
author | Olli Salli <ollisal@gmail.com> | 2011-01-20 11:16:16 +0200 |
---|---|---|
committer | Olli Salli <ollisal@gmail.com> | 2011-01-20 17:05:29 +0200 |
commit | 62ff40579b6c9cab83217d5b4b7107a50ddfdf20 (patch) | |
tree | 03b86e6ac9a7002c057ff329bc0fd660e8dd467b | |
parent | 4ec4d9ec563c0d4ac0ec6ca41f47b5a412c8b8ba (diff) |
Prevent full library recompiles when the library version number is changed
Also speeds up the library slightly when debugging is disabled. We could make that yet better though
by reimplementing QDebug's API.
Reviewed-by: Andre Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | TelepathyQt4/debug-internal.h | 10 | ||||
-rw-r--r-- | TelepathyQt4/debug.cpp | 6 | ||||
-rw-r--r-- | config-version.h.in | 1 | ||||
-rw-r--r-- | config.h.in | 1 |
5 files changed, 9 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c7430886..877e58fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,8 +225,9 @@ add_subdirectory(examples) add_subdirectory(tests) add_subdirectory(tools) -# Generate config.h +# Generate config.h and config-version.h configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h) +configure_file(${CMAKE_SOURCE_DIR}/config-version.h.in ${CMAKE_BINARY_DIR}/config-version.h) # Create the uninstall target configure_file( diff --git a/TelepathyQt4/debug-internal.h b/TelepathyQt4/debug-internal.h index cfbdc345..fea6dcd6 100644 --- a/TelepathyQt4/debug-internal.h +++ b/TelepathyQt4/debug-internal.h @@ -24,8 +24,6 @@ #include <QDebug> -#include <config.h> - namespace Tp { @@ -38,16 +36,12 @@ TELEPATHY_QT4_EXPORT QDebug enabledWarning(); inline QDebug debug() { - QDebug debug = enabledDebug(); - debug.nospace() << "tp-qt4 " PACKAGE_VERSION " DEBUG:"; - return debug.space(); + return enabledDebug(); } inline QDebug warning() { - QDebug warning = enabledWarning(); - warning.nospace() << "tp-qt4 " PACKAGE_VERSION " WARNING:"; - return warning.space(); + return enabledWarning(); } #else /* #ifdef ENABLE_DEBUG */ diff --git a/TelepathyQt4/debug.cpp b/TelepathyQt4/debug.cpp index 531f874e..90335754 100644 --- a/TelepathyQt4/debug.cpp +++ b/TelepathyQt4/debug.cpp @@ -23,6 +23,8 @@ #include "debug.h" #include "debug-internal.h" +#include "config-version.h" + #include <QIODevice> /** @@ -104,7 +106,7 @@ void enableWarnings(bool enable) QDebug enabledDebug() { if (debugEnabled) { - return qDebug(); + return qDebug() << "tp-qt4 " PACKAGE_VERSION " DEBUG:"; } else { return QDebug(&discard); } @@ -113,7 +115,7 @@ QDebug enabledDebug() QDebug enabledWarning() { if (warningsEnabled) { - return qWarning(); + return qWarning() << "tp-qt4 " PACKAGE_VERSION " WARN:"; } else { return QDebug(&discard); } diff --git a/config-version.h.in b/config-version.h.in new file mode 100644 index 00000000..28446ec5 --- /dev/null +++ b/config-version.h.in @@ -0,0 +1 @@ +#define PACKAGE_VERSION "@PACKAGE_VERSION@" diff --git a/config.h.in b/config.h.in index 341457db..456e7614 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,4 @@ #define PACKAGE_NAME "@PACKAGE_NAME@" -#define PACKAGE_VERSION "@PACKAGE_VERSION@" #cmakedefine HAVE_QDBUSVARIANT_OPERATOR_EQUAL #cmakedefine HAVE_QDBUSSERVICEWATCHER |