more possible build options (use / don't use such libraries as QWT, KChart, ThreadWeaver)
authorAlexey Chernobaev <achernobaev@dev.rtsoft.ru>
Fri, 30 Mar 2018 20:09:35 +0000 (23:09 +0300)
committerAlexey Chernobaev <achernobaev@dev.rtsoft.ru>
Fri, 30 Mar 2018 20:09:35 +0000 (23:09 +0300)
src/analyze/gui/aboutdialog.cpp
src/analyze/gui/chartwidgetqwtplot.cpp
src/analyze/gui/histogramwidgetqwtplot.cpp
src/analyze/gui/mainwindow.cpp
src/heaptrack_gui.pro

index 769d8519f36ce2849089f15f04440f9cc983811c..fbadfdb68961457ed010568a540a0644dc491a7e 100644 (file)
@@ -2,6 +2,7 @@
 #include "ui_aboutdialog.h"
 
 #include "aboutdata.h"
+#include "gui_config.h"
 
 #include <math.h>
 #include <QFontMetrics>
@@ -33,13 +34,19 @@ AboutDialog::AboutDialog(QWidget *parent) :
 #endif
         QString(
         "<p>Uses <a href=https://www.qt.io>Qt framework</a> v.%1 libraries on terms of " \
-        "<a href=https://www.gnu.org/licenses/lgpl-3.0.en.html>LGPL</a>.</p>" \
+        "<a href=https://www.gnu.org/licenses/lgpl-3.0.en.html>LGPL</a>.</p>")
+        .arg(QT_VERSION_STR)
+#ifdef THREAD_WEAVER
+        + QString(
         "<p>Uses <a href=https://cgit.kde.org/threadweaver.git>ThreadWeaver library</a> " \
-        "on terms of <a href=https://www.gnu.org/licenses/lgpl-3.0.en.html>LGPL</a>.</p>" \
+        "on terms of <a href=https://www.gnu.org/licenses/lgpl-3.0.en.html>LGPL</a>.</p>")
+#endif
+#ifdef QWT_FOUND
+        + QString(
         "<p>The application is based in part on the work of the " \
         "<a href=http://qwt.sf.net>Qwt project</a> on terms of " \
         "<a href=http://qwt.sourceforge.net/qwtlicense.html>Qwt License</a>.</p>")
-        .arg(QT_VERSION_STR)
+#endif
 #ifdef WINDOWS
         + QString(
         "<p>Application icon (free for commercial use): Jack Cai " \
index 5d4dfde69f4452d4fce96744b7e198dc11c2a730..e9bc8b3613ec5635e7de2eeb4b44b680365f592d 100644 (file)
@@ -116,7 +116,7 @@ ChartOptions::Options ChartOptions::toggleOption(Options option)
 }
 
 ChartWidgetQwtPlot::ChartWidgetQwtPlot(QWidget *parent, Options options)
-    : QwtPlot(parent), m_model(nullptr), m_isSizeModel(false), ChartOptions(options),
+    : QwtPlot(parent), ChartOptions(options), m_model(nullptr), m_isSizeModel(false),
       m_zoomer(new Zoomer(this))
 {
     setCanvasBackground(Qt::white);
index d037725ba0e37d21f968637853a000de01ef8405..5870eb2a87773169e4f59313709201f1f2554668 100644 (file)
@@ -1,7 +1,9 @@
 #include "histogramwidgetqwtplot.h"
 #include "histogrammodel.h"
-#include "noklib.h"
 #include "util.h"
+#ifdef NO_K_LIB
+#include "noklib.h"
+#endif
 
 #include <math.h>
 
index 0b99bd7daff680c463c7b41a732907d6f57ed8c7..5affcde8e51c75b7def3d0398533781f6eed867f 100644 (file)
@@ -25,6 +25,7 @@
 #include <ui_mainwindow_noklib.h>
 #include <QAbstractButton>
 #include <QFileDialog>
+#include <QSettings>
 #else
 #include <ui_mainwindow.h>
 #include <KConfigGroup>
@@ -64,9 +65,6 @@
 #include "chartwidget.h"
 #include "histogrammodel.h"
 #include "histogramwidget.h"
-#if QWT_FOUND
-#include <QSettings>
-#endif
 #endif
 
 using namespace std;
index abc669984b9fd11ff82dcb119625a0c2d4d23161..f57db3b45b6f0ee3b3ce548bb45e16df54af6c42 100644 (file)
@@ -17,20 +17,27 @@ SAMSUNG_TIZEN_BRANCH {
     TARGET = TizenMemoryProfiler
 }
 
-win32 {
-    # Third-party libraries used:
-    # QWT: http://qwt.sourceforge.net (SVN: https://svn.code.sf.net/p/qwt/code/trunk)
-    # ThreadWeaver: https://cgit.kde.org/threadweaver.git (git://anongit.kde.org/threadweaver.git)
+# uncomment the next line to disable using KDE libraries unconditionally (i.e. on Linux too)
+CONFIG *= NO_K_LIB NO_K_CHART
+
+# Third-party libraries which may be used:
+
+# QWT: http://qwt.sourceforge.net (SVN: https://svn.code.sf.net/p/qwt/code/trunk).
+# Used on Windows but not on Linux by default.
+
+# ThreadWeaver: https://cgit.kde.org/threadweaver.git (git://anongit.kde.org/threadweaver.git).
+# Used on both Windows and Linux by default.
 
+# comment the next line to not use ThreadWeaver library (used to parse data files faster)
+!NO_K_LIB:CONFIG += THREAD_WEAVER
+
+win32 {
     # comment the next line to not use QWT library (charts will not be displayed in this case)
     CONFIG += QWT_CHART
 
-    # comment the next line to not use ThreadWeaver library (used to parse data files faster)
-    CONFIG += THREAD_WEAVER
-
-    CONFIG += NO_K_LIB NO_K_CHART
+    CONFIG *= NO_K_LIB NO_K_CHART
 
-    DEFINES += NO_K_LIB NO_K_CHART WINDOWS
+    DEFINES *= WINDOWS
     INCLUDEPATH += $$(BOOST_LIB)
     LIBS += -L$$(BOOST_LIB)/stage/lib
 
@@ -45,40 +52,20 @@ win32 {
     }
 }
 
-THREAD_WEAVER {
-    DEFINES += THREAD_WEAVER
-    win32 {
-        # ThreadWeaver shall be built beforehand (load ThreadWeaver.pro, edit it if necessary, and build)
-
-        # change the variable if ThreadWeaver headers are located in another directory
-        THREAD_WEAVE_HEADER_PATH = ../../kf5/threadweaver/src/
-
-        INCLUDEPATH += $$THREAD_WEAVE_HEADER_PATH ThreadWeaver
-        CONFIG(debug, debug|release) {
-            win32-msvc:LIBS += $${DESTDIR}/threadweaverd.lib
-        }
-        else {
-            win32-msvc:LIBS += $${DESTDIR}/threadweaver.lib
-        }
-    }
-    unix {
-        QT += ThreadWeaver
-    }
-}
-
 unix {
-    CONFIG *= USE_CHART
-    DEFINES *= USE_CHART
-
-    # uncomment the next line to use QWT instead of KChart
+    # uncomment the next line to use QWT instead of KChart on Linux
 #   CONFIG += QWT_CHART
 
     QWT_CHART {
-        CONFIG *= NO_K_LIB NO_K_CHART QWT_CHART
-        DEFINES *= NO_K_LIB NO_K_CHART
+        CONFIG *= NO_K_CHART USE_CHART QWT_CHART
         INCLUDEPATH += /usr/include/qwt
         LIBS += -lqwt-qt5 # correct the library name if needed (e.g. to 'qwt')
     }
+    else {
+        !NO_K_LIB {
+            CONFIG *= USE_CHART
+        }
+     }
 
     LIBS += -lboost_program_options -lboost_iostreams -lpthread
 }
@@ -89,12 +76,34 @@ QWT_CHART {
     # Windows: file qwt.dll must exist in $${DESTDIR}\release and qwtd.dll in $${DESTDIR}\debug
     # to be able to run the application.
     CONFIG *= USE_CHART QWT
-    DEFINES *= USE_CHART QWT
 }
 
-#Test only!
-#CONFIG *= NO_K_LIB NO_K_CHART
-#DEFINES *= NO_K_LIB NO_K_CHART
+# add defines if have the following values in CONFIG
+NO_K_LIB: DEFINES *= NO_K_LIB
+NO_K_CHART: DEFINES *= NO_K_CHART
+USE_CHART: DEFINES *= USE_CHART
+QWT: DEFINES *= QWT
+
+THREAD_WEAVER {
+    DEFINES += THREAD_WEAVER
+    win32 {
+        # ThreadWeaver shall be built beforehand - use ThreadWeaver.pro file (edit it if necessary)
+
+        # change the variable if ThreadWeaver headers are located in another directory
+        THREAD_WEAVE_HEADER_PATH = ../../kf5/threadweaver/src/
+
+        INCLUDEPATH += $$THREAD_WEAVE_HEADER_PATH ThreadWeaver
+        CONFIG(debug, debug|release) {
+            win32-msvc:LIBS += $${DESTDIR}/threadweaverd.lib
+        }
+        else {
+            win32-msvc:LIBS += $${DESTDIR}/threadweaver.lib
+        }
+    }
+    unix {
+        QT += ThreadWeaver
+    }
+}
 
 SOURCES += \
     analyze/accumulatedtracedata.cpp \
@@ -194,8 +203,10 @@ NO_K_LIB {
 
     FORMS += \
         analyze/gui/mainwindow_noklib.ui \
-        analyze/gui/aboutdialog.ui
 
     RESOURCES += \
         analyze/gui/gui.qrc
 }
+
+FORMS += \
+    analyze/gui/aboutdialog.ui