Get Involved
Download!
APR Docs
APR-util Docs
APR-iconv Docs
Guidelines
Miscellaneous
|
Overview
|
APR can be built on Windows using a cmake-based build system or with Visual
Studio project files maintained by APR developers. The cmake-based build system
directly supports more versions of Visual Studio but currently has considerable
functional limitations.
|
Building APR with the included Visual Studio project files
|
Requirements
|
Compiling apr, apr-iconv and/or apr-util requires the following environment
to be properly installed:
- A suitable Microsoft compiler:
such as: Microsoft Visual C++ 5.0 or higher; Microsoft Visual Studio .NET
2002 or higher (with Visual C++ .NET compiler). We have not yet tried
the 'Express' versions of Visual Studio .NET 2005 and are unable to
provide support for them.
- Follow the required directory layout.
APR can be built using the command line tools, or
from within the graphical IDE (Visual Studio IDE
Workbench or Microsoft Development Environment).
Visual C++ 5.0 users only: The Windows Platform SDK.
Visual C++ 5.0 developers need the updated Microsoft Windows Platform SDK
to enable some APR features. The Platform SDK files distributed with
Visual C++ 6.0 and later are sufficient, so those users may skip this
requirement. The Windows Platform SDK update is required to enable all
supported features with MSVC++ 5.0. Without a current version, APR will
issue warnings under MSVC++ 5.0 or fail to build entirely. Look for the
update on Microsoft's website - we are afraid they change the link too
often to cite.
|
|
Required Directory Layout
|
For a supported build, you must have apr, apr-iconv, and apr-util
checked-out in parallel directories. For example:
C:\work\apr\
C:\work\apr-iconv\
C:\work\apr-util\
For a release, unzipping the release files into this directory layout
should be sufficient.
To track development, please read the information on checking out from Subversion. We recommend TortoiseSVN on Win32 platforms.
Currently, the directories must be called apr, apr-iconv,
and apr-util. No exceptions.
|
Developer Studio Workspace/Microsoft Development Environment IDE Build
|
APR can be compiled using Visual C++'s graphical environment.
To simplify this process, a complete Visual Studio workspace,
apr-util/aprutil.dsw , is provided. This workspace exposes the
entire list of working .dsp projects that are required for the complete APR
binary release. It includes dependencies between the projects to assure
that they are built in the appropriate order.
These workspaces are shipped in the Visual Studio 6.0 format - however,
you can safely 'upgrade' them to your current Visual Studio release (i.e.
Visual Studio 2003 .NET). However, for compatibility and simplicity, we
only distribute Visual Studio 6.0 workspaces. See below for converting the workspaces for Visual Studio 5.0.
Open the apr-util/aprutil.dsw workspace, and choose either aprutil or
libaprutil (for static or dynamic libraries) with the Release or Debug
build as the Active Project. aprutil.dsw causes all related projects to
be built.
You can then choose 'Build Solution' or 'Build Project' to build the
libraries and the dependencies.
The apr test environment can be compiled using VC++'s Visual Studio
development environment with the apr/test/aprtest.dsw project.
This workspace exposes the apr/apr.dsp static library and the
apr/test/aprtest.dsp projects that allow the developer to assemble the
entire test application suite.
Historical Build Note (does not apply to releases after
1.1.1):
If you are doing a Visual Studio 5.0/6.0 Graphical build, it will only find
awk.exe from the Tools menu Options... Directories settings
for the Executable files. Add the path for awk.exe to this list, as needed.
For Visual Studio .NET 2003 and newer, you may need to copy awk to the
Common7\Tools\Bin directory (i.e. where RC.exe is) - it no longer has the
specific PATH options (as far as we can tell).
|
|
Command-Line Build
|
If you use the command line, you must configure it:
"C:\Program Files\DevStudio\VC\Bin\vcvars32.bat"
If necessary, you will also need to prepare the Platform SDK environment:
"C:\Program Files\Platform SDK\setenv.bat"
cd to the apr-util directory. Now, simply use one of the following
commands to compile the static or dynamic libraries, respectively, on
Visual C++ 6.0 or later:
msdev aprutil.dsw /MAKE \
apriconv - Win32 Release" \
apr - Win32 Release" \
libapr - Win32 Release" \
gen_uri_delims - Win32 Release" \
xml - Win32 Release" \
"aprutil - Win32 Release" \
msdev aprutil.dsw /MAKE \
libapr - Win32 Release" \
libapriconv - Win32 Release" \
gen_uri_delims - Win32 Release" \
xml - Win32 Release" \
libaprutil - Win32 Release" \
Either command will compile APR. The latter will build the libraries as
.dll dynamic shared libraries, rather than static libraries.
Replace Release with Debug to include debugging
information in the resulting files, making it easier to find bugs and
track down problems.
For Visual Studio C++ 5.0 command line users:
Only the .dsp files are maintained within Subversion. Win32 .mak
files are NOT maintained in Subversion, due to the tremendous waste
of reviewer's time. Therefore, you cannot rely on the NMAKE
commands above to build revised .dsp project files unless you then
export all .mak files yourself from the project.
|
|
Library Components
|
The apr-util/aprutil.dsw workspace builds the .dsp projects of the
Apache server listed with dependent projects preceeding their
dependencies:
apr-util\aprutil.dsp
apr-util\libaprutil.dsp
apr-util\uri\gen_uri_delims.dsp
apr-util\xml\expat\lib\xml.dsp
apr-iconv\apriconv.dsp
apr-iconv\libapriconv.dsp
apr\apr.dsp
apr\libapr.dsp
The libXXX projects create .dll targets, dynamic shared libraries.
Their non-libXXX counterparts create static .lib targets.
To compile code for the libraries, the consuming compiliation must
include the apr/include and apr-util/include directories in their
include file search paths. To target the static .lib versions of
the library, the consuming compiliation must define the macros
APR_DECLARE_STATIC and APU_DECLARE_STATIC. This prevents the apr
and apr-util symbols from being tagged as __declspec(dllimport),
eliminating compiliation warnings and speeding up execution.
|
Converting the Project for Visual C++ 5.0
|
The .dsp project files are distributed in Visual C++ 6.0 format. Visual
C++ 5.0 (97) will recognize them. To quickly prepare the .dsp files in
the native Visual Studio 5.0 (97) format, you can run this command
from the top-level apr directory (above apr, apr-util and apr-iconv):
perl apr\build\cvtdsp.pl -5
You must type this command from the top level directory of the apr
source tree. Every VC6 .dsp project file within the current directory and
below will be listed as it is converted. If you contribute back a patch that
revises project files, please convert them back with the the -6 option instead
of -5, which returns the project files to Visual Studio 6.0 format.
|
|
Building APR with cmake
|
The primary documentation for this build mechanism is in the
README.cmake files in the APR and APR-util projects. Refer to those
files for detailed instructions.
The primary limitations of the cmake-based build are shown below. Other
considerations are described in README.cmake .
- No cmake build for the APR-iconv subproject is available, and the
APR-util cmake build cannot consume an existing APR-iconv build.
- The cmake build for the APR-util subproject does not support most of the
optional DBM and DBD libraries supported by the included Visual Studio
project files.
|
|