From 997c77ca18e1c8cd05cf3b27291faac56cc0f188 Mon Sep 17 00:00:00 2001
From: Dominik Schmidt <dev@dominik-schmidt.de>
Date: Sat, 3 Nov 2012 02:15:12 +0100
Subject: [PATCH] Move Tomahawk version info out of config.h, should reduce
 code recompilation/increase ccache cache hits

---
 src/CMakeLists.txt                            |  2 +
 src/Config.h.in                               |  5 ---
 src/DiagnosticsDialog.cpp                     |  1 +
 src/TomahawkApp.cpp                           |  2 +
 src/TomahawkVersion.h.in                      |  9 ++++
 src/infoplugins/generic/charts/CMakeLists.txt | 43 -------------------
 src/libtomahawk/utils/TomahawkUtils.cpp       |  1 +
 7 files changed, 15 insertions(+), 48 deletions(-)
 create mode 100644 src/TomahawkVersion.h.in
 delete mode 100644 src/infoplugins/generic/charts/CMakeLists.txt

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 13bb0ecf4..88e83cc63 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -155,6 +155,8 @@ ENDIF(QCA2_FOUND)
 INCLUDE(GNUInstallDirs)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TomahawkVersion.h.in
+               ${CMAKE_CURRENT_BINARY_DIR}/TomahawkVersion.h)
 
 # translations
 include( ${CMAKE_SOURCE_DIR}/lang/translations.cmake )
diff --git a/src/Config.h.in b/src/Config.h.in
index 82c937d52..7e838925d 100644
--- a/src/Config.h.in
+++ b/src/Config.h.in
@@ -1,11 +1,6 @@
 #ifndef CONFIG_H_IN
 #define CONFIG_H_IN
 
-#cmakedefine TOMAHAWK_ORGANIZATION_NAME "${TOMAHAWK_ORGANIZATION_NAME}"
-#cmakedefine TOMAHAWK_ORGANIZATION_DOMAIN "${TOMAHAWK_ORGANIZATION_DOMAIN}"
-#cmakedefine TOMAHAWK_APPLICATION_NAME "${TOMAHAWK_APPLICATION_NAME}"
-#cmakedefine TOMAHAWK_VERSION "${TOMAHAWK_VERSION}"
-
 #cmakedefine DEBUG_BUILD
 
 #define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
diff --git a/src/DiagnosticsDialog.cpp b/src/DiagnosticsDialog.cpp
index e2055ba87..9e63ccce6 100644
--- a/src/DiagnosticsDialog.cpp
+++ b/src/DiagnosticsDialog.cpp
@@ -21,6 +21,7 @@
 #include "ui_DiagnosticsDialog.h"
 
 #include "config.h"
+#include "TomahawkVersion.h"
 
 #include <QLabel>
 #include <QTextEdit>
diff --git a/src/TomahawkApp.cpp b/src/TomahawkApp.cpp
index 45058fcb8..f55a13b98 100644
--- a/src/TomahawkApp.cpp
+++ b/src/TomahawkApp.cpp
@@ -20,6 +20,8 @@
 
 #include "TomahawkApp.h"
 
+#include "TomahawkVersion.h"
+
 #include <iostream>
 
 #include <QtCore/QPluginLoader>
diff --git a/src/TomahawkVersion.h.in b/src/TomahawkVersion.h.in
new file mode 100644
index 000000000..b8bd18d19
--- /dev/null
+++ b/src/TomahawkVersion.h.in
@@ -0,0 +1,9 @@
+#ifndef TOMAHAWK_VERSION_H
+#define TOMAHAWK_VERSION_H
+
+#cmakedefine TOMAHAWK_ORGANIZATION_NAME "${TOMAHAWK_ORGANIZATION_NAME}"
+#cmakedefine TOMAHAWK_ORGANIZATION_DOMAIN "${TOMAHAWK_ORGANIZATION_DOMAIN}"
+#cmakedefine TOMAHAWK_APPLICATION_NAME "${TOMAHAWK_APPLICATION_NAME}"
+#cmakedefine TOMAHAWK_VERSION "${TOMAHAWK_VERSION}"
+
+#endif // TOMAHAWK_VERSION_H
diff --git a/src/infoplugins/generic/charts/CMakeLists.txt b/src/infoplugins/generic/charts/CMakeLists.txt
deleted file mode 100644
index 36f52e154..000000000
--- a/src/infoplugins/generic/charts/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-project( tomahawk )
-
-include( ${QT_USE_FILE} )
-add_definitions( ${QT_DEFINITIONS} )
-add_definitions( -DQT_PLUGIN )
-add_definitions( -DQT_SHARED )
-add_definitions( -DINFOPLUGINDLLEXPORT_PRO )
-
-set( chartsInfoPluginSources
-    ChartsPlugin.cpp
-)
-
-set( chartsInfoPluginHeaders
-    ChartsPlugin.h
-)
-
-include_directories(
-   ${QT_INCLUDE_DIR}
-)
-
-qt4_wrap_cpp( chartsInfoPluginMoc ${chartsInfoPluginHeaders} )
-add_library( tomahawk_infoplugin_charts SHARED ${chartsInfoPluginSources} ${chartsInfoPluginMoc} ${RC_SRCS} )
-
-IF( WIN32 )
-SET( OS_SPECIFIC_LINK_LIBRARIES
-        ${OS_SPECIFIC_LINK_LIBRARIES}
-        "winmm.dll"
-        "iphlpapi.a"
-)
-ENDIF( WIN32 )
-
-target_link_libraries( tomahawk_infoplugin_charts
-    ${TOMAHAWK_LIBRARIES}
-    ${QT_LIBRARIES}
-    ${OS_SPECIFIC_LINK_LIBRARIES}
-)
-
-IF( APPLE )
-#  SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
-ENDIF( APPLE )
-
-install( TARGETS tomahawk_infoplugin_charts DESTINATION ${CMAKE_INSTALL_LIBDIR} )
-
diff --git a/src/libtomahawk/utils/TomahawkUtils.cpp b/src/libtomahawk/utils/TomahawkUtils.cpp
index d48d48eeb..4adf2aa68 100644
--- a/src/libtomahawk/utils/TomahawkUtils.cpp
+++ b/src/libtomahawk/utils/TomahawkUtils.cpp
@@ -18,6 +18,7 @@
  *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "TomahawkVersion.h"
 #include "config.h"
 #include "HeadlessCheck.h"
 #include "TomahawkSettings.h"