This page is located in archive.

Untitled Document

CGAL installation instructions for Windows (XP, Vista, 7) and Visual Studio (2005 or higher)
author: Lukas Novosad - novosluk@fel.cvut.cz

This document contains a concentrated version of the installation instructions provided with the installation of cgal.
For more detailed instructions and a better insight refer to the official documentation found under www.cgal.org.
I used Visual Studio 2008 running on a Windows 7 64bit system.

We will configure CGAL with CMAKE, in case your system does not provide CMAKE you must download it from http://www.cmake.org/ and install it.

CGAL uses the following libraries:

- blas     - a library for basic linear algebra operations
- boost    - a collection of various C++ libraries
- gmp      - a C library for arbitrary precision arithmetic
- lapack   - a fortran library for linear algebra operations
- leda     - a C++ library of data types and algorithms of combinatorial computing
- mpfi/rs  - a C library for multiple precision floating-point interval arithmetic
- mpfr     - a C library for multiple precision floating-point computations
- qlviewer - a C++ library to create OpenGL 3D viewers, based on Qt
- Qt	   - a C++ GUI toolkit (similar to wxWidgets)
- taucs    - a C library of sparse linear solvers 
- zlib     - a compression library

Don't worry, we don't need all of them and some are provided by CGAL.

First we have to obtain the required libraries:

- Download the CGAL library sources from http://www.cgal.org/ and install them.

- Download the boost libraries from http://www.boost.org/, pick version 1.40.0 or 1.41.0,
  newer releases tend to cause problems with CGAL 3.6.1 (such as the undefined data type intmax_t).
  You may either
  a) compile them according to the provided documentation, or
  b) use the installation package from http://www.boostpro.com/ and make sure you check Boost.Thread and Boost.Program_options during the installation.
  Important Note: Depending upon which way you choose to install boost the libraries end up in a different directory:
  a) $(BOOST_ROOT)\stage\lib
  b) $(BOOST_ROOT)\lib
  Keep this in mind when you set the paths for the boost libraries in your Visual Studio projects.

- Download the qlviewer library from http://www.libqglviewer.com/ and install the viewer.

- Download Qt4 libraries from http://qt.nokia.com/, pick the LGPL version for Windows (Visual Studio).

Then we check and set the required environment variables, either as system variables or user variables:
example: CGAL_DIR=C:\CGAL-3.6.1

example: BOOST_ROOT = C:\boost_1_40_0

example: QGLVIEWERROOT=C:\libQGLViewer-2.3.6\QGLViewer

example: QTDIR=C:\Qt\4.6.3
and append the folder which contains the Qt4 binaries to the Path environment variable
example: Path=...;C:\Qt\4.6.3\bin

Now we are ready to configure and build the CGAL library. In order to configure the library you have to use CMAKE (refer to the official CGAL installation guide if necessary).
When you run "cmake-gui ." in the CGAL installation directory you basically see a list of options for the CGAL configuration.
However, we recommend that you create subdirectories inside the CGAL installation directory. Inside these subdirectories you then run "cmake-gui .." and everything else stays the same with one important advantage:
In case you run into serious problems or mess up the configuration you may then simply delete the subdirectory without affecting the initial CGAL installation and start anew.

When you specify the generator for the project it is important that you choose the 32bit version, e.g. not the one with the Win64 suffix.
example: Visual Studio 9 2008

We recommend that you create a subdirectory called "CGAL_LIB_ONLY", for example, and configure only the CGAL library by checking the following flags at the end of the configuration list:

WITH_CGAL_Qt4 (NOTE: as stated in the CGAL installation guide you need Qt3 for certain examples only)

and, most importantly, do not check the demos and examples at the very bottom.

Then you configure the solution. Most probably you will have to hit the "Configure" button several times until all red entries in the list of options are gone.
If there are problems with any of the libraries (for example with GMP) then try to solve this by unchecking the checkbox, configure, then re-enable the checkbox and configure again.
Another possibility is to delete the corresponding entry (for example: GMP_INCLUDE_DIR and GMP_LIBRARIES_DIR) in order to force CMAKE to look up these paths again and reinitialize them.
You may of course set options manually in case CMAKE does not find them by itself. You may also look for valuable input in the forums on the internet. When all else fails, you may contact us ;-)

After the successful configuration, you can generate the solution by hitting the "Generate" button and the corresponding CGAL.sln file will be created in your subdirectory.
When you open it, you will find a short list of projects. The important one to build the CGAL library is


And after you have built the library you can install it by building the 


project. This will copy the library into the "Program Files" folder. Note: You have to run Visual Studio as an administrator in order to successfully install the library.
If you want another destination (for example D:\mylibs\CGAL), you have to specify it during the configuration step with CMAKE. The variable for this is called


which is initially set to "C:/Program Files/CGAL". You also have to change the CGAL_DIR environment variable accordingly in order to use the CGAL library in your programs.

Note: You actually don't have to install the library, you may leave it where you built it and simple update the environment variable to point to the right location,
e.g. the subdirectory you created to build to CGAL library in the first place (CGAL_LIB_ONLY), or, if you didn't create any subdirectory at all, you may leave it as initially set at the beginning of this document.

Finally, if you want to build the demos and examples which are provided by CGAL you should create another subdirectory called "CGAL_COMPLETE", for example, and check the additional two checkboxes:


and again configure and generate the corresponding solution. This .sln contains all the demos and examples, e.g. a huge list of projects, one for each demo and each example.
The important projects are

demos - for all the demos which have been configured

examples - for all the examples which have been configured

However, if you build these, be warned, this takes a lot of time and memory to build, and a lot of disk space (more than 1GB RAM and about 13GB disk space). So you need a powerfull machine for this.
We recommend that you build an example only if needed. For this, you simply build the corresponding project in the "CGAL_COMPLETE" Visual Studio solution.
Note: Some demos and examples require specific libraries, such as Qt3, for example, and you need to configure CGAL with these libraries in order to be able to build them.

Congratulations! You have successfully built and installed the CGAL library on your system.

courses/cg/links/inst-vs2005.txt · Last modified: 2023/09/19 21:40 (external edit)