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