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