Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions build-pcre.txt
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
9 changes: 6 additions & 3 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -31,23 +34,23 @@ goto help

:cppcheck
cd cli
qmake -config %TARGET%
qmake -config %TARGET% HAVE_RULES=%HAVE_RULES%
%MAKE%
cd ..
if "%1" == "all" goto gui
goto end

:gui
cd gui
qmake -config %TARGET%
qmake -config %TARGET% HAVE_RULES=%HAVE_RULES%
%MAKE%
lrelease gui.pro
cd ..
goto end

:tests
cd test
qmake -config %TARGET%
qmake -config %TARGET% HAVE_RULES=%HAVE_RULES%
%MAKE%
cd ..
goto end
Expand Down
1 change: 0 additions & 1 deletion cli/cli.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/lib.pri
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
18 changes: 18 additions & 0 deletions lib/pcrerules.pri
Original file line number Diff line number Diff line change
@@ -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.")
}
4 changes: 2 additions & 2 deletions tools/dmake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down