xref: /glogg/glogg.pro (revision b98eb3aea1f13bea9503b0cadb287cf6cc68ef1d)
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
195# Which compiler are we using
196system( $${QMAKE_CXX} --version | grep -e " 4\\.[7-9]" ) || macx {
197    message ( "g++ version 4.7 or newer, supports C++11" )
198    CONFIG += C++11
199}
200else {
201    CONFIG += C++0x
202}
203
204# Extra compiler arguments
205# QMAKE_CXXFLAGS += -Weffc++
206QMAKE_CXXFLAGS += -Wextra
207C++0x:QMAKE_CXXFLAGS += -std=c++0x
208C++11:QMAKE_CXXFLAGS += -std=c++11
209
210GPROF {
211    QMAKE_CXXFLAGS += -pg
212    QMAKE_LFLAGS   += -pg
213}
214
215isEmpty(LOG_LEVEL) {
216    CONFIG(debug, debug|release) {
217        DEFINES += FILELOG_MAX_LEVEL=\"logDEBUG4\"
218    } else {
219        DEFINES += FILELOG_MAX_LEVEL=\"logDEBUG\"
220    }
221}
222else {
223    message("Using specified log level: $$LOG_LEVEL")
224    DEFINES += FILELOG_MAX_LEVEL=\"$$LOG_LEVEL\"
225}
226
227macx {
228    QMAKE_CXXFLAGS += -stdlib=libc++
229    QMAKE_LFLAGS += -stdlib=libc++
230
231    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
232
233    QMAKE_INFO_PLIST = Info.plist
234}
235
236# Official builds can be generated with `qmake VERSION="1.2.3"'
237isEmpty(VERSION):system(date >/dev/null) {
238    system([ -f .tarball-version ]) {
239        QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"`cat .tarball-version`\\\"
240    }
241    else {
242        QMAKE_CXXFLAGS += -DGLOGG_DATE=\\\"`date +'\"%F\"'`\\\"
243        QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"`git describe`\\\"
244        QMAKE_CXXFLAGS += -DGLOGG_COMMIT=\\\"`git rev-parse --short HEAD`\\\"
245    }
246}
247else {
248    QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"$$VERSION\\\"
249}
250
251# Optional features (e.g. CONFIG+=no-dbus)
252system(pkg-config --exists QtDBus):!no-dbus {
253    message("Support for D-BUS will be included")
254    QT += dbus
255    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_DBUS
256    SOURCES += src/dbusexternalcom.cpp
257    HEADERS += src/dbusexternalcom.h
258}
259else {
260    message("Support for D-BUS will NOT be included")
261    win32 || macx {
262        message("Support for cross-platform IPC will be included")
263        QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_SOCKETIPC
264        SOURCES += src/socketexternalcom.cpp
265        HEADERS += src/socketexternalcom.h
266    }
267}
268
269# Version checking
270version_checker {
271    message("Version checker will be included")
272    QT += network
273    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_VERSION_CHECKING
274    SOURCES += src/versionchecker.cpp
275    HEADERS += src/versionchecker.h
276}
277else {
278    message("Version checker will NOT be included")
279}
280
281# File watching
282linux-g++ || linux-g++-64 {
283    CONFIG += inotify
284}
285
286win32 {
287    message("File watching using Windows")
288    SOURCES += src/platformfilewatcher.cpp src/winwatchtowerdriver.cpp src/watchtower.cpp src/watchtowerlist.cpp
289    HEADERS += src/platformfilewatcher.h src/winwatchtowerdriver.h src/watchtower.h src/watchtowerlist.h
290    QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_POLLING
291}
292else {
293    inotify {
294        message("File watching using inotify")
295        QMAKE_CXXFLAGS += -DGLOGG_SUPPORTS_INOTIFY
296        SOURCES += src/platformfilewatcher.cpp src/inotifywatchtowerdriver.cpp src/watchtower.cpp src/watchtowerlist.cpp
297        HEADERS += src/platformfilewatcher.h src/inotifywatchtowerdriver.h src/watchtower.h src/watchtowerlist.h
298    }
299    else {
300        message("File watching using Qt")
301        SOURCES += src/qtfilewatcher.cpp
302        HEADERS += src/qtfilewatcher.h
303    }
304}
305
306# Performance measurement
307perf {
308    QMAKE_CXXFLAGS += -DGLOGG_PERF_MEASURE_FPS
309}
310