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