Fixed #7275 - Make GUI tests buildable

* Use -std=c++11 flag for gcc and clang
 * Use $$PWD variable in qmake files to have correct paths
 * Change tokenizer.simplifyTokenList() to tokenizer.simplifyTokenList2()
 * Add build-generated files to .gitignore
 * Link libpcre only if rules are enabled
This commit is contained in:
Aleksandr Pikalev 2016-01-08 15:21:36 +01:00 committed by Daniel Marjamäki
parent bd2892fde4
commit e92bbf6481
9 changed files with 139 additions and 134 deletions

10
.gitignore vendored
View File

@ -55,6 +55,16 @@ gui/Makefile
gui/Makefile.debug
gui/Makefile.release
gui/qrc_gui.cpp
gui/test/Makefile
gui/test/*/Makefile
gui/test/*/*/Makefile
gui/test/benchmark/simple/benchmark-simple
gui/test/filelist/test-filelist
gui/test/projectfile/test-projectfile
gui/test/translationhandler/test-translationhandler
gui/test/xmlreport/test-xmlreport
gui/test/xmlreportv1/test-xmlreportv1
gui/test/xmlreportv2/test-xmlreportv2
# Doxygen output folder
doxyoutput/

View File

@ -1,2 +1,2 @@
HEADERS += $${BASEPATH}tinyxml2.h
SOURCES += $${BASEPATH}tinyxml2.cpp
HEADERS += $${PWD}/tinyxml2.h
SOURCES += $${PWD}/tinyxml2.cpp

View File

@ -162,8 +162,6 @@ contains(QMAKE_CC, gcc) {
QMAKE_CXXFLAGS += -std=c++0x -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare
}
macx {
contains(QMAKE_CXX, clang++) {
QMAKE_CXXFLAGS += -std=c++11
}
contains(QMAKE_CXX, clang++) {
QMAKE_CXXFLAGS += -std=c++11
}

View File

@ -1,9 +0,0 @@
CONFIG += qtestlib
#DEPENDPATH += . ..
INCLUDEPATH += . ../.. ../../../../lib
LIBS += -L../../../../externals -lpcre
INCLUDEPATH += ../../../externals
BASEPATH = ../../../../lib/
include($$PWD/../../../lib/lib.pri)

View File

@ -57,7 +57,7 @@ void BenchmarkSimple::simplify()
std::istringstream istr(data.constData());
tokenizer.tokenize(istr, "test.cpp");
QBENCHMARK {
tokenizer.simplifyTokenList();
tokenizer.simplifyTokenList2();
}
}
@ -74,7 +74,7 @@ void BenchmarkSimple::tokenizeAndSimplify()
std::istringstream istr(data.constData());
QBENCHMARK {
tokenizer.tokenize(istr, "test.cpp");
tokenizer.simplifyTokenList();
tokenizer.simplifyTokenList2();
}
}

View File

@ -5,7 +5,7 @@ INCLUDEPATH += .
OBJECTS_DIR = ../../build
MOC_DIR = ../../build
include(../common.pri)
include(../../common.pri)
DEFINES += SRCDIR=\\\"$$PWD\\\"

View File

@ -1,28 +1,38 @@
CONFIG += qtestlib
#DEPENDPATH += . ..
INCLUDEPATH += . ../.. ../../../lib
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets # In Qt 5 widgets are in separate module
QT += printsupport # In Qt 5 QPrinter/QPrintDialog are in separate module
}
INCLUDEPATH += $${PWD}/..
LIBS += -L../../../externals -lpcre
INCLUDEPATH += ../../externals
LIBS += -L$$PWD/../../externals
INCLUDEPATH += $${PWD}/../../externals
BASEPATH = ../../../lib/
include($$PWD/../../lib/lib.pri)
include($${PWD}/../../lib/lib.pri)
# GUI
SOURCES += ../../erroritem.cpp \
../../filelist.cpp \
../../projectfile.cpp \
../../report.cpp \
../../translationhandler.cpp \
../../xmlreport.cpp \
../../xmlreportv1.cpp \
../../xmlreportv2.cpp
SOURCES += $${PWD}/../erroritem.cpp \
$${PWD}/../filelist.cpp \
$${PWD}/../projectfile.cpp \
$${PWD}/../report.cpp \
$${PWD}/../translationhandler.cpp \
$${PWD}/../xmlreport.cpp \
$${PWD}/../xmlreportv1.cpp \
$${PWD}/../xmlreportv2.cpp
HEADERS += ../../erroritem.h \
../../filelist.h \
../../projectfile.h \
../../report.h \
../../translationhandler.h \
../../xmlreport.h \
../../xmlreportv1.h \
../../xmlreportv2.h
HEADERS += $${PWD}/../erroritem.h \
$${PWD}/../filelist.h \
$${PWD}/../projectfile.h \
$${PWD}/../report.h \
$${PWD}/../translationhandler.h \
$${PWD}/../xmlreport.h \
$${PWD}/../xmlreportv1.h \
$${PWD}/../xmlreportv2.h
contains(QMAKE_CC, gcc) {
QMAKE_CXXFLAGS += -std=c++11
}
contains(QMAKE_CXX, clang++) {
QMAKE_CXXFLAGS += -std=c++11
}

View File

@ -1,94 +1,92 @@
# no manual edits - this file is autogenerated by dmake
include($$PWD/pcrerules.pri)
BASEPATH = ../externals/tinyxml/
include($$PWD/../externals/tinyxml/tinyxml.pri)
BASEPATH = ../lib/
INCLUDEPATH += ../externals/tinyxml
HEADERS += $${BASEPATH}check.h \
$${BASEPATH}astutils.h \
$${BASEPATH}check.h \
$${BASEPATH}check64bit.h \
$${BASEPATH}checkassert.h \
$${BASEPATH}checkautovariables.h \
$${BASEPATH}checkbool.h \
$${BASEPATH}checkboost.h \
$${BASEPATH}checkbufferoverrun.h \
$${BASEPATH}checkclass.h \
$${BASEPATH}checkcondition.h \
$${BASEPATH}checkexceptionsafety.h \
$${BASEPATH}checkfunctions.h \
$${BASEPATH}checkinternal.h \
$${BASEPATH}checkio.h \
$${BASEPATH}checkleakautovar.h \
$${BASEPATH}checkmemoryleak.h \
$${BASEPATH}checknullpointer.h \
$${BASEPATH}checkother.h \
$${BASEPATH}checkpostfixoperator.h \
$${BASEPATH}checksizeof.h \
$${BASEPATH}checkstl.h \
$${BASEPATH}checkstring.h \
$${BASEPATH}checktype.h \
$${BASEPATH}checkuninitvar.h \
$${BASEPATH}checkunusedfunctions.h \
$${BASEPATH}checkunusedvar.h \
$${BASEPATH}checkvaarg.h \
$${BASEPATH}cppcheck.h \
$${BASEPATH}errorlogger.h \
$${BASEPATH}library.h \
$${BASEPATH}mathlib.h \
$${BASEPATH}path.h \
$${BASEPATH}preprocessor.h \
$${BASEPATH}settings.h \
$${BASEPATH}suppressions.h \
$${BASEPATH}symboldatabase.h \
$${BASEPATH}templatesimplifier.h \
$${BASEPATH}timer.h \
$${BASEPATH}token.h \
$${BASEPATH}tokenize.h \
$${BASEPATH}tokenlist.h \
$${BASEPATH}valueflow.h \
INCLUDEPATH += $$PWD $$PWD/../externals/tinyxml
HEADERS += $${PWD}/check.h \
$${PWD}/astutils.h \
$${PWD}/check.h \
$${PWD}/check64bit.h \
$${PWD}/checkassert.h \
$${PWD}/checkautovariables.h \
$${PWD}/checkbool.h \
$${PWD}/checkboost.h \
$${PWD}/checkbufferoverrun.h \
$${PWD}/checkclass.h \
$${PWD}/checkcondition.h \
$${PWD}/checkexceptionsafety.h \
$${PWD}/checkfunctions.h \
$${PWD}/checkinternal.h \
$${PWD}/checkio.h \
$${PWD}/checkleakautovar.h \
$${PWD}/checkmemoryleak.h \
$${PWD}/checknullpointer.h \
$${PWD}/checkother.h \
$${PWD}/checkpostfixoperator.h \
$${PWD}/checksizeof.h \
$${PWD}/checkstl.h \
$${PWD}/checkstring.h \
$${PWD}/checktype.h \
$${PWD}/checkuninitvar.h \
$${PWD}/checkunusedfunctions.h \
$${PWD}/checkunusedvar.h \
$${PWD}/checkvaarg.h \
$${PWD}/cppcheck.h \
$${PWD}/errorlogger.h \
$${PWD}/library.h \
$${PWD}/mathlib.h \
$${PWD}/path.h \
$${PWD}/preprocessor.h \
$${PWD}/settings.h \
$${PWD}/suppressions.h \
$${PWD}/symboldatabase.h \
$${PWD}/templatesimplifier.h \
$${PWD}/timer.h \
$${PWD}/token.h \
$${PWD}/tokenize.h \
$${PWD}/tokenlist.h \
$${PWD}/valueflow.h \
SOURCES += $${BASEPATH}astutils.cpp \
$${BASEPATH}check.cpp \
$${BASEPATH}check64bit.cpp \
$${BASEPATH}checkassert.cpp \
$${BASEPATH}checkautovariables.cpp \
$${BASEPATH}checkbool.cpp \
$${BASEPATH}checkboost.cpp \
$${BASEPATH}checkbufferoverrun.cpp \
$${BASEPATH}checkclass.cpp \
$${BASEPATH}checkcondition.cpp \
$${BASEPATH}checkexceptionsafety.cpp \
$${BASEPATH}checkfunctions.cpp \
$${BASEPATH}checkinternal.cpp \
$${BASEPATH}checkio.cpp \
$${BASEPATH}checkleakautovar.cpp \
$${BASEPATH}checkmemoryleak.cpp \
$${BASEPATH}checknullpointer.cpp \
$${BASEPATH}checkother.cpp \
$${BASEPATH}checkpostfixoperator.cpp \
$${BASEPATH}checksizeof.cpp \
$${BASEPATH}checkstl.cpp \
$${BASEPATH}checkstring.cpp \
$${BASEPATH}checktype.cpp \
$${BASEPATH}checkuninitvar.cpp \
$${BASEPATH}checkunusedfunctions.cpp \
$${BASEPATH}checkunusedvar.cpp \
$${BASEPATH}checkvaarg.cpp \
$${BASEPATH}cppcheck.cpp \
$${BASEPATH}errorlogger.cpp \
$${BASEPATH}library.cpp \
$${BASEPATH}mathlib.cpp \
$${BASEPATH}path.cpp \
$${BASEPATH}preprocessor.cpp \
$${BASEPATH}settings.cpp \
$${BASEPATH}suppressions.cpp \
$${BASEPATH}symboldatabase.cpp \
$${BASEPATH}templatesimplifier.cpp \
$${BASEPATH}timer.cpp \
$${BASEPATH}token.cpp \
$${BASEPATH}tokenize.cpp \
$${BASEPATH}tokenlist.cpp \
$${BASEPATH}valueflow.cpp
SOURCES += $${PWD}/astutils.cpp \
$${PWD}/check.cpp \
$${PWD}/check64bit.cpp \
$${PWD}/checkassert.cpp \
$${PWD}/checkautovariables.cpp \
$${PWD}/checkbool.cpp \
$${PWD}/checkboost.cpp \
$${PWD}/checkbufferoverrun.cpp \
$${PWD}/checkclass.cpp \
$${PWD}/checkcondition.cpp \
$${PWD}/checkexceptionsafety.cpp \
$${PWD}/checkfunctions.cpp \
$${PWD}/checkinternal.cpp \
$${PWD}/checkio.cpp \
$${PWD}/checkleakautovar.cpp \
$${PWD}/checkmemoryleak.cpp \
$${PWD}/checknullpointer.cpp \
$${PWD}/checkother.cpp \
$${PWD}/checkpostfixoperator.cpp \
$${PWD}/checksizeof.cpp \
$${PWD}/checkstl.cpp \
$${PWD}/checkstring.cpp \
$${PWD}/checktype.cpp \
$${PWD}/checkuninitvar.cpp \
$${PWD}/checkunusedfunctions.cpp \
$${PWD}/checkunusedvar.cpp \
$${PWD}/checkvaarg.cpp \
$${PWD}/cppcheck.cpp \
$${PWD}/errorlogger.cpp \
$${PWD}/library.cpp \
$${PWD}/mathlib.cpp \
$${PWD}/path.cpp \
$${PWD}/preprocessor.cpp \
$${PWD}/settings.cpp \
$${PWD}/suppressions.cpp \
$${PWD}/symboldatabase.cpp \
$${PWD}/templatesimplifier.cpp \
$${PWD}/timer.cpp \
$${PWD}/token.cpp \
$${PWD}/tokenize.cpp \
$${PWD}/tokenlist.cpp \
$${PWD}/valueflow.cpp

View File

@ -183,23 +183,21 @@ int main(int argc, char **argv)
if (fout1.is_open()) {
fout1 << "# no manual edits - this file is autogenerated by dmake\n\n";
fout1 << "include($$PWD/pcrerules.pri)\n";
fout1 << "BASEPATH = ../externals/tinyxml/\n";
fout1 << "include($$PWD/../externals/tinyxml/tinyxml.pri)\n";
fout1 << "BASEPATH = ../lib/\n";
fout1 << "INCLUDEPATH += ../externals/tinyxml\n";
fout1 << "HEADERS += $${BASEPATH}check.h \\\n";
fout1 << "INCLUDEPATH += $$PWD $$PWD/../externals/tinyxml\n";
fout1 << "HEADERS += $${PWD}/check.h \\\n";
for (unsigned int i = 0; i < libfiles.size(); ++i) {
std::string fname(libfiles[i].substr(4));
if (fname.find(".cpp") == std::string::npos)
continue; // shouldn't happen
fname.erase(fname.find(".cpp"));
fout1 << std::string(11, ' ') << "$${BASEPATH}" << fname << ".h";
fout1 << std::string(11, ' ') << "$${PWD}/" << fname << ".h";
if (i + 1 < testfiles.size())
fout1 << " \\\n";
}
fout1 << "\n\nSOURCES += ";
for (unsigned int i = 0; i < libfiles.size(); ++i) {
fout1 << "$${BASEPATH}" << libfiles[i].substr(4);
fout1 << "$${PWD}/" << libfiles[i].substr(4);
if (i < libfiles.size() - 1)
fout1 << " \\\n" << std::string(11, ' ');
}