xref: /glogg/glogg.pro (revision 3d74593658204ffebaef076b1421767643e3041b)
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_FILE = glogg.rc
137}
138
139RESOURCES = glogg.qrc
140
141# Build HTML documentation (if 'markdown' is available)
142system(type markdown >/dev/null) {
143    MARKDOWN += doc/documentation.markdown
144}
145else {
146    message("markdown not found, HTML doc will not be generated")
147}
148
149doc_processor.name = markdown
150doc_processor.input = MARKDOWN
151doc_processor.output = doc/${QMAKE_FILE_BASE}.html
152doc_processor.commands = markdown ${QMAKE_FILE_NAME} | \
153    sed -f finish.sed >${QMAKE_FILE_OUT}
154
155doc_processor.CONFIG += target_predeps
156doc_processor.variable_out = doc.files
157
158QMAKE_EXTRA_COMPILERS += doc_processor
159
160# Install (for unix)
161icon16.path  = $$PREFIX/share/icons/hicolor/16x16/apps
162icon16.files = images/hicolor/16x16/glogg.png
163
164icon32.path  = $$PREFIX/share/icons/hicolor/32x32/apps
165icon32.files = images/hicolor/32x32/glogg.png
166
167icon_svg.path  = $$PREFIX/share/icons/hicolor/scalable/apps
168icon_svg.files = images/hicolor/scalable/glogg.svg
169
170doc.path  = $$PREFIX/share/doc/glogg
171doc.files += README COPYING
172
173desktop.path = $$PREFIX/share/applications
174desktop.files = glogg.desktop
175
176target.path = $$PREFIX/bin
177INSTALLS = target icon16 icon32 icon_svg doc desktop
178
179# Build directories
180CONFIG(debug, debug|release) {
181    DESTDIR = debug
182} else {
183    DESTDIR = release
184}
185
186OBJECTS_DIR = $${OUT_PWD}/.obj/$${DESTDIR}-shared
187MOC_DIR = $${OUT_PWD}/.moc/$${DESTDIR}-shared
188UI_DIR = $${OUT_PWD}/.ui/$${DESTDIR}-shared
189
190# Debug symbols even in release build
191QMAKE_CXXFLAGS = -g
192
193# Which compiler are we using
194system( $${QMAKE_CXX} --version | grep -e " 4\\.[7-9]" ) || macx {
195    message ( "g++ version 4.7 or newer, supports C++11" )
196    CONFIG += C++11
197}
198else {
199    CONFIG += C++0x
200}
201
202# Extra compiler arguments
203# QMAKE_CXXFLAGS += -Weffc++
204QMAKE_CXXFLAGS += -Wextra
205C++0x:QMAKE_CXXFLAGS += -std=c++0x
206C++11:QMAKE_CXXFLAGS += -std=c++11
207
208GPROF {
209    QMAKE_CXXFLAGS += -pg
210    QMAKE_LFLAGS   += -pg
211}
212
213isEmpty(LOG_LEVEL) {
214    CONFIG(debug, debug|release) {
215        DEFINES += FILELOG_MAX_LEVEL=\"logDEBUG4\"
216    } else {
217        DEFINES += FILELOG_MAX_LEVEL=\"logDEBUG\"
218    }
219}
220else {
221    message("Using specified log level: $$LOG_LEVEL")
222    DEFINES += FILELOG_MAX_LEVEL=\"$$LOG_LEVEL\"
223}
224
225macx {
226    QMAKE_CXXFLAGS += -stdlib=libc++
227    QMAKE_LFLAGS += -stdlib=libc++
228
229    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
230
231    QMAKE_INFO_PLIST = Info.plist
232}
233
234# Official builds can be generated with `qmake VERSION="1.2.3"'
235isEmpty(VERSION):system(date >/dev/null) {
236    system([ -f .tarball-version ]) {
237        QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"`cat .tarball-version`\\\"
238    }
239    else {
240        QMAKE_CXXFLAGS += -DGLOGG_DATE=\\\"`date +'\"%F\"'`\\\"
241        QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"`git describe`\\\"
242        QMAKE_CXXFLAGS += -DGLOGG_COMMIT=\\\"`git rev-parse --short HEAD`\\\"
243    }
244}
245else {
246    QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"$$VERSION\\\"
247}
248
249# Optional features (e.g. CONFIG+=no-dbus)
250system(pkg-config --exists QtDBus):!no-dbus {
251    message("Support for D-BUS will be included")
252    QT += dbus
253    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_DBUS
254    SOURCES += src/dbusexternalcom.cpp
255    HEADERS += src/dbusexternalcom.h
256}
257else {
258    message("Support for D-BUS will NOT be included")
259    win32 || macx {
260        message("Support for cross-platform IPC will be included")
261        QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_SOCKETIPC
262        SOURCES += src/socketexternalcom.cpp
263        HEADERS += src/socketexternalcom.h
264    }
265}
266
267# Version checking
268version_checker {
269    message("Version checker will be included")
270    QT += network
271    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_VERSION_CHECKING
272    SOURCES += src/versionchecker.cpp
273    HEADERS += src/versionchecker.h
274}
275else {
276    message("Version checker will NOT be included")
277}
278
279# File watching
280linux-g++ || linux-g++-64 {
281    CONFIG += inotify
282}
283
284win32 {
285    message("File watching using Windows")
286    SOURCES += src/platformfilewatcher.cpp src/winwatchtowerdriver.cpp src/watchtower.cpp src/watchtowerlist.cpp
287    HEADERS += src/platformfilewatcher.h src/winwatchtowerdriver.h src/watchtower.h src/watchtowerlist.h
288    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_POLLING
289}
290else {
291    inotify {
292        message("File watching using inotify")
293        QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_INOTIFY
294        SOURCES += src/platformfilewatcher.cpp src/inotifywatchtowerdriver.cpp src/watchtower.cpp src/watchtowerlist.cpp
295        HEADERS += src/platformfilewatcher.h src/inotifywatchtowerdriver.h src/watchtower.h src/watchtowerlist.h
296    }
297    else {
298        message("File watching using Qt")
299        SOURCES += src/qtfilewatcher.cpp
300        HEADERS += src/qtfilewatcher.h
301    }
302}
303
304# Performance measurement
305perf {
306    QMAKE_CXXFLAGS += -DGLOGG_PERF_MEASURE_FPS
307}
308