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