xref: /glogg/glogg.pro (revision 58ab9c5330b6011b7e977bd08f974c1c65f5d8d6)
1# -------------------------------------------------
2# glogg
3# -------------------------------------------------
4
5# Debug builds: qmake CONFIG+=debug
6# Release builds: qmake
7
8TARGET = glogg
9TEMPLATE = app
10
11greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
12
13win32:Debug:CONFIG += console
14
15# Necessary when cross-compiling:
16win32:Release:QMAKE_LFLAGS += "-Wl,-subsystem,windows"
17
18# Input
19SOURCES += \
20    src/main.cpp \
21    src/session.cpp \
22    src/data/abstractlogdata.cpp \
23    src/data/logdata.cpp \
24    src/data/logfiltereddata.cpp \
25    src/data/logfiltereddataworkerthread.cpp \
26    src/data/logdataworkerthread.cpp \
27    src/data/compressedlinestorage.cpp \
28    src/mainwindow.cpp \
29    src/crawlerwidget.cpp \
30    src/abstractlogview.cpp \
31    src/logmainview.cpp \
32    src/filteredview.cpp \
33    src/optionsdialog.cpp \
34    src/persistentinfo.cpp \
35    src/configuration.cpp \
36    src/filtersdialog.cpp \
37    src/filterset.cpp \
38    src/savedsearches.cpp \
39    src/infoline.cpp \
40    src/menuactiontooltipbehavior.cpp \
41    src/selection.cpp \
42    src/quickfind.cpp \
43    src/quickfindpattern.cpp \
44    src/quickfindwidget.cpp \
45    src/sessioninfo.cpp \
46    src/recentfiles.cpp \
47    src/overview.cpp \
48    src/overviewwidget.cpp \
49    src/marks.cpp \
50    src/quickfindmux.cpp \
51    src/signalmux.cpp \
52    src/tabbedcrawlerwidget.cpp \
53
54INCLUDEPATH += src/
55
56HEADERS += \
57    src/data/abstractlogdata.h \
58    src/data/logdata.h \
59    src/data/logfiltereddata.h \
60    src/data/logfiltereddataworkerthread.h \
61    src/data/logdataworkerthread.h \
62    src/mainwindow.h \
63    src/session.h \
64    src/viewinterface.h \
65    src/crawlerwidget.h \
66    src/logmainview.h \
67    src/log.h \
68    src/filteredview.h \
69    src/abstractlogview.h \
70    src/optionsdialog.h \
71    src/persistentinfo.h \
72    src/configuration.h \
73    src/filtersdialog.h \
74    src/filterset.h \
75    src/savedsearches.h \
76    src/infoline.h \
77    src/filewatcher.h \
78    src/selection.h \
79    src/quickfind.h \
80    src/quickfindpattern.h \
81    src/quickfindwidget.h \
82    src/sessioninfo.h \
83    src/persistable.h \
84    src/recentfiles.h \
85    src/menuactiontooltipbehavior.h \
86    src/overview.h \
87    src/overviewwidget.h \
88    src/marks.h \
89    src/qfnotifications.h \
90    src/quickfindmux.h \
91    src/signalmux.h \
92    src/tabbedcrawlerwidget.h \
93    src/loadingstatus.h \
94    src/externalcom.h \
95
96isEmpty(BOOST_PATH) {
97    message(Building using system dynamic Boost libraries)
98    LIBS += -lboost_program_options
99}
100else {
101    message(Building using static Boost libraries at $$BOOST_PATH)
102
103    SOURCES += $$BOOST_PATH/libs/program_options/src/*.cpp \
104        $$BOOST_PATH/libs/smart_ptr/src/*.cpp
105
106    INCLUDEPATH += $$BOOST_PATH
107}
108
109FORMS += src/optionsdialog.ui
110FORMS += src/filtersdialog.ui
111
112# For Windows icon
113RC_FILE = glogg.rc
114RESOURCES = glogg.qrc
115
116# Build HTML documentation (if 'markdown' is available)
117system(type markdown >/dev/null) {
118    MARKDOWN += doc/documentation.markdown
119}
120else {
121    message("markdown not found, HTML doc will not be generated")
122}
123
124doc_processor.name = markdown
125doc_processor.input = MARKDOWN
126doc_processor.output = doc/${QMAKE_FILE_BASE}.html
127doc_processor.commands = markdown ${QMAKE_FILE_NAME} | \
128    sed -f finish.sed >${QMAKE_FILE_OUT}
129
130doc_processor.CONFIG += target_predeps
131doc_processor.variable_out = doc.files
132
133QMAKE_EXTRA_COMPILERS += doc_processor
134
135# Install (for unix)
136icon16.path  = $$PREFIX/share/icons/hicolor/16x16/apps
137icon16.files = images/hicolor/16x16/glogg.png
138
139icon32.path  = $$PREFIX/share/icons/hicolor/32x32/apps
140icon32.files = images/hicolor/32x32/glogg.png
141
142icon_svg.path  = $$PREFIX/share/icons/hicolor/scalable/apps
143icon_svg.files = images/hicolor/scalable/glogg.svg
144
145doc.path  = $$PREFIX/share/doc/glogg
146doc.files += README COPYING
147
148desktop.path = $$PREFIX/share/applications
149desktop.files = glogg.desktop
150
151target.path = $$PREFIX/bin
152INSTALLS = target icon16 icon32 icon_svg doc desktop
153
154# Build directories
155CONFIG(debug, debug|release) {
156    DESTDIR = debug
157} else {
158    DESTDIR = release
159}
160
161OBJECTS_DIR = $${OUT_PWD}/.obj/$${DESTDIR}-shared
162MOC_DIR = $${OUT_PWD}/.moc/$${DESTDIR}-shared
163UI_DIR = $${OUT_PWD}/.ui/$${DESTDIR}-shared
164
165# Debug symbols even in release build
166QMAKE_CXXFLAGS = -g
167
168# Which compiler are we using
169system( $${QMAKE_CXX} --version | grep -e " 4\\.[7-9]" ) {
170    message ( "g++ version 4.7 or newer, supports C++11" )
171    CONFIG += C++11
172}
173else {
174    CONFIG += C++0x
175}
176
177# Extra compiler arguments
178# QMAKE_CXXFLAGS += -Weffc++
179QMAKE_CXXFLAGS += -Wextra
180C++0x:QMAKE_CXXFLAGS += -std=c++0x
181C++11:QMAKE_CXXFLAGS += -std=c++11
182
183GPROF {
184    QMAKE_CXXFLAGS += -pg
185    QMAKE_LFLAGS   += -pg
186}
187
188isEmpty(LOG_LEVEL) {
189    CONFIG(debug, debug|release) {
190        DEFINES += FILELOG_MAX_LEVEL=\"logDEBUG4\"
191    } else {
192        DEFINES += FILELOG_MAX_LEVEL=\"logDEBUG\"
193    }
194}
195else {
196    message("Using specified log level: $$LOG_LEVEL")
197    DEFINES += FILELOG_MAX_LEVEL=\"$$LOG_LEVEL\"
198}
199
200# Official builds can be generated with `qmake VERSION="1.2.3"'
201isEmpty(VERSION):system(date >/dev/null) {
202    system([ -f .tarball-version ]) {
203        QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"`cat .tarball-version`\\\"
204    }
205    else {
206        QMAKE_CXXFLAGS += -DGLOGG_DATE=\\\"`date +'\"%F\"'`\\\"
207        QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"`git describe`\\\"
208        QMAKE_CXXFLAGS += -DGLOGG_COMMIT=\\\"`git rev-parse --short HEAD`\\\"
209    }
210}
211else {
212    QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"$$VERSION\\\"
213}
214
215# Optional features (e.g. CONFIG+=no-dbus)
216system(pkg-config --exists QtDBus):!no-dbus {
217    message("Support for D-BUS will be included")
218    QT += dbus
219    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_DBUS
220    SOURCES += src/dbusexternalcom.cpp
221    HEADERS += src/dbusexternalcom.h
222}
223else {
224    message("Support for D-BUS will NOT be included")
225    win32 {
226        message("Support for Windows IPC will be included")
227        QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_WINIPC
228        SOURCES += src/winexternalcom.cpp
229        HEADERS += src/winexternalcom.h
230    }
231}
232
233# Version checking
234version_checker {
235    message("Version checker will be included")
236    QT += network
237    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_VERSION_CHECKING
238    SOURCES += src/versionchecker.cpp
239    HEADERS += src/versionchecker.h
240}
241else {
242    message("Version checker will NOT be included")
243}
244
245# File watching
246linux-g++ || linux-g++-64 {
247    CONFIG += inotify
248}
249
250inotify {
251    message("File watching using inotify")
252    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_INOTIFY
253    SOURCES += src/platformfilewatcher.cpp src/inotifywatchtowerdriver.cpp src/watchtower.cpp src/watchtowerlist.cpp
254    HEADERS += src/platformfilewatcher.h src/inotifywatchtowerdriver.h src/watchtower.h src/watchtowerlist.h
255}
256else {
257    win32 {
258        message("File watching using Windows")
259        SOURCES += src/platformfilewatcher.cpp src/winwatchtowerdriver.cpp src/watchtower.cpp src/watchtowerlist.cpp
260        HEADERS += src/platformfilewatcher.h src/winwatchtowerdriver.h src/watchtower.h src/watchtowerlist.h
261    }
262    else {
263        message("File watching using Qt")
264        SOURCES += src/qtfilewatcher.cpp
265        HEADERS += src/qtfilewatcher.h
266    }
267}
268
269# Performance measurement
270perf {
271    QMAKE_CXXFLAGS += -DGLOGG_PERF_MEASURE_FPS
272}
273