Installation
Source code
SFCGAL source code is available on the corresponding gitlab repository.
The master branch is the development branch and has a tag for each released version.
Source code of the 1.3 release can be found with the tag v1.3.0 You can direclty download a zip or tarball.
Supported platforms
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)
Requirements
- 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
- Qt4
Compilation
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)
Varible Name | Description |
---|---|
GMP_DIR | GMP location |
MPFR_DIR | MPFR location |
CGAL_DIR | CGAL location |
BOOST_ROOT | Boost location |
Build options (cmake options)
Option Name | Default | Description |
---|---|---|
CMAKE_INSTALL_PREFIX | /usr/local | Specifies where SFCGAL will be installed when make install is invoked |
CMAKE_BUILD_TYPE | Release | Switches between a Release build, specially crafted for speed efficiency and a Debug build, specifically crafted for development. The Debug build will also set CGAL to be used in Debug mode. In this case, lots of assertions are kept present in the code and it results in a very slow code. |
SFCGAL_BUILD_VIEWER | OFF | Turn to ON to build the viewer and conversion tools. You can run the viewer with viewer-SFCGAL |
SFCGAL_BUILD_TESTS | OFF | Turn to ON to build unit and regression tests. Your can then run the tests unit-test-SFCGAL , standalone-regress-test-SFCGAL and garden-test-SFCGAL |
SFCGAL_BUILD_EXAMPLES | OFF | Turn to ON to build examples. |
SFCGAL_BUILD_BENCH | OFF | Turn to ON to build benchmark tests. |
SFCGAL_WARNING_AS_ERROR | OFF | Turn to ON to convert build warnings into errors |
SFCGAL_BUILD_WITH_GPROF | OFF | Turn to ON to build with GNU gprof |
SFCGAL_USE_STATIC_LIBS | OFF | Turn to ON , to compile as a static library. Do not change this setting unless you know what your are doing |
Troubleshouting
Windows/MinGW
- 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
Boost_USE_STATIC_LIBS=OFF
) - 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 (Boost_USE_STATIC_LIBS=ON
).
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.