| 8 |
The C++ wrapper functions |
The C++ wrapper functions |
| 9 |
Building for virtual Pascal |
Building for virtual Pascal |
| 10 |
Stack size in Windows environments |
Stack size in Windows environments |
| 11 |
|
Linking programs in Windows environments |
| 12 |
Comments about Win32 builds |
Comments about Win32 builds |
| 13 |
Building PCRE with CMake |
Building PCRE on Windows with CMake |
| 14 |
Use of relative paths with CMake on Windows |
Use of relative paths with CMake on Windows |
| 15 |
Testing with runtest.bat |
Testing with runtest.bat |
| 16 |
Building under Windows with BCC5.5 |
Building under Windows with BCC5.5 |
| 34 |
successfully on any system that has a Standard C compiler and library. The C++ |
successfully on any system that has a Standard C compiler and library. The C++ |
| 35 |
wrapper functions are a separate issue (see below). |
wrapper functions are a separate issue (see below). |
| 36 |
|
|
| 37 |
The PCRE distribution includes support for CMake. This support is relatively |
The PCRE distribution includes a "configure" file for use by the Configure/Make |
| 38 |
new, but has already been used successfully to build PCRE in multiple build |
build system, as found in many Unix-like environments. There is also support |
| 39 |
environments on Windows. There are some instructions in the section entitled |
support for CMake, which some users prefer, in particular in Windows |
| 40 |
"Building PCRE with CMake" below. |
environments. There are some instructions for CMake under Windows in the |
| 41 |
|
section entitled "Building PCRE with CMake" below. CMake can also be used to |
| 42 |
|
build PCRE in Unix-like systems. |
| 43 |
|
|
| 44 |
|
|
| 45 |
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY |
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY |
| 182 |
"pcrestack" documentation. |
"pcrestack" documentation. |
| 183 |
|
|
| 184 |
|
|
| 185 |
|
LINKING PROGRAMS IN WINDOWS ENVIRONMENTS |
| 186 |
|
|
| 187 |
|
If you want to statically link a program against a PCRE library in the form of |
| 188 |
|
a non-dll .a file, you must define PCRE_STATIC before including pcre.h, |
| 189 |
|
otherwise the pcre_malloc() and pcre_free() exported functions will be declared |
| 190 |
|
__declspec(dllimport), with unwanted results. |
| 191 |
|
|
| 192 |
|
|
| 193 |
|
CALLING CONVENTIONS IN WINDOWS ENVIRONMENTS |
| 194 |
|
|
| 195 |
|
It is possible to compile programs to use different calling conventions using |
| 196 |
|
MSVC. Search the web for "calling conventions" for more information. To make it |
| 197 |
|
easier to change the calling convention for the exported functions in the |
| 198 |
|
PCRE library, the macro PCRE_CALL_CONVENTION is present in all the external |
| 199 |
|
definitions. It can be set externally when compiling (e.g. in CFLAGS). If it is |
| 200 |
|
not set, it defaults to empty; the default calling convention is then used |
| 201 |
|
(which is what is wanted most of the time). |
| 202 |
|
|
| 203 |
|
|
| 204 |
COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE WITH CMAKE" below) |
COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE WITH CMAKE" below) |
| 205 |
|
|
| 206 |
There are two ways of building PCRE using the "configure, make, make install" |
There are two ways of building PCRE using the "configure, make, make install" |
| 207 |
paradigm on Windows systems: using MinGW or using Cygwin. These are not at all |
paradigm on Windows systems: using MinGW or using Cygwin. These are not at all |
| 208 |
the same thing; they are completely different from each other. There is also |
the same thing; they are completely different from each other. There is also |
| 209 |
some experimental, undocumented support for building using "cmake", which you |
support for building using CMake, which some users find a more straightforward |
| 210 |
might like to try if you are familiar with "cmake". However, at the present |
way of building PCRE under Windows. However, the tests are not run |
| 211 |
time, the "cmake" process builds only a static library (not a dll), and the |
automatically when CMake is used. |
|
tests are not automatically run. |
|
| 212 |
|
|
| 213 |
The MinGW home page (http://www.mingw.org/) says this: |
The MinGW home page (http://www.mingw.org/) says this: |
| 214 |
|
|
| 240 |
releases of PCRE included the basic libpcre functions in libpcreposix. This no |
releases of PCRE included the basic libpcre functions in libpcreposix. This no |
| 241 |
longer happens.) |
longer happens.) |
| 242 |
|
|
| 243 |
If you want to statically link your program against a non-dll .a file, you must |
A user submitted a special-purpose patch that makes it easy to create |
| 244 |
define PCRE_STATIC before including pcre.h, otherwise the pcre_malloc() and |
"pcre.dll" under mingw32 using the "msys" environment. It provides "pcre.dll" |
| 245 |
pcre_free() exported functions will be declared __declspec(dllimport), with |
as a special target. If you use this target, no other files are built, and in |
| 246 |
unwanted results. |
particular, the pcretest and pcregrep programs are not built. An example of how |
| 247 |
|
this might be used is: |
| 248 |
|
|
| 249 |
|
./configure --enable-utf --disable-cpp CFLAGS="-03 -s"; make pcre.dll |
| 250 |
|
|
| 251 |
Using Cygwin's compiler generates libraries and executables that depend on |
Using Cygwin's compiler generates libraries and executables that depend on |
| 252 |
cygwin1.dll. If a library that is generated this way is distributed, |
cygwin1.dll. If a library that is generated this way is distributed, |
| 278 |
things in this area in future. |
things in this area in future. |
| 279 |
|
|
| 280 |
|
|
| 281 |
BUILDING PCRE WITH CMAKE |
BUILDING PCRE ON WINDOWS WITH CMAKE |
| 282 |
|
|
| 283 |
CMake is an alternative build facility that can be used instead of the |
CMake is an alternative build facility that can be used instead of the |
| 284 |
traditional Unix "configure". CMake version 2.4.7 supports Borland makefiles, |
traditional Unix "configure". CMake version 2.4.7 supports Borland makefiles, |
| 286 |
6, Visual Studio 7, Visual Studio 8, and Watcom W8. The following instructions |
6, Visual Studio 7, Visual Studio 8, and Watcom W8. The following instructions |
| 287 |
were contributed by a PCRE user. |
were contributed by a PCRE user. |
| 288 |
|
|
| 289 |
1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure |
1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure |
| 290 |
that cmake\bin is on your path. |
that cmake\bin is on your path. |
| 291 |
|
|
| 292 |
2. Unzip (retaining folder structure) the PCRE source tree into a source |
2. Unzip (retaining folder structure) the PCRE source tree into a source |
| 293 |
directory such as C:\pcre. |
directory such as C:\pcre. |
| 294 |
|
|
| 295 |
3. Create a new, empty build directory: C:\pcre\build\ |
3. Create a new, empty build directory: C:\pcre\build\ |
| 296 |
|
|
| 297 |
4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys |
4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys |
| 298 |
for Msys/MinGW or Visual Studio Command Prompt for VC/VC++ |
for Msys/MinGW or Visual Studio Command Prompt for VC/VC++ |
| 299 |
|
|
| 300 |
5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build |
5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build |
| 301 |
directories, respectively |
directories, respectively |
| 302 |
|
|
| 303 |
6. Hit the "Configure" button. |
6. Hit the "Configure" button. |
| 304 |
|
|
| 305 |
7. Select the particular IDE / build tool that you are using (Visual Studio, |
7. Select the particular IDE / build tool that you are using (Visual Studio, |
| 306 |
MSYS makefiles, MinGW makefiles, etc.) |
MSYS makefiles, MinGW makefiles, etc.) |
| 307 |
|
|
| 308 |
8. The GUI will then list several configuration options. This is where you can |
8. The GUI will then list several configuration options. This is where you can |
| 309 |
enable UTF-8 support, etc. |
enable UTF-8 support, etc. |
| 310 |
|
|
| 311 |
9. Hit "Configure" again. The adjacent "OK" button should now be active. |
9. Hit "Configure" again. The adjacent "OK" button should now be active. |
| 312 |
|
|
| 313 |
10. Hit "OK". |
10. Hit "OK". |
| 314 |
|
|
| 319 |
USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS |
USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS |
| 320 |
|
|
| 321 |
A PCRE user comments as follows: |
A PCRE user comments as follows: |
| 322 |
|
|
| 323 |
I thought that others may want to know the current state of |
I thought that others may want to know the current state of |
| 324 |
CMAKE_USE_RELATIVE_PATHS support on Windows. |
CMAKE_USE_RELATIVE_PATHS support on Windows. |
| 325 |
|
|
| 334 |
need to replace existing absolute paths in project files with relative |
need to replace existing absolute paths in project files with relative |
| 335 |
paths manually (e.g. from VS) - relative to project file location. I did |
paths manually (e.g. from VS) - relative to project file location. I did |
| 336 |
just that before being told to try CMAKE_USE_RELATIVE_PATHS. Not a big |
just that before being told to try CMAKE_USE_RELATIVE_PATHS. Not a big |
| 337 |
deal. |
deal. |
| 338 |
|
|
| 339 |
AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;" |
AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;" |
| 340 |
AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;" |
AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;" |
| 359 |
|
|
| 360 |
4. To test pcrecpp, run pcrecpp_unittest.exe, pcre_stringpiece_unittest.exe and |
4. To test pcrecpp, run pcrecpp_unittest.exe, pcre_stringpiece_unittest.exe and |
| 361 |
pcre_scanner_unittest.exe. |
pcre_scanner_unittest.exe. |
| 362 |
|
|
| 363 |
|
|
| 364 |
BUILDING UNDER WINDOWS WITH BCC5.5 |
BUILDING UNDER WINDOWS WITH BCC5.5 |
| 365 |
|
|
| 439 |
$! |
$! |
| 440 |
========================= |
========================= |
| 441 |
|
|
| 442 |
Last Updated: 20 January 2008 |
Last Updated: 09 July 2008 |
| 443 |
**** |
**** |