|
|
|
@ -8,8 +8,11 @@ This document contains the following sections: |
|
|
|
The C++ wrapper functions |
|
|
|
Building for virtual Pascal |
|
|
|
Stack size in Windows environments |
|
|
|
Linking programs in Windows environments |
|
|
|
Comments about Win32 builds |
|
|
|
Building PCRE with CMake |
|
|
|
Building PCRE on Windows with CMake |
|
|
|
Use of relative paths with CMake on Windows |
|
|
|
Testing with runtest.bat |
|
|
|
Building under Windows with BCC5.5 |
|
|
|
Building PCRE on OpenVMS |
|
|
|
|
|
|
|
@ -31,10 +34,12 @@ library consists entirely of code written in Standard C, and so should compile |
|
|
|
successfully on any system that has a Standard C compiler and library. The C++ |
|
|
|
wrapper functions are a separate issue (see below). |
|
|
|
|
|
|
|
The PCRE distribution includes support for CMake. This support is relatively |
|
|
|
new, but has already been used successfully to build PCRE in multiple build |
|
|
|
environments on Windows. There are some instructions in the section entitled |
|
|
|
"Building PCRE with CMake" below. |
|
|
|
The PCRE distribution includes a "configure" file for use by the Configure/Make |
|
|
|
build system, as found in many Unix-like environments. There is also support |
|
|
|
support for CMake, which some users prefer, in particular in Windows |
|
|
|
environments. There are some instructions for CMake under Windows in the |
|
|
|
section entitled "Building PCRE with CMake" below. CMake can also be used to |
|
|
|
build PCRE in Unix-like systems. |
|
|
|
|
|
|
|
|
|
|
|
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY |
|
|
|
@ -177,15 +182,22 @@ significantly slower when this is done. There is more about stack usage in the |
|
|
|
"pcrestack" documentation. |
|
|
|
|
|
|
|
|
|
|
|
LINKING PROGRAMS IN WINDOWS ENVIRONMENTS |
|
|
|
|
|
|
|
If you want to statically link a program against a PCRE library in the form of |
|
|
|
a non-dll .a file, you must define PCRE_STATIC before including pcre.h, |
|
|
|
otherwise the pcre_malloc() and pcre_free() exported functions will be declared |
|
|
|
__declspec(dllimport), with unwanted results. |
|
|
|
|
|
|
|
|
|
|
|
COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE WITH CMAKE" below) |
|
|
|
|
|
|
|
There are two ways of building PCRE using the "configure, make, make install" |
|
|
|
paradigm on Windows systems: using MinGW or using Cygwin. These are not at all |
|
|
|
the same thing; they are completely different from each other. There is also |
|
|
|
some experimental, undocumented support for building using "cmake", which you |
|
|
|
might like to try if you are familiar with "cmake". However, at the present |
|
|
|
time, the "cmake" process builds only a static library (not a dll), and the |
|
|
|
tests are not automatically run. |
|
|
|
support for building using CMake, which some users find a more straightforward |
|
|
|
way of building PCRE under Windows. However, the tests are not run |
|
|
|
automatically when CMake is used. |
|
|
|
|
|
|
|
The MinGW home page (http://www.mingw.org/) says this: |
|
|
|
|
|
|
|
@ -217,10 +229,13 @@ also link with libpcre, which contains the basic functions. (Some earlier |
|
|
|
releases of PCRE included the basic libpcre functions in libpcreposix. This no |
|
|
|
longer happens.) |
|
|
|
|
|
|
|
If you want to statically link your program against a non-dll .a file, you must |
|
|
|
define PCRE_STATIC before including pcre.h, otherwise the pcre_malloc() and |
|
|
|
pcre_free() exported functions will be declared __declspec(dllimport), with |
|
|
|
unwanted results. |
|
|
|
A user submitted a special-purpose patch that makes it easy to create |
|
|
|
"pcre.dll" under mingw32 using the "msys" environment. It provides "pcre.dll" |
|
|
|
as a special target. If you use this target, no other files are built, and in |
|
|
|
particular, the pcretest and pcregrep programs are not built. An example of how |
|
|
|
this might be used is: |
|
|
|
|
|
|
|
./configure --enable-utf --disable-cpp CFLAGS="-03 -s"; make pcre.dll |
|
|
|
|
|
|
|
Using Cygwin's compiler generates libraries and executables that depend on |
|
|
|
cygwin1.dll. If a library that is generated this way is distributed, |
|
|
|
@ -252,7 +267,7 @@ terminators in order to get some of the tests to work. We hope to improve |
|
|
|
things in this area in future. |
|
|
|
|
|
|
|
|
|
|
|
BUILDING PCRE WITH CMAKE |
|
|
|
BUILDING PCRE ON WINDOWS WITH CMAKE |
|
|
|
|
|
|
|
CMake is an alternative build facility that can be used instead of the |
|
|
|
traditional Unix "configure". CMake version 2.4.7 supports Borland makefiles, |
|
|
|
@ -260,36 +275,65 @@ MinGW makefiles, MSYS makefiles, NMake makefiles, UNIX makefiles, Visual Studio |
|
|
|
6, Visual Studio 7, Visual Studio 8, and Watcom W8. The following instructions |
|
|
|
were contributed by a PCRE user. |
|
|
|
|
|
|
|
1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure |
|
|
|
that cmake\bin is on your path. |
|
|
|
1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure |
|
|
|
that cmake\bin is on your path. |
|
|
|
|
|
|
|
2. Unzip (retaining folder structure) the PCRE source tree into a source |
|
|
|
directory such as C:\pcre. |
|
|
|
2. Unzip (retaining folder structure) the PCRE source tree into a source |
|
|
|
directory such as C:\pcre. |
|
|
|
|
|
|
|
3. Create a new, empty build directory: C:\pcre\build\ |
|
|
|
3. Create a new, empty build directory: C:\pcre\build\ |
|
|
|
|
|
|
|
4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys |
|
|
|
for Msys/MinGW or Visual Studio Command Prompt for VC/VC++ |
|
|
|
4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys |
|
|
|
for Msys/MinGW or Visual Studio Command Prompt for VC/VC++ |
|
|
|
|
|
|
|
5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build |
|
|
|
directories, respectively |
|
|
|
5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build |
|
|
|
directories, respectively |
|
|
|
|
|
|
|
6. Hit the "Configure" button. |
|
|
|
6. Hit the "Configure" button. |
|
|
|
|
|
|
|
7. Select the particular IDE / build tool that you are using (Visual Studio, |
|
|
|
MSYS makefiles, MinGW makefiles, etc.) |
|
|
|
7. Select the particular IDE / build tool that you are using (Visual Studio, |
|
|
|
MSYS makefiles, MinGW makefiles, etc.) |
|
|
|
|
|
|
|
8. The GUI will then list several configuration options. This is where you can |
|
|
|
enable UTF-8 support, etc. |
|
|
|
8. The GUI will then list several configuration options. This is where you can |
|
|
|
enable UTF-8 support, etc. |
|
|
|
|
|
|
|
9. Hit "Configure" again. The adjacent "OK" button should now be active. |
|
|
|
9. Hit "Configure" again. The adjacent "OK" button should now be active. |
|
|
|
|
|
|
|
10. Hit "OK". |
|
|
|
|
|
|
|
11. The build directory should now contain a usable build system, be it a |
|
|
|
solution file for Visual Studio, makefiles for MinGW, etc. |
|
|
|
|
|
|
|
Testing with RunTest.bat |
|
|
|
|
|
|
|
USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS |
|
|
|
|
|
|
|
A PCRE user comments as follows: |
|
|
|
|
|
|
|
I thought that others may want to know the current state of |
|
|
|
CMAKE_USE_RELATIVE_PATHS support on Windows. |
|
|
|
|
|
|
|
Here it is: |
|
|
|
-- AdditionalIncludeDirectories is only partially modified (only the |
|
|
|
first path - see below) |
|
|
|
-- Only some of the contained file paths are modified - shown below for |
|
|
|
pcre.vcproj |
|
|
|
-- It properly modifies |
|
|
|
|
|
|
|
I am sure CMake people can fix that if they want to. Until then one will |
|
|
|
need to replace existing absolute paths in project files with relative |
|
|
|
paths manually (e.g. from VS) - relative to project file location. I did |
|
|
|
just that before being told to try CMAKE_USE_RELATIVE_PATHS. Not a big |
|
|
|
deal. |
|
|
|
|
|
|
|
AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;" |
|
|
|
AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;" |
|
|
|
|
|
|
|
RelativePath="pcre.h"> |
|
|
|
RelativePath="pcre_chartables.c"> |
|
|
|
RelativePath="pcre_chartables.c.rule"> |
|
|
|
|
|
|
|
|
|
|
|
TESTING WITH RUNTEST.BAT |
|
|
|
|
|
|
|
1. Copy RunTest.bat into the directory where pcretest.exe has been created. |
|
|
|
|
|
|
|
@ -384,5 +428,5 @@ $! Locale could not be set to fr |
|
|
|
$! |
|
|
|
========================= |
|
|
|
|
|
|
|
Last Updated: 21 September 2007 |
|
|
|
Last Updated: 25 January 2008 |
|
|
|
**** |