xref: /glogg/glogg.pro (revision d96f3f211e1e2a3a5b219145986c18e10b0f96aa)
1# -------------------------------------------------
2# glogg
3# -------------------------------------------------
4TARGET = glogg
5TEMPLATE = app
6
7greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
8
9win32:Debug:CONFIG += console
10# Necessary when cross-compiling:
11win32:Release:QMAKE_LFLAGS += "-Wl,-subsystem,windows"
12
13# Input
14SOURCES += \
15    src/main.cpp \
16    src/session.cpp \
17    src/data/abstractlogdata.cpp \
18    src/data/logdata.cpp \
19    src/data/logfiltereddata.cpp \
20    src/data/logfiltereddataworkerthread.cpp \
21    src/data/logdataworkerthread.cpp \
22    src/mainwindow.cpp \
23    src/crawlerwidget.cpp \
24    src/abstractlogview.cpp \
25    src/logmainview.cpp \
26    src/filteredview.cpp \
27    src/optionsdialog.cpp \
28    src/persistentinfo.cpp \
29    src/configuration.cpp \
30    src/filtersdialog.cpp \
31    src/filterset.cpp \
32    src/savedsearches.cpp \
33    src/infoline.cpp \
34    src/menuactiontooltipbehavior.cpp \
35    src/filewatcher.cpp \
36    src/selection.cpp \
37    src/quickfind.cpp \
38    src/quickfindpattern.cpp \
39    src/quickfindwidget.cpp \
40    src/sessioninfo.cpp \
41    src/recentfiles.cpp \
42    src/overview.cpp \
43    src/overviewwidget.cpp \
44    src/marks.cpp \
45    src/quickfindmux.cpp
46
47INCLUDEPATH += src/
48
49HEADERS += \
50    src/data/abstractlogdata.h \
51    src/data/logdata.h \
52    src/data/logfiltereddata.h \
53    src/data/logfiltereddataworkerthread.h \
54    src/data/logdataworkerthread.h \
55    src/mainwindow.h \
56    src/session.h \
57    src/viewinterface.h \
58    src/crawlerwidget.h \
59    src/logmainview.h \
60    src/log.h \
61    src/filteredview.h \
62    src/abstractlogview.h \
63    src/optionsdialog.h \
64    src/persistentinfo.h \
65    src/configuration.h \
66    src/filtersdialog.h \
67    src/filterset.h \
68    src/savedsearches.h \
69    src/infoline.h \
70    src/filewatcher.h \
71    src/selection.h \
72    src/quickfind.h \
73    src/quickfindpattern.h \
74    src/quickfindwidget.h \
75    src/sessioninfo.h \
76    src/persistable.h \
77    src/recentfiles.h \
78    src/menuactiontooltipbehavior.h \
79    src/overview.h \
80    src/overviewwidget.h \
81    src/marks.h \
82    src/qfnotifications.h \
83    src/quickfindmux.h
84
85isEmpty(BOOST_PATH) {
86    message(Building using system dynamic Boost libraries)
87    LIBS += -lboost_program_options
88}
89else {
90    message(Building using static Boost libraries at $$BOOST_PATH)
91
92    SOURCES += $$BOOST_PATH/libs/program_options/src/*.cpp \
93        $$BOOST_PATH/libs/smart_ptr/src/*.cpp
94
95    INCLUDEPATH += $$BOOST_PATH
96}
97
98FORMS += src/optionsdialog.ui
99FORMS += src/filtersdialog.ui
100
101# For Windows icon
102RC_FILE = glogg.rc
103RESOURCES = glogg.qrc
104
105# Build HTML documentation (if 'markdown' is available)
106system(type markdown >/dev/null) {
107    MARKDOWN += doc/documentation.markdown
108}
109else {
110    message("markdown not found, HTML doc will not be generated")
111}
112
113doc_processor.name = markdown
114doc_processor.input = MARKDOWN
115doc_processor.output = doc/${QMAKE_FILE_BASE}.html
116doc_processor.commands = markdown ${QMAKE_FILE_NAME} | \
117    sed -f finish.sed >${QMAKE_FILE_OUT}
118
119doc_processor.CONFIG += target_predeps
120doc_processor.variable_out = doc.files
121
122QMAKE_EXTRA_COMPILERS += doc_processor
123
124# Install (for unix)
125icon16.path  = $$PREFIX/share/icons/hicolor/16x16/apps
126icon16.files = images/hicolor/16x16/glogg.png
127
128icon32.path  = $$PREFIX/share/icons/hicolor/32x32/apps
129icon32.files = images/hicolor/32x32/glogg.png
130
131icon_svg.path  = $$PREFIX/share/icons/hicolor/scalable/apps
132icon_svg.files = images/hicolor/scalable/glogg.svg
133
134doc.path  = $$PREFIX/share/doc/glogg
135doc.files += README COPYING
136
137desktop.path = $$PREFIX/share/applications
138desktop.files = glogg.desktop
139
140target.path = $$PREFIX/bin
141INSTALLS = target icon16 icon32 icon_svg doc desktop
142
143# Build directories
144debug:OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
145release:OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
146debug:MOC_DIR = $${OUT_PWD}/.moc/debug-shared
147release:MOC_DIR = $${OUT_PWD}/.moc/release-shared
148debug:UI_DIR = $${OUT_PWD}/.ui/debug-shared
149release:UI_DIR = $${OUT_PWD}/.ui/release-shared
150
151# Debug symbols in debug builds
152debug:QMAKE_CXXFLAGS += -g
153
154# Which compiler are we using
155system( g++ --version | grep -e " 4\.6" ) {
156    message ( "g++ version < 4.7, supports C++0x" )
157    CONFIG += C++0x
158}
159else {
160    system( g++ --version | grep -e " 4\.[7-9]" ) {
161        message ( "g++ version 4.7 or newer, supports C++11" )
162        CONFIG += C++11
163    }
164    else {
165        error ( "glogg requires g++ version 4.6 or later" )
166    }
167}
168
169# Extra compiler arguments
170# QMAKE_CXXFLAGS += -Weffc++
171QMAKE_CXXFLAGS += -Wextra
172C++0x:QMAKE_CXXFLAGS += -std=c++0x
173C++11:QMAKE_CXXFLAGS += -std=c++11
174
175GPROF {
176    QMAKE_CXXFLAGS += -pg
177    QMAKE_LFLAGS   += -pg
178}
179
180isEmpty(LOG_LEVEL) {
181    Release:DEFINES += FILELOG_MAX_LEVEL=\"logERROR\"
182    Debug:DEFINES += FILELOG_MAX_LEVEL=\"logDEBUG4\"
183}
184else {
185    message("Using specified log level: $$LOG_LEVEL")
186    DEFINES += FILELOG_MAX_LEVEL=\"$$LOG_LEVEL\"
187}
188
189# Official builds can be generated with `qmake VERSION="1.2.3"'
190isEmpty(VERSION):system(date >/dev/null) {
191    system([ -f .tarball-version ]) {
192        QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"`cat .tarball-version`\\\"
193    }
194    else {
195        QMAKE_CXXFLAGS += -DGLOGG_DATE=\\\"`date +'\"%F\"'`\\\"
196        QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"`git describe`\\\"
197        QMAKE_CXXFLAGS += -DGLOGG_COMMIT=\\\"`git rev-parse --short HEAD`\\\"
198    }
199}
200else {
201    QMAKE_CXXFLAGS += -DGLOGG_VERSION=\\\"$$VERSION\\\"
202}
203
204