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