Building and Installing

Requirements

Since xmlwrapp is a wrapper around the libxml2 parser, you will need to
have that library installed and working first. libxml2 is written in C and
can be built on a large number of platforms. libxml2 can be downloaded from
its web site.

You may already have libxml2 installed since it is bundled with many
operating systems. When libxml2 is installed, a shell script called
xml2-config is installed with it. You can use the --version command line
option to see what version of libxml2 is installed.

In order to use xmlwrapp, you need to be using at least version 2.4.28 of
libxml2. This is due to minor API changes and bug fixes that are part of
each libxml2 release.

Building Under Unix

xmlwrapp comes with a Perl script called configure.pl. This script will
generate the correct make files for your environment and compiler. This
also adds Perl to the previous list of requirements. It should be noted
that Perl is not used in any other place inside xmlwrapp except this
script.

In order for configure.pl to determine where libxml2 was installed it will
need to execute the xml2-config script that was installed with libxml2. If
that script is not in your path you can use the --xml2-config option to
tell configure.pl where it is.

The first step to building xmlwrapp is to run the configure.pl script. It
has some reasonable defaults if you don't supply any command line options.
To see the list of possible options, try using the --help option.

To help configure.pl out, you should have your CXX environment variable set
to the full path for the C++ compiler you want to use. If you are like me,
you have more than one compiler installed.

After configure.pl has finished successfully, you can run make and make
install. The build system should work with either BSD or GNU make.

perl configure.pl --prefix=/usr/local make make install Building Under Mac
OS X

First, you should have libxml2 installed. I don't recommend that you
download the pre-built binaries, as they are too far out of date. libxml2
builds from source very nicely on OSX.

xmlwrapp has been tested on OSX version 10.1.x with the April 2002
Developer Tools (using /usr/bin/g++ [gcc-937.2]). Because the configure.pl
script is too stupid to build shared libaries on OSX, you will have to
disable that. Here is what I do to compile under OSX.

From a Terminal.app inside the xmlwrapp-* directory.

setenv CXX /usr/bin/g++ ./configure.pl --disable-shared --prefix=$HOME/
Local make make install

WARNING: Don't use /usr/bin/g++3 to compile xmlwrapp. That compiler is     
         broken and does not handle exceptions correctly. If you are using 
         OSX 10.2.X and the December 2002 Developer Tools, it should be    
         safe to use gcc 3.1, this has not been tested yet.                

Building Under Windows

You can compile a native Windows version of the xmlwrapp library by using
the supplied MSVC 6 project files. The project files are in the platform/
Win32 directory. Because of problems with the standard library that comes
with MSVC 6, you will need to use a different implementation.

For a free high quality standard C++ library, visit the STLport web site.
The included project files are built using MSVC 6 and the STLport version
4.5.3.

Note: If you want to build xmlwrapp using the cygwin environment, you      
      should follow the instructions for building under Unix. You should   
      make sure there are no spaces in the directory paths for your current
      directory or any of your include or library paths.                   

If you don't have libxml2 installed on your system you should download and
install binaries of libxml2 and iconv.

Once you have that done, you will need to edit the project files, either by
hand or using MSVC, to alter the include paths so that they point to the
libxml2 and iconv include directories. The current paths assume you have
libxml2 and iconv in the same directory that you have the xmlwrapp
directory in.

After the project files point to the correct paths, you can compile
xmlwrapp. You may need to select the Release build or the Debug build,
depending on what you want to do. When you choose "Rebuild All" from the
"Build" menu, xmlwrapp and the example programs should compile without any
warnings or error messages.

Note: In order for the example programs to run, you will need to have the  
      libxml2 and iconv libraries installed in a system path. If you don't 
      want to do that, you can do what I do, and put the libraries in the  
      Debug and Release folders.                                           

The Test Suite

If you are on a platform where the configure.pl script is supported, you
can run the xmlwrapp test suite. This is done by first enabling the test
suite using the --enable-tests option to the configure.pl script.

You can then build the xmlwrapp library as usual with make. Once the
library is built, you can run the test suite using make test.

Linking Your Application With xmlwrapp

If you are using an IDE, such as MSVC, linking with the xmlwrapp library is
as simple as adding the library to a dialog box field. It is just as simple
to link with xmlwrapp if you are compiling from the command line using
make.

When you ran configure.pl and then make install, a shell script called
xmlwrapp-config was generated and installed into your bin directory.

You can use this script to give the correct command line options to your
compiler. This includes the location of the xmlwrapp header files and other
libraries to link with, such as libxml2.

Here is an example, assuming that your entire application is contained
within a file called example.cxx and the path to your compiler is stored in
the CXX environment variable.

$CXX -c `xmlwrapp-config --cxxflags` example.cxx $CXX -o example example.o
`xmlwrapp-config --libs`

There are other command line options that can be given to the
xmlwrapp-config script, such as --version. Use the --help option to get
information about all possible options.

