Building on UNIX
================

The following build instructions are for the Linux/UNIX/Mac OS X
operating systems as well as for Cygwin and MinGW on Windows.

The standard autotools-based build system is used on these platforms. After
unpacking the source code archive, change to the libodb package directory
(referred to as libodb/ from now on) and run the configure script:

./configure

To see the available configuration options run configure with --help:

./configure --help

As an example, the following configure command only builds shared libraries,
uses the specified C++ compiler, and compiles with optimization and without
debug information:

./configure --disable-static CXX=g++-4.5 CXXFLAGS=-O3

Once configuration is complete, run make to build libodb:

make

Once the build is completed successfully, you can install the libodb headers
and libraries using the install target (you may need to do this step as root
depending on the installation directory):

make install


Building on Windows
===================

The following build instructions are for Windows using Microsoft Visual
Studio. If you would like to build libodb with GCC either using Cygwin
or MinGW, refer to the "Building on UNIX" section above.

The standard Visual Studio project and solution files are used on this
platform. To build libodb, unpack the source code archive and open the
libodb-vc<N>.sln file located in the libodb package directory (referred
to as libodb\ from now on). Here <N> is the version of Visual Studio that
you are using. Once the solution is open, select the desired build
configuration (Debug or Release) and platform (Win32 or x64) and build
the solution.

The resulting 32-bit DLLs and import libraries are placed into the
libodb\bin\ and libodb\lib\ directories, respectively. Similarly, the
64-bit DLLs and import libraries are placed into libodb\bin64\ and
libodb\lib64\. The Release versions of the import libraries are named
odb.lib and the Debug versions are named odb-d.lib.

To configure Visual Studio to automatically locate the libodb headers,
DLLs, and import libraries, add the following paths to your VC++
Directories:

Win32:

  Include:    ...\libodb
  Library:    ...\libodb\lib
  Executable: ...\libodb\bin

x64:

  Include:    ...\libodb
  Library:    ...\libodb\lib64
  Executable: ...\libodb\bin64

Note also that by default libodb uses the __declspec(thread) storage-class
modifier for TLS support. This mechanism is known not to work correctly on
Windows XP/Server 2003 and earlier versions of Windows if a DLL that uses
this modifier is loaded dynamically. If you are planning to link libodb to a
DLL that will be loaded dynamically (e.g., delay loading, COM DLL, explicit
LoadLibrary() call, etc), then you will need to comment out the definition
of the ODB_THREADS_TLS_DECLSPEC macro in the odb\details\config-vc.h file
prior to building libodb. On the other hand, if you plan to link libodb
directly to an executable or another DLL that will be linked directly to
an executable or if you only need to support Windows Vista/Server 2008,
then you don't need to make this change.
