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