This tutorial will guide you through the different steps to install CGAL and its third party libraries.
The purpose of this tutorial is that you don't have to spend weeks like me fighting to make them all work.
Feel free to comment on the gist comment section to make corrections or improvements !
This tutorial is divided up like this:
- Introduction
- Ressources (Libraries version & Download links)
- Notes
- Essential installation
- Optional libraries
- Demos & Examples building examples
- It's recommended to use Windows PowerShell with administrator privileges as your CLI
- All necessary environment variables will be configured so that CMake automatically finds all libraries and you don't have to specify the libraries' paths each time to CMake.
- When adding any environnement variable, add for All users (system variables)
- Environement variables are case unsensitive (PATH = Path)
- Add new environement variables in PATH on top of the list (to avoid conflicts)
- You must restart your CLI and CMake for new environment variables to take effect
- In this tutorial,
C:\dev
will be used as root directory for all installations. The folder can be wherever you want, but it is strongly recommended that the path has no spaces.
- C++ compiler (get MSVC compiler by insatalling Visual Studio)
- Git
- CMake
-
Download
boost_<version>.zip
-
Extract
boost_<version>
inC:\dev
-
Go to your Boost source directory with your CLI, and do:
.\bootstrap.bat .\b2.exe link=shared
-
Set the following three environment variables:
BOOST_DIR = C:\dev\boost_<version>\stage\lib\cmake\Boost-<version>
(path toBoostConfig.cmake
)
BOOST_LIBRARYDIR = C:\dev\boost_<version>\stage\lib
(path to all .lib)
BOOST_INCLUDEDIR = C:\dev\boost_<version>
(root directory) -
Add
C:\dev\boost_<version>\stage\lib
toPath
environement variable (path to all .dll)
CGAL is header only and don't need to be build.
- Download
CGAL-<version>.zip
andCGAL-<version>-win64-auxiliary-libraries-gmp-mpfr.zip
files - Extract
CGAL-<version>.zip
inC:\dev
- Extract
CGAL-<version>-win64-auxiliary-libraries-gmp-mpfr.zip
and past hisauxiliary
folder inC:\dev\CGAL-<version>
(overwrite existing files) - Set
CGAL_DIR
environement variable toC:\dev\CGAL-<version>
(path toCGALConfig.cmake
) - Add
C:\dev\CGAL-<version>\auxiliary\gmp\lib
toPath
environement variable (path tolibgmp-10.lib
)
Notes:
If your GMP and MPFR libraries are not in C:\dev\CGAL-<version>\auxiliary
, you have to specify they path in environement variables.
- Set
GMP_DIR
environement variable to the GMP root directory - Set
MPFR_DIR
environement variable to the MPFR root directory
Well done!
CGAL is now well installed and functional. However, many packages require additional libraries to work.
Missing libraries will usually be specified to you when you configure your program with CMake.
Eigen is header only (see Eigen's "Getting stated" page) and don't need to be build.
- Download
eigen-<version>.zip
- Extract
eigen-<version>
inC:\dev
- Set
EIGEN3_INC_DIR
environment variable toC:\dev\eigen-<version>
(path tosignature_of_eigen3_matrix_library
)
- Download QT (version 5 needed)
- Follow the instructions from the installer
- Select following package:
- MSVC 2019
- Qt 3D
- Qt Script
- Set the intallation directory to
C:\dev\Qt
- Select following package:
- Set
QTDIR
environement variable toC:\dev\Qt\<version>
- Add
C:\dev\Qt\<version>\msvc2019_64\bin
toPath
environement variable (path to all .dll)
-
Download
zlib<version>.zip
-
Extract it and past
zlib-<version>
inC:\dev
-
Go to your zlib source directory with your CLI, and do:
mkdir .\build cd .\build\ cmake-gui ..
CMake-Gui will open up
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
-
Click on the button Generate and then Open Project
Visual Studio will open up -
Put your "Solution Configuration" in
Release
mode -
Build
ALL_BUILD
-
Copy
C:\dev\zlib-<version>\build\zconf.h
file inC:\dev\zlib-<version>
(otherwise the header file will not be found) -
Set
ZLIB_ROOT
environement variable toC:\dev\zlib-<version>
-
Add
C:\dev\zlib-<version>\build\Release
toPath
environement variable (path tozlib.lib
)
-
Download
metis-<version>.tar.gz
-
Extract
metis-<version>
inC:\dev
-
Edit the file
include/metis.h
and specify the width (32 or 64 bits) of the elementary data type used in METIS.
You can editIDXTYPEWIDTH
andREALTYPEWIDTH
. -
Go to your METIS source directory with your CLI, and do:
mkdir .\build cd .\build\ cmake-gui ..
CMake-Gui will open up
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
-
Click on the button Generate and then Open Project
Visual Studio will open up -
Put your "Solution Configuration" in
Release
mode -
Build
ALL_BUILD
If you got a
Error c2059: Syntax error: '('
modify therint(x)
macro inC:\dev\metis-5.1.0\GKlib\gk_arch.h
file with the folowing code : (see issue 30)#ifdef __MSC__ #if (_MSC_VER < 1800) /* MSC does not have rint() function */ #define rint(x) ((int)((x)+0.5)) #endif
-
Set
METIS_ROOT
environement variable toC:\dev\metis-<version>
-
Add
C:\dev\metis-<version>\build\libmetis\Release
toPath
environement variable (path tometis.lib
)
- Download the last Setup "Complete package" of Grep for Windows
- Execute the Setup and extract the
GnuWin32
folder inC:\dev
- Add the path to the Grep .exe (
C:\dev\GnuWin32\bin
) files to thePath
environment variable.
You need to install Eigen3 and Grep before installing libnabo !
-
Go to your desired directory with your CLI (here
C:\dir
) -
Do the folowing commands
git clone https://github.com/ethz-asl/libnabo mkdir .\libnabo\build mkdir .\libnabo\build\install cd .\libnabo\build\ cmake-gui ..
CMake-Gui will open up
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
An error will be reported, because CMake does not know yet where to find the libraries. The next steps will tell it where to find them.
-
Set the CMake variable
CMAKE_INSTALL_PREFIX
toC:/dev/libnabo/build/install
CAUTION ! Use forward slash
/
-
Click on the button Configure, Generate and then Open Project Visual Studio will open up
Maybe you will have messages about Doxygen, OpenCL, ANN, FLANN and Python missing. They are not necessary to install libnano.
-
Put your "Solution Configuration" in
Release
mode -
Build the
INSTALL
project -
Set
libnabo_DIR
environement variable toC:\dev\libnabo\build\install\share\libnabo\cmake
(path tolibnaboConfig.cmake
)
You need to install libnabo before installing libpointmatcher !
-
Go to your desired directory with your CLI (here
C:\dir
) -
Do the folowing commands
git clone https://github.com/ethz-asl/libpointmatcher mkdir .\libpointmatcher\build mkdir .\libpointmatcher\build\install cd .\libpointmatcher\build\ cmake-gui ..
CMake-Gui will open up
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
-
Set the CMake variable
CMAKE_INSTALL_PREFIX
toC:/dev/libpointmatcher/build/install
CAUTION ! Use forward slash
/
-
Click on the button Configure, Generate and then Open Project
Visual Studio will open up -
Put your "Solution Configuration" in
Release
mode -
Build the
INSTALL
project -
Set
libpointmatcher_DIR
environement variable toC:\dev\libpointmatcher\build\install\share\libpointmatcher\cmake
You need to install Eigen3 before installing OpenGR !
-
Go to your desired directory with your CLI (here
C:\dir
) -
Do the folowing commands
git clone https://github.com/STORM-IRIT/OpenGR mkdir .\OpenGR\build cd .\OpenGR\build\ cmake-gui ..
CMake-Gui will open up
-
Before first configuration, add the CMake variable
EIGEN_INCLUDE_DIR
(of type PATH) toC:\dev\eigen-<version>
.CAUTION ! If you don't do that, OpenGR will donwload its own version of Eigen.
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
-
Click on the button Generate and then Open Project
Visual Studio will open up -
Put your "Solution Configuration" in
Release
mode -
Build the
ALL_BUILD
project -
Set
OpenGR_DIR
environement variable toC:\dev\OpenGR\build
-
Download
VTK-<version>.tar.gz
-
Extract it and past
VTK-<version>
inC:\dev
-
Go to your VTK source directory with your CLI, and do:
mkdir .\build cd .\build\ cmake-gui ..
CMake-Gui will open up
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
-
Click on the button Generate and then Open Project
Visual Studio will open up -
Put your "Solution Configuration" in
Release
mode -
Build the
ALL_BUILD
project -
Set
VTK_DIR
environement variable toC:\dev\VTK-<version>\build
-
Go to your desired directory with your CLI (here
C:\dir
) -
Do the folowing commands
git clone https://github.com/CGAL/LAStools mkdir .\LAStools\build cd .\LAStools\build\ cmake-gui ..
CMake-Gui will open up
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
-
Click on the button Generate and then Open Project
Visual Studio will open up -
Put your "Solution Configuration" in
Release
mode -
Build the
ALL_BUILD
project -
Set
LASLIB_INC_DIR
environement variable toC:\dev\LAStools\LASlib\inc
-
Add
C:\dev\LAStools\build\Release
toPath
environement variable
TBB is for the moment no longer compatible with CGAL. See issue #5676.
-
Go to your desired directory with your CLI (here
C:\dir
) -
Do the folowing commands
git clone https://github.com/oneapi-src/oneTBB mkdir .\oneTBB\build mkdir .\oneTBB\build\install cd .\oneTBB\build\ cmake-gui ..
CMake-Gui will open up
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
-
Set the CMake variable
CMAKE_INSTALL_PREFIX
toC:/dev/oneTBB/build/install
CAUTION ! Use forward slash
/
-
Click on the button Generate and then Open Project
Visual Studio will open up -
Put your "Solution Configuration" in
Release
mode -
Build the
INSTALL
project -
Set
TBB_ROOT
environement variable toC:\dev\oneTBB\build\install
-
Add
C:\dev\oneTBB\build\msvc_19.28_cxx_64_md_release
toPath
environement variable
- Download GLPK for Windows
- Un-zip it in your desired directory (here
C:\dir
) - Edit the script
Build_GLPK_with_VC14.bat
with the right paths. Mine gives :rem Build GLPK with Microsoft Visual Studio Enterprise 2019 rem NOTE: Make sure that HOME variable specifies correct path set HOME="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC" call %HOME%\Auxiliary\Build\vcvarsall.bat x64 copy config_VC config.h %HOME%\Tools\MSVC\14.28.29910\bin\Hostx64\x64\nmake.exe /f Makefile_VC %HOME%\Tools\MSVC\14.28.29910\bin\Hostx64\x64\nmake.exe /f Makefile_VC check pause
- Double click on the script
- Add
C:\dev\glpk-<version>\w64
toPath
environement variable
GLPK doesn't provide CMake support and will not be automatically found by your project. It will be necessary to configure Cmake variables manually. See CGAL doc.
CGAL wrapper for Tensorboard no longer works. See issue 4928.
It's recommended to use the ETHZ classifier. See doc.
- Download
doxygen-<version>-setup.exe
- Follow the instructions from the installer
- Set the intallation directory to
C:\dev\doxygen
- Set the intallation directory to
- Download
basic-miktex-<version>-x64.exe
- Follow the instructions from the installer
- Set the intallation directory to
C:\dev\MiKTeX
- Set the intallation directory to
- Download
gs<version>w64.exe
- Follow the instructions from the installer
- Set the intallation directory to
C:\dev\gs
- Set the intallation directory to
- Add
C:\dev\gs\bin
toPath
environement variable (path togswin64c.exe
)
The Polyedron demo is a complet demo showing the use of many packages from CGAL with a user interface.
You need first to install all these packages to take advantage of all the features of the demo (but this is not mandatory):
- Eigen3
- METIS
- Qt5
- zlib
- OpenGR
- libpointmatcher
- VTK
- LASzip & LASlib
- Tensorflow
- OpenCV
- SCIP or GLPK
- LibSSH
- TBB
-
Go to
C:\dev\CGAL-<version>\demo\Polyhedron
with your CLI -
Do the folowing commands
mkdir .\build cd .\build\ cmake-gui ..
CMake-Gui will open up
-
Click on the button Configure and specify the generator for the project (Visual Studio 16 2019)
An error will be reported. The next steps will correct it
-
Set
CGAL_Boost_USE_STATIC_LIBS
toTrue
-
Click on the button Configure, Generate and then Open Project
Visual Studio will open up -
Put your "Solution Configuration" in
Release
mode -
Build the
ALL_BUILD
project -
Launch the demo found in
C:\dev\CGAL-<version>\demo\Polyhedron\build\Release
-
METIS_PartMeshNodal
Error :
'C2664 int METIS_PartMeshNodal(idx_t *,idx_t *,idx_t *,idx_t *,idx_t *,idx_t *,idx_t *,real_t *,idx_t *,idx_t *,idx_t *,idx_t *)' : cannot convert argument 7 from 'int *' to 'idx_t *'
Solution (link or code) : CGAL GitHub issue n°5410
-
METIS_PartMeshDual
Same as METIS_PartMeshNodal error
The demo compilation of the windows platform is so complicated, why don't you provide directly compiled binary files?