From d9d2f53df6eb547432366937175af8f8b29c63a8 Mon Sep 17 00:00:00 2001 From: Aleksey Palazhchenko Date: Fri, 4 Sep 2009 22:59:25 +0400 Subject: [PATCH] Added top-level 'check' target. Also refactored all. pro files by the way. :) --- .gitignore | 1 - cppcheck.pro | 8 ++++ gui/gui.pro | 127 +++++++++++++++++--------------------------------- readme.txt | 19 +++----- src/src.pri | 45 ++++++++++++++++++ src/src.pro | 49 +------------------ test/test.pro | 45 ++---------------- 7 files changed, 107 insertions(+), 187 deletions(-) create mode 100644 cppcheck.pro create mode 100644 src/src.pri diff --git a/.gitignore b/.gitignore index eb7e3218f..5420b8430 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,6 @@ gui/gui.vcproj gui/gui gui/qrc_gui.cpp gui/*.qm -gui/ui_*.h # Doxygen output folder doxyoutput/ # qmake generated diff --git a/cppcheck.pro b/cppcheck.pro new file mode 100644 index 000000000..e1d78b821 --- /dev/null +++ b/cppcheck.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs +SUBDIRS = src test gui +CONFIG += ordered + +# check target - build and run tests +check.depends = sub-test +check.commands = $$PWD/test/test +QMAKE_EXTRA_TARGETS += check diff --git a/gui/gui.pro b/gui/gui.pro index ea60c6d7a..95d398492 100644 --- a/gui/gui.pro +++ b/gui/gui.pro @@ -1,7 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Sun Feb 22 10:14:18 2009 -###################################################################### - TEMPLATE = app TARGET = QT += xml @@ -10,6 +6,7 @@ INCLUDEPATH += . RCC_DIR = temp MOC_DIR = temp OBJECTS_DIR = temp +UI_DIR = temp CONFIG += warn_on RESOURCES = gui.qrc FORMS = main.ui \ @@ -29,89 +26,51 @@ TRANSLATIONS = cppcheck_fi.ts \ # Windows-specific options CONFIG += embed_manifest_exe -# Input -HEADERS += mainwindow.h \ - checkthread.h \ - resultsview.h \ - resultstree.h \ - settingsdialog.h \ - threadresult.h \ - threadhandler.h \ - applicationlist.h \ - applicationdialog.h \ - aboutdialog.h \ - common.h \ - fileviewdialog.h \ - projectfile.h \ - report.h \ - txtreport.h \ - xmlreport.h \ - translationhandler.h \ - csvreport.h \ - ../src/checkautovariables.h \ - ../src/checkdangerousfunctions.h \ - ../src/checkheaders.h \ - ../src/cppcheck.h \ - ../src/mathlib.h \ - ../src/settings.h \ - ../src/tokenize.h \ - ../src/checkbufferoverrun.h \ - ../src/checkmemoryleak.h \ - ../src/checkstl.h \ - ../src/checkunusedfunctions.h \ - ../src/errorlogger.h \ - ../src/preprocessor.h \ - ../src/threadexecutor.h \ - ../src/checkclass.h \ - ../src/check.h \ - ../src/checkother.h \ - ../src/cppcheckexecutor.h \ - ../src/filelister.h \ - ../src/token.h \ - ../src/classinfo.h \ - - -SOURCES += main.cpp \ - mainwindow.cpp\ - checkthread.cpp \ - resultsview.cpp \ - resultstree.cpp \ - threadresult.cpp \ - threadhandler.cpp \ - settingsdialog.cpp \ - applicationlist.cpp \ - applicationdialog.cpp \ - aboutdialog.cpp \ - fileviewdialog.cpp \ - projectfile.cpp \ - report.cpp \ - txtreport.cpp \ - xmlreport.cpp \ - translationhandler.cpp \ - csvreport.cpp \ - ../src/checkautovariables.cpp \ - ../src/checkdangerousfunctions.cpp \ - ../src/checkmemoryleak.cpp \ - ../src/checkstl.cpp \ - ../src/errorlogger.cpp \ - ../src/mathlib.cpp \ - ../src/threadexecutor.cpp \ - ../src/checkbufferoverrun.cpp \ - ../src/checkother.cpp \ - ../src/cppcheck.cpp \ - ../src/filelister.cpp \ - ../src/preprocessor.cpp \ - ../src/token.cpp \ - ../src/checkclass.cpp \ - ../src/checkheaders.cpp \ - ../src/cppcheckexecutor.cpp \ - ../src/checkunusedfunctions.cpp \ - ../src/settings.cpp \ - ../src/tokenize.cpp - +include($$PWD/../src/src.pri) +HEADERS += mainwindow.h \ + checkthread.h \ + resultsview.h \ + resultstree.h \ + settingsdialog.h \ + threadresult.h \ + threadhandler.h \ + applicationlist.h \ + applicationdialog.h \ + aboutdialog.h \ + common.h \ + fileviewdialog.h \ + projectfile.h \ + report.h \ + txtreport.h \ + xmlreport.h \ + translationhandler.h \ + csvreport.h +SOURCES += main.cpp \ + mainwindow.cpp\ + checkthread.cpp \ + resultsview.cpp \ + resultstree.cpp \ + threadresult.cpp \ + threadhandler.cpp \ + settingsdialog.cpp \ + applicationlist.cpp \ + applicationdialog.cpp \ + aboutdialog.cpp \ + fileviewdialog.cpp \ + projectfile.cpp \ + report.cpp \ + txtreport.cpp \ + xmlreport.cpp \ + translationhandler.cpp \ + csvreport.cpp win32 { RC_FILE = cppcheck-gui.rc HEADERS += ../src/resource.h LIBS += -lshlwapi } + +# run lrelease before build +lrelease.commands = lrelease gui.pro +QMAKE_EXTRA_TARGETS += lrelease +PRE_TARGETDEPS += lrelease diff --git a/readme.txt b/readme.txt index fe0e80f62..5fe5894ad 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,3 @@ - - ========= Cppcheck ========= @@ -17,17 +15,13 @@ Compiling The Makefile works under Linux. To make it work under Windows with DJGPP, change "g++" to "gxx". - - To build cppcheck with qmake, run the commands: - cd src - qmake -config release (or '-config debug' if doing developer build) - make - To compile the GUI one needs Qt development libraries and issue the following commands: - cd gui - qmake -config release (or '-config debug' if doing developer build) - lrelease gui.pro - make + To build cppcheck with qmake, run this commands: + qmake -config release – this will generate Makefile (use 'debug' instead of 'release' if doing developer build) + make – this will build command-line tool, GUI and autotests + make sub-src – this will build command-line tool only + make check – this one will build and run autotests + Usage @@ -43,4 +37,3 @@ Webpage http://www.sf.net/projects/cppcheck - diff --git a/src/src.pri b/src/src.pri new file mode 100644 index 000000000..79b1dc649 --- /dev/null +++ b/src/src.pri @@ -0,0 +1,45 @@ +# Common project include with headers and sources + +HEADERS += $$PWD/check.h \ + $$PWD/checkautovariables.h \ + $$PWD/checkbufferoverrun.h \ + $$PWD/checkclass.h \ + $$PWD/checkdangerousfunctions.h \ + $$PWD/checkheaders.h \ + $$PWD/checkmemoryleak.h \ + $$PWD/checkother.h \ + $$PWD/checkstl.h \ + $$PWD/checkunusedfunctions.h \ + $$PWD/classinfo.h \ + $$PWD/cppcheck.h \ + $$PWD/cppcheckexecutor.h \ + $$PWD/errorlogger.h \ + $$PWD/filelister.h \ + $$PWD/mathlib.h \ + $$PWD/preprocessor.h \ + $$PWD/resource.h \ + $$PWD/settings.h \ + $$PWD/threadexecutor.h \ + $$PWD/token.h \ + $$PWD/tokenize.h + +# no main.cpp here +SOURCES += $$PWD/checkautovariables.cpp \ + $$PWD/checkbufferoverrun.cpp \ + $$PWD/checkclass.cpp \ + $$PWD/checkdangerousfunctions.cpp \ + $$PWD/checkheaders.cpp \ + $$PWD/checkmemoryleak.cpp \ + $$PWD/checkother.cpp \ + $$PWD/checkstl.cpp \ + $$PWD/checkunusedfunctions.cpp \ + $$PWD/cppcheck.cpp \ + $$PWD/cppcheckexecutor.cpp \ + $$PWD/errorlogger.cpp \ + $$PWD/filelister.cpp \ + $$PWD/mathlib.cpp \ + $$PWD/preprocessor.cpp \ + $$PWD/settings.cpp \ + $$PWD/threadexecutor.cpp \ + $$PWD/token.cpp \ + $$PWD/tokenize.cpp diff --git a/src/src.pro b/src/src.pro index 9f43c27e4..f5106b767 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,7 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Mon Jul 13 10:40:01 2009 -###################################################################### - TEMPLATE = app TARGET = cppcheck DEPENDPATH += . @@ -10,49 +6,8 @@ OBJECTS_DIR = temp CONFIG += warn_on CONFIG -= qt app_bundle -# Input -HEADERS += check.h \ - checkautovariables.h \ - checkbufferoverrun.h \ - checkclass.h \ - checkdangerousfunctions.h \ - checkheaders.h \ - checkmemoryleak.h \ - checkother.h \ - checkstl.h \ - checkunusedfunctions.h \ - classinfo.h \ - cppcheck.h \ - cppcheckexecutor.h \ - errorlogger.h \ - filelister.h \ - mathlib.h \ - preprocessor.h \ - resource.h \ - settings.h \ - threadexecutor.h \ - token.h \ - tokenize.h -SOURCES += checkautovariables.cpp \ - checkbufferoverrun.cpp \ - checkclass.cpp \ - checkdangerousfunctions.cpp \ - checkheaders.cpp \ - checkmemoryleak.cpp \ - checkother.cpp \ - checkstl.cpp \ - checkunusedfunctions.cpp \ - cppcheck.cpp \ - cppcheckexecutor.cpp \ - errorlogger.cpp \ - filelister.cpp \ - main.cpp \ - mathlib.cpp \ - preprocessor.cpp \ - settings.cpp \ - threadexecutor.cpp \ - token.cpp \ - tokenize.cpp +include($$PWD/src.pri) +SOURCES += main.cpp win32 { CONFIG += embed_manifest_exe console diff --git a/test/test.pro b/test/test.pro index 00a288cf2..3f9e25b6f 100644 --- a/test/test.pro +++ b/test/test.pro @@ -1,7 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Mon Jul 13 17:37:53 2009 -###################################################################### - TEMPLATE = app TARGET = test DEPENDPATH += . @@ -11,26 +7,8 @@ CONFIG += warn_on debug CONFIG -= qt app_bundle DEFINES += UNIT_TESTING -# Input -HEADERS += testsuite.h \ - ../src/tokenize.h \ - ../src/settings.h \ - ../src/errorlogger.h \ - ../src/token.h \ - ../src/checkautovariables.h \ - ../src/check.h \ - ../src/checkbufferoverrun.h \ - ../src/checkother.h \ - ../src/checkclass.h \ - ../src/cppcheck.h \ - ../src/checkunusedfunctions.h \ - ../src/checkdangerousfunctions.h \ - ../src/filelister.h \ - ../src/mathlib.h \ - ../src/checkmemoryleak.h \ - ../src/preprocessor.h \ - ../src/checkstl.h \ - ../src/checkheaders.h +include($$PWD/../src/src.pri) +HEADERS += testsuite.h SOURCES += testautovariables.cpp \ testbufferoverrun.cpp \ testcharvar.cpp \ @@ -54,24 +32,7 @@ SOURCES += testautovariables.cpp \ testtokenize.cpp \ testunusedfunctions.cpp \ testunusedprivfunc.cpp \ - testunusedvar.cpp \ - ../src/tokenize.cpp \ - ../src/settings.cpp \ - ../src/errorlogger.cpp \ - ../src/token.cpp \ - ../src/checkautovariables.cpp \ - ../src/checkbufferoverrun.cpp \ - ../src/checkother.cpp \ - ../src/checkclass.cpp \ - ../src/cppcheck.cpp \ - ../src/checkunusedfunctions.cpp \ - ../src/checkdangerousfunctions.cpp \ - ../src/filelister.cpp \ - ../src/mathlib.cpp \ - ../src/checkmemoryleak.cpp \ - ../src/preprocessor.cpp \ - ../src/checkstl.cpp \ - ../src/CheckHeaders.cpp + testunusedvar.cpp win32 { CONFIG += console