SFCGAL source code is available on the corresponding github repository.
The master branch is the development branch and has a tag for each released version.
SFCGAL has been successfully compiled and tested on the following platforms :
- Linux 32 and 64 bits with gcc and clang-3.0
- Windows with mingw
- MacOSX with clang-4.0 (please note that a compilation error occures with clang-3.1)
- A C++ compiler, see above for supported platforms
- CMake version ≥ 2.8.6
- CGAL version ≥ 4.3
- Boost version ≥ 1.54
- MPFR version ≥ 2.2.1
- GMP version ≥ 4.2
Optional dependencies for viewer and 3D format export
- OpenSceneGraph version ≥ 3.1
The compilation process is based on CMake. On linux run:
cmake . && make && sudo make install
You may specify dependencies locations with environment variables in case cmake doesn't find them automatically (see below).
CGAL uses a lot of templated constructions. Therefore the building process may take a while.
Default building options should work out-of-the-box. You may want to fine tune the compilation process with build options.
Dependencies location (environment variables)
Build options (cmake options)
|CMAKE_INSTALL_PREFIX||/usr/local||Specifies where SFCGAL will be installed when
|CMAKE_BUILD_TYPE||Release||Switches between a
|SFCGAL_CHECK_VALIDITY||ON||If set to
- MinGW fails to build boost thread for version 1.46.1 (fixed in boost 1.47.0, please upgrade your boost version)
- Use the same cmake option for boost with CGAL and SFCGAL (particularly
- Missing boost definitions in CGAL-4.1 to use static libraries (dllexport/dllimport)
Patch CGAL-4.1/CMakeLists.txt with the following lines to build with boost static libraries (
option( Boost_USE_STATIC_LIBS "boost use dynamic libraries" OFF ) if( Boost_USE_STATIC_LIBS ) message( STATUS "Boost_USE_STATIC_LIBS=ON" ) add_definitions( "-DBOOST_THREAD_USE_LIB" ) else() message( STATUS "Boost_USE_STATIC_LIBS=OFF" ) add_definitions( "-DBOOST_ALL_DYN_LINK" ) endif()
Installation with PostGIS
On a recent PostGIS source tree (≥ 2.1), an additional option for the
configure script called
--with-sfcgal is available.
Set it to wherever your SFCGAL installation is. If you used the default directory
/usr/local and if the
bin sub-directory is present in your
PATH, then SFCGAL should be detected without any aditionnal option.