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