INSTALL
-------------------------------------------------------------------------------


INTRODUCTION
============

This file describes how to install CGAL. The instructions in this file
are for the most common use cases, and cover the command line tools. 

For further information, or in case of problems, please see the
detailed installation instructions, which can be found in this
distribution in the file ./doc_html/index.html or on the CGAL website
http://www.cgal.org/Manual/beta/doc_html/cgal_manual/Installation/Chapter_main.html

The documentation of CGAL is available in PDF and HTML formats.
It is not bundled with the software but can be downloaded separately
at <http://www.cgal.org/Manual>.

For more information about CGAL, see the <http://www.cgal.org/>.

In the current file, x.y is an implicit replacement for the current version
of CGAL (3.5.1, 3.6, and so on).


PREREQUISITES
=============

To install CGAL, you need 'cmake' and several third-party libraries. 
Some are mandatory for entire CGAL, some are mandatory for particular 
CGAL packages, some are only needed for demos.

   * CMake (>= 2.4.8), the build system used by CGAL
     Required for building CGAL
     CMake >= 2.6 is recommended, since it supports a cross platform GUI
     http://www.cmake.org/

   * Boost (>= 1.34.1)
     Required for building CGAL and for applications using CGAL
     Required compiled Boost library: Boost.Threads
     Optional compiled Boost library: Boost.Program_options
     http://www.boost.org/   or   http://www.boostpro.com/products/free/
     You need the former if you plan to compile the boost libraries yourself,
     for example because you target 64 bit applications for XP64

   * Exact Arithmetic           
     CGAL combines floating point arithmetic with exact arithmetic, in order
     to be fast and reliable. CGAL offers support for GMP and MPFR, for LEDA
     exact number types, as well as a built-in exact number type used when
     none of the other two is installed.
     Required by several examples which have hard coded the number type.

     - GMP (>= 4.1.4)
       http://gmplib.org/
       or precompiled version that can be downloaded with CGAL-x.y-Setup.exe
       based on http://fp.gladman.plus.com/computing/gmp4win.htm

     - MPFR (>= 2.2.1)
       http://www.mpfr.org/
       or precompiled version that can be downloaded with CGAL-x.y-Setup.exe
       based on http://fp.gladman.plus.com/computing/gmp4win.htm

     - LEDA (>= 6.2)
       http://www.algorithmic-solutions.com/leda/index.htm

   * Visualization 
     Required for most demos

     - Qt3 (>= 3.3)
       ftp://ftp.qt.nokia.com/qt/source/

     - Qt4 (>= 4.2)
       http://qt.nokia.com/

     - libQGLViewer
       http://www.libqglviewer.com/

     - Geomview
       http://www.geomview.org/
       Not suported with Visual C++

   * Numerical Libraries
 
     - BLAS, LAPACK, ATLAS
       Required by the packages:
       o Estimation of Local Differential Properties
       o Approximation of Ridges and Umbilics
       o Planar Parameterization of Triangulated Surface Meshes
       http://www.netlib.org/blas/, http://www.netlib.org/lapack/
       or precompiled version that can be downloaded with CGAL-x.y-Setup.exe

     - TAUCS (sparse matrix solver)
       Accelerates the package:
       o Planar Parameterization of Triangulated Surface Meshes
       http://www.tau.ac.il/~stoledo/taucs/
       or precompiled version that can be downloaded with CGAL-x.y-Setup.exe

     - RS (root isolation)
       Required by the package:
       Algebraic Kernel
       http://www.loria.fr/equipes/vegas/rs/

   * Miscellaneous

     - zlib         
       Optional for the package:
       o Surface Mesh Generator can read compressed images directly
       http://www.zlib.net/


CONFIGURATION
=============

To configure CGAL, type

  cmake .

in the directory that contains this INSTALL file. You can add several options
to this command. The most important ones are

  -DCMAKE_INSTALL_PREFIX=<dir>          installation directory [/usr/local]
  -DCMAKE_BUILD_TYPE=<Debug|Release>    build type [Release]
  -DBUILD_SHARED_LIBS=<TRUE|FALSE>      shared or static libraries [TRUE]
  -DCMAKE_C_COMPILER=<program>          C compiler [gcc]
  -DCMAKE_CXX_COMPILER=<program>        C++ compiler [g++]

In case you want to add additional compiler and linker flags, you can use

  -DCGAL_CXX_FLAGS                      additional compiler flags
  -DCGAL_MODULE_LINKER_FLAGS            add. linker flags (static libraries)
  -DCGAL_SHARED_LINKER_FLAGS            add. linker flags (shared libraries)
  -DCGAL_EXE_LINKER_FLAGS               add. linker flags (executables)

Variants with the additional suffix "_DEBUG" and "_RELEASE" allow to set
separate values for debug and release builds. In case you do not want to add
additional flags, but to override the default flags, replace "CGAL" by
"CMAKE" in the variable names above.

By default demos and examples are not configured. If you want to configure
them at the same time as the CGAL library, you can use 

  -DWITH_examples=true
  -DWITH_demos=true

Note that CMake maintains a cache name "CMakeCache.txt". If you change options
(or your environment changes), it is best to remove that file to avoid
problems.


BUILDING
========

To build the CGAL libraries, type

  make                               (or nmake in a Windows command prompt)

If you want, you can install the CGAL header and libraries. To do so, type

  make install

You can build all demos or examples by typing

  make demos                          or
  make examples

If you are interested in the demos or examples of just a particular module,
you can build them in the following way:

  make -C demo/Alpha_shapes_2        (or: cd demo/Alpha_shapes_2; make)
  make -C examples/Alpha_shapes_2    (or: cd examples/Alpha_shapes_2; make)

A list of all available make targets can be obtained by

  make help


OUT-OF-SOURCE BUILDS
====================

The above instructions build the CGAL library in the same directory tree as
the CGAL sources. Sometimes it is advisable to place all the generated files
somewhere else. For example, if you want to build the library in several
configurations (debug and release, different compilers, and so on). Using
different build directories keeps all the generated files separated for each
configuration.

In the following, $CGAL_SRC denotes the directory with the CGAL sources;
$CGAL_BUILD is an arbitrary directory where the generated files will be
placed. You can perform an out-of-source build as follows:

  mkdir $CGAL_BUILD
  cd $CGAL_BUILD
  cmake [options] $CGAL_SRC
  make
  make install                       (if desired)
  make demos                         (if desired)
  make examples                      (if desired)

Basically, the only difference is the last parameter of the "cmake" command:
$CGAL_SRC instead of "." .

