Merge pull request #32 from rpavlik/qmake-configure-rules

Qmake configure rules
This commit is contained in:
Kimmo Varis 2011-08-19 13:00:34 -07:00
commit 80ba3d6a92
6 changed files with 46 additions and 8 deletions

View File

@ -1,3 +1,21 @@
PCRE is a library that is used by the optional "rules" feature. (It adds
some additional features to the command line client.) It's readily available
on Linux and Mac OS X, but must be obtained separately for Windows.
If you're using qmake to generate makefiles, the following behavior applies:
- If you're not on Windows, it assumes by default that you have PCRE and want
to enable rules support.
- If you're not on Windows, you can disable rules support (removing the PCRE
dependency) by passing HAVE_RULES=no to qmake.
- If you are on Windows, but have PCRE available, you can enable rules support
by passing HAVE_RULES=yes to qmake.
- Note: This includes using build.bat since it calls qmake - to use PCRE and
build.bat, you need to run set HAVE_RULES=yes before each run of build.bat
Some temporary build instructions. This is work in progress.

View File

@ -7,6 +7,9 @@ REM where <target> is any of cppcheck/gui/tests/all
REM release or debug is the configuration
REM all-target builds both cppcheck and gui.
REM
REM Run the command before build.bat to enable rules using pcre:
REM set HAVE_RULES=yes
REM
REM TODO:
REM - run tests too
@ -36,7 +39,7 @@ goto help
:cppcheck
cd cli
qmake -config %TARGET%
qmake -config %TARGET% HAVE_RULES=%HAVE_RULES%
%MAKE%
cd ..
if "%1" == "all" goto gui
@ -44,7 +47,7 @@ goto end
:gui
cd gui
qmake -config %TARGET%
qmake -config %TARGET% HAVE_RULES=%HAVE_RULES%
%MAKE%
lrelease gui.pro
cd ..
@ -52,7 +55,7 @@ goto end
:tests
cd test
qmake -config %TARGET%
qmake -config %TARGET% HAVE_RULES=%HAVE_RULES%
%MAKE%
cd ..
goto end

View File

@ -5,7 +5,6 @@ INCLUDEPATH += . ../lib
OBJECTS_DIR = temp
CONFIG += warn_on
CONFIG -= qt app_bundle
DEFINES += HAVE_RULES
BASEPATH = ../externals/tinyxml/
include($$PWD/../externals/tinyxml/tinyxml.pri)

View File

@ -1,7 +1,7 @@
# no manual edits - this file is autogenerated by dmake
LIBS += -L../externals -lpcre
INCLUDEPATH += ../externals ../externals/tinyxml
include($$PWD/pcrerules.pri)
INCLUDEPATH += ../externals/tinyxml
HEADERS += $${BASEPATH}check.h \
$${BASEPATH}check64bit.h \
$${BASEPATH}checkassignif.h \

18
lib/pcrerules.pri Normal file
View File

@ -0,0 +1,18 @@
# On non-Windows, if the variable HAVE_RULES is empty, default to using PCRE and enabling rules
!win32:isEmpty(HAVE_RULES) {
CONFIG += use_pcre_rules
}
# If HAVE_RULES=yes is passed to qmake, use PCRE and enable rules
contains(HAVE_RULES, [yY][eE][sS]) {
CONFIG += use_pcre_rules
}
use_pcre_rules {
DEFINES += HAVE_RULES
LIBS += -L../externals -lpcre
INCLUDEPATH += ../externals
message("Rules enabled - to disable them and remove the dependency on PCRE, pass HAVE_RULES=no to qmake.")
} else {
message("Rules disabled - to enable them, make PCRE available and pass HAVE_RULES=yes to qmake.")
}

View File

@ -182,8 +182,8 @@ int main(int argc, char **argv)
if (fout1.is_open())
{
fout1 << "# no manual edits - this file is autogenerated by dmake\n\n";
fout1 << "LIBS += -L../externals -lpcre\n";
fout1 << "INCLUDEPATH += ../externals ../externals/tinyxml\n";
fout1 << "include($$PWD/pcrerules.pri)\n";
fout1 << "INCLUDEPATH += ../externals/tinyxml\n";
fout1 << "HEADERS += $${BASEPATH}check.h \\\n";
for (unsigned int i = 0; i < libfiles.size(); ++i)
{