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