​11 Building CGAL​

本文详细介绍了如何配置、构建、安装和使用CGAL库,包括选择不同组件、设置编译器和链接器标志、处理第三方库依赖以及管理编译类型。此外,还探讨了在不同平台上的构建选项,如Unix Makefiles、Visual Studio项目,以及如何为程序创建CMakeLists.txt文件。最后,总结了CGAL配置过程中涉及的关键变量和工作绕过策略。
摘要由CSDN通过智能技术生成

11 Building CGAL

The results of a successful configuration are build files that control the build step. The nature of the build files depends on the generator used during configuration, but in all cases they contain several targets, one per library, and a default global target corresponding to all the libraries.

For example, in a Unix-like environment the default generator produces makefiles. You can use the makecommand-line tool for the succeeding build step as follows:

 
cd CGAL-4.4
# build all the selected libraries at once
make
 

The resulting libraries are placed in the subdirectory lib under <CMAKE_BINARY_DIR> (which is CGAL-4.4 in case you run an in-source-configuration).

With generators other than UNIX Makefiles the resulting build files are solution and project files which should be launched in an Ide, such as Visual Studio or KDevelop3. They will contain the targets described above, which you can manually build as with any other solution/project within your Ide.

Alternatively, you can build it with the command line version of the Visual Studio Ide:

 
devenv CGAL.sln /Build Debug
 

The "Debug" argument is needed because CMake creates solution files for all four configurations, and you need to explicitly choose one when building (the other choices are Release, RelWithDebInfo and MinSizeRel).

Advanced

The build files produced by CMake are autoconfigured. That is, if you change any of the dependencies, the build step automatically goes all the way back to the configuration step. This way, once the target has been configured the very first time by invoking cmake, you don't necessarily need to invoke cmake again. Rebuilding will call itself cmake and re-generate the build file whenever needed. Keep this in mind if you configure CGAL for the Visual Studio IDE since a build could then change the solution/project file in-place and VS will prompt you to reload it.

If you have turned on the configuration of examples (-DWITH_examples=ON) and/or demos (-DWITH_demos=ON), there will be additional targets named examples and demos, plus one target for each example and each demo in the build files. None of these targets are included by default, so you need to build them explicitly after the CGAL libraries have been successfully built. The targets examples and demos include themselves all the targets for examples and demos respectively.

# build all examples at once
make examples
# build all demos at once
make demos
# build only the Straight Skeleton demo
make Straight_skeleton_2_demo
 

Advanced

When using UNIX Makefiles you can find out the exact name of the example or demo target of a particular package by typing make help | grep <package>.

12 Installing CGAL

On many platforms, library pieces such as headers, docs and binaries are expected to be placed in specific locations. A typical example being /usr/include and /usr/lib on Unix-like operating systems or C:/Program Files/ on Windows. The process of placing or copying the library elements into its standard location is sometimes referred to as Installation and it is a postprocessing step after the build step.

CMake carries out the installation by producing a build target named install. The following example shows a typical session from configuration to installation in a Unix-like environment:

cd CGAL-4.4
cmake . # configure
make # compile
make install # install
 

If you use a generator that produces IDE files (for Visual Studio for instance) there will be an optional INSTALL project, which you will be able to "build" to execute the installation step.

Advanced

The files are copied into a directory tree relative to the installation directory determined by the CMake variable CMAKE_INSTALL_PREFIX. This variable defaults to /usr/local under Unix-like operating systems and C:\Program Files under Windows. If you want to install to a different location, you must override that CMake variable explicitly at the configuration time and not when executing the install step.

The file CGALConfig.cmake is installed by default in $CMAKE_INSTALLED_PREFIX/lib/CGAL-4.4.

13 Example Configuration

Below is an example output on a linux machine with g++4.4 installed, using CMake 2.8.5, and the following command-line call to cmake:

cmake -DWITH_examples=OFF -DWITH_demos=OFF -DCMAKE_BUILD_TYPE=Release 
/path/to/unpacked/CGAL-tarball/
​
-- The CXX compiler identification is GNU
-- The C compiler identification is GNU
-- Check for working CXX compiler: /usr/bin/g++-4.4
-- Check for working CXX compiler: /usr/bin/g++-4.4 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-4.4
-- Check for working C compiler: /usr/bin/gcc-4.4 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
== Setting paths ==
== Build CGAL from release: CGAL-4.1 ==
-- Packagenames: CGAL-4.1
== Setting paths (DONE) ==
== Generate version files ==
-- CGAL_MAJOR_VERSION=4
-- CGAL_MINOR_VERSION=1
-- CGAL_BUGFIX_VERSION=0
-- CGAL_SONAME_VERSION=10
-- CGAL_SOVERSION =10.0.0
-- CGAL_REFERENCE_CACHE_DIR=
-- Building shared libraries
-- Targetting Unix Makefiles
-- Using /usr/bin/g++-4.4 compiler.
-- USING CMake version: 2.8.5
-- System: Linux
-- USING GCC_VERSION = '4.4.5'
-- Using gcc version 4 or later. Adding -frounding-math
== Generate version files (DONE) ==
== Detect external libraries ==
-- Build type: Release
-- USING CXXFLAGS = ' -frounding-math -O3 -DNDEBUG'
-- USING LDFLAGS = ' '
-- External libraries supported: GMP;GMPXX;MPFR;zlib;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;TAUCS;EIGEN3;BLAS;LAPACK;QGLViewer;ESBTL;NTL
-- Preconfiguring library: GMP ...
-- GMP has been preconfigured:
-- CGAL_UseGMP-file: 
-- GMP include: /usr/include/
-- GMP libraries: /usr/lib/libgmp.so
-- GMP definitions: 
-- USING GMP_VERSION = '4.3.2'
-- Preconfiguring library: GMPXX ...
-- GMPXX has been preconfigured:
-- CGAL_UseGMPXX-file: 
-- GMPXX include: /usr/include
-- GMPXX libraries: /usr/lib/libgmpxx.so
-- GMPXX definitions: 
-- Preconfiguring library: MPFR ...
-- MPFR has been preconfigured:
-- CGAL_UseMPFR-file: 
-- MPFR include: /usr/include/
-- MPFR libraries: /usr/lib/libmpfr.so
-- MPFR definitions: 
-- USING MPFR_VERSION = '3.0.0'
-- Boost version: 1.39.0
-- Found the following Boost libraries:
-- thread
-- Boost include: /usr/include/boost_1_39_0/include/boost-1_39
-- Boost libraries: /usr/lib/libboost_thread-mt.so;pthread
-- Boost definitions: 
-- USING BOOST_VERSION = '1.39.0'
== Detect external libraries (DONE) ==
== Write compiler_config.h ==
-- Performing Test CGAL_CFG_ARRAY_MEMBER_INITIALIZATION_BUG - Success
-- Performing Test CGAL_CFG_DENORMALS_COMPILE_BUG - Success
-- Performing Test CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Success
-- Performing Test CGAL_CFG_IEEE_754_BUG - Success
-- Performing Test CGAL_CFG_ISTREAM_INT_BUG - Success
-- Performing Test CGAL_CFG_LONGNAME_BUG - Success
-- Performing Test CGAL_CFG_MATCHING_BUG_5 - Success
-- Performing Test CGAL_CFG_MATCHING_BUG_6 - Success
-- Performing Test CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG - Success
-- Performing Test CGAL_CFG_NO_CPP0X_ARRAY - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_AUTO - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_COPY_N - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_DECLTYPE - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_DELEGATING_CONSTRUCTORS - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS - Success
-- Performing Test CGAL_CFG_NO_CPP0X_INITIALIZER_LISTS - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_ISFINITE - Success
-- Performing Test CGAL_CFG_NO_CPP0X_LAMBDAS - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_LONG_LONG - Success
-- Performing Test CGAL_CFG_NO_CPP0X_NEXT_PREV - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_STATIC_ASSERT - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_TUPLE - Failed
-- Performing Test CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES - Failed
-- Performing Test CGAL_CFG_NO_LIMITS - Success
-- Performing Test CGAL_CFG_NO_LOGICAL_OPERATORS_ALTERNATIVES - Success
-- Performing Test CGAL_CFG_NO_MESSAGE_PRAGMA_BUG - Success
-- Performing Test CGAL_CFG_NO_NEXTAFTER - Success
-- Performing Test CGAL_CFG_NO_STATEMENT_EXPRESSIONS - Success
-- Performing Test CGAL_CFG_NO_STL - Success
-- Performing Test CGAL_CFG_NO_TR1_ARRAY - Success
-- Performing Test CGAL_CFG_NO_TR1_TUPLE - Success
-- Performing Test CGAL_CFG_NO_WARNING_CPP_DIRECTIVE_BUG - Success
-- Performing Test CGAL_CFG_NUMERIC_LIMITS_BUG - Success
-- Performing Test CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG - Success
-- Performing Test CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG - Success
-- Performing Test CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG - Success
-- Performing Test CGAL_CFG_USING_BASE_MEMBER_BUG_2 - Success
== Write compiler_config.h (DONE) ==
== Generating build files ==
-- Configure libCGAL
-- GMP include: /usr/include/
-- GMP definitions: 
-- GMP libraries: /usr/lib/libgmp.so
-- Configured GMP in standard way
-- MPFR include: /usr/include/
-- MPFR definitions: 
-- MPFR libraries: /usr/lib/libmpfr.so
-- Configured MPFR in standard way
-- libCGAL is configured
-- Sources for CGAL component library 'Core' detected
-- Configure libCGALCore
-- GMP include: /usr/include/
-- GMP definitions: 
-- GMP libraries: /usr/lib/libgmp.so
-- Configured GMP in standard way
-- MPFR include: /usr/include/
-- MPFR definitions: 
-- MPFR libraries: /usr/lib/libmpfr.so
-- Configured MPFR in standard way
-- libCGALCore is configured
-- Sources for CGAL component library 'Qt3' detected
-- Sources for CGAL component library 'Qt4' detected
-- Configure libCGALQt4
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/libX11.so
-- USING QT4_VERSION = '4.6.3'
-- OpenGL include: /usr/include
-- OpenGL libraries: /usr/lib/libGLU.so;/usr/lib/libGL.so;/usr/lib/libSM.so;/usr/lib/libICE.so;/usr/lib/libX11.so;/usr/lib/libXext.so
-- OpenGL definitions: 
-- Qt4 include: /usr/include/qt4
-- Qt4 libraries: /usr/lib/libQtOpenGL.so;/usr/lib/libQtGui.so;/usr/lib/libQtCore.so
-- Qt4 definitions: 
-- moc executable: /usr/bin/moc-qt4
-- uic executable: /usr/bin/uic-qt4
-- GMP include: /usr/include/
-- GMP definitions: 
-- GMP libraries: /usr/lib/libgmp.so
-- Configured GMP in standard way
-- MPFR include: /usr/include/
-- MPFR definitions: 
-- MPFR libraries: /usr/lib/libmpfr.so
-- Configured MPFR in standard way
-- libCGALQt4 is configured
-- Sources for CGAL component library 'ImageIO' detected
-- Configure libCGALImageIO
-- Found OpenGL: /usr/lib/libGL.so 
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.3.4")
-- OpenGL include: /usr/include
-- OpenGL libraries: /usr/lib/libGLU.so;/usr/lib/libGL.so;/usr/lib/libSM.so;/usr/lib/libICE.so;/usr/lib/libX11.so;/usr/lib/libXext.so
-- USING ZLIB_VERSION = '1.2.3.4'
-- libCGALImageIO is configured
-- Sources for CGAL component libraries 'CGAL;Core;ImageIO;Qt3;Qt4' detected
== Generating build files (DONE) ==
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/CGAL/4.1/
​
 

14 Multiple Variants of Makefiles (out-of-source build)

While you can choose between release or debug builds, and shared or static libraries, it is not possible to generate different variants during a single configuration. You need to run CMake in a different directory for each variant you are interested in, each with its own selection of configuration parameters.

CMake stores the resulting makefiles and project files, along with several temporary and auxiliary files such as the variables cache, in the directory where it is executed, called CMAKE_BINARY_DIR, but it takes the source files and configuration scripts from CMAKE_SOURCE_DIR.

The binary and source directories do not need to be the same. Thus, you can configure multiple variants by creating a distinct directory for each configuration and by running CMake from there. This is known in CMake terminology as out-of-source configuration, as opposite to an in-source configuration, as showed in the previous sections.

You can, for example, generate subdirectories CGAL-4.4/cmake/platforms/debug and CGAL-4.4/cmake/platforms/release for two configurations, respectively:

mkdir CGAL-4.4/cmake/platforms/debug
cd CGAL-4.4/cmake/platforms/debug
cmake -DCMAKE_BUILD_TYPE=Debug ../../..
mkdir CGAL-4.4/cmake/platforms/release
cd CGAL-4.4/cmake/platforms/release
cmake -DCMAKE_BUILD_TYPE=Release ../../..

15 Configuring and Building Programs Using CGAL

Ideally, configuring and compiling a demo/example/program amounts to

 
cd CGAL-4.4/examples/Straight_skeleton_2
cmake -DCGAL_DIR=$HOME/CGAL-4.4 .
make
 

In this ideal world, as for all shipped examples and demos of CGAL, the required CMakeLists.txt is already provided.

CMake can also be used to configure and build user programs via such CMake-scripts. In this less ideal world, one has to provide the CMakeLists.txt script either manually, or with the help of a shell-script that is introduced below.

For a user program executable.cpp, the ideal world looks like this:

cd /path/to/program 
cgal_create_CMakeLists -s executable
cmake -DCGAL_DIR=$HOME/CGAL-4.4 . 
make

In both examples we specify the CGAL_DIR: During configuration of the CGAL libraries a file named CGALConfig.cmake is generated in CGAL's root directory (in contrast to CGAL's source directory that has been used for installation). This file contains the definitions of several CMake variable that summarize the configuration of CGAL. In order to configure a program, you need to indicate the location of that config file in the CMake variable CGAL_DIR (as indicated in the example above). CGAL_DIR can also be an environment variable. Setting CGAL_DIR makes particular sense if having multiple out-of-source builds of CGAL as in Section Multiple Variants of Makefiles (out-of-source build).

If you have installed CGAL, CGAL_DIR must afterwards be set to $CMAKE_INSTALLED_PREFIX/lib/CGAL. Note that CGAL is recommended to be installed in release mode when using it to build programs.

15.1 Creating a CMake Script for a Program Using CGAL

For compiling a non-shipped program, it is recommended, to also rely on a CMake-supported configuration using a CMakeLists.txt used for configuration.

Use the following Bourne-shell script for programs that are relatively simple to configure:

15.2 cgal_create_CMakeLists

The Bourne-shell script cgal_create_CMakeLists.txt resides in the CGAL-4.4/scripts directory. It can be used to create CMakeLists.txt files for compiling CGAL applications. Executing cgal_create_CMakeLists.txtin an application directory creates a CMakeLists.txt containing rules to build the contained application(s). Three command line options determine details of the configuration.

-s source

If this parameter is given the script will create a single executable for 'source' linked with compilations of all other source files (*.cpp). This behaviour is usually needed for (graphical) demos.

If the parameter is not given, the script creates one executable for each given source file.

-c com1:com2:...

Lists components ("com1", "com2") of CGAL to which the executable(s) should be linked. Valid components are CGAL's libraries (i.e. "Core", "ImageIO", "Qt3" and "Qt4"; note that it only make sense to either pick "Qt3" or "Qt4") and all preconfigured 3rd party software, such as "MPFI", "RS3"). An example is -c Core:GMP:RS3:MPFI

-b boost1:boost2:...

Lists components ("boost1", "boost2") of Boost to which the executable(s) should be linked. Valid options are, for instance, "filesystem" or "program_options".

This options should suffice to create CMakeLists.txt script for most directories containing programs. However, in some special cases, it might still be required to create the script manually, for instance, if some source files/executables need a different linking than other source files.

15.3 cgal_create_cmake_script

Such a shell-script simply creates a CMake script. Processing it with CMake, searches for CGAL using find_package. If found, the variable CGAL_USE_FILE is set to a compilation environment CMake file. Including this file within a CMake script sets up include paths and libraries to link with CGAL and essential third party libraries. Beyond, find_package can demand for COMPONENTS of CGAL, that is, all CGAL libraries libCGAL_Core (Core), libCGAL_ImageIO (ImageIO) , libCGAL_Qt3 (Qt3) and libCGAL_Qt4 (Qt4) or optional 3rd party software such as MPFIRS3. A user is free to create the CMakeLists.txt without calling the script (manual creation).

15.4 Custom Flags in the Programs Using CGAL

Normally, programs linked with CGAL must be compiled with the same flags used by the compilation of CGAL libraries. For this reason, the very first time a program is configured, all the flags given by the CMake variables CMAKE_*_FLAGS are locked in the sense that the values recorded in CGALConfig.cmake are used to override any values given by CMake itself or yourself.

This does not apply to the additional flags that can be given via CGAL_*_FLAGS.

Such inherited values are then recorded in the current CMake cache for the program. The flags are then unlocked in the sense that at any subsequent configuration you can provide your own flags and this time they will not be overridden.

When using the interactive cmake-gui the first press on Configure unlocks the flags, so that you can edit them as needed.

Advanced

The locking of flags is controlled by the variable CGAL_DONT_OVERRIDE_CMAKE_FLAGS which starts out FALSE and is toggled right after the flags have been loaded from CGALConfig.cmake.

If you use the command line tool you can specify flags directly by setting the controlling variable right up front:

cd CGAL-4.4
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-g .
cd CGAL-4.4/examples/Straight_skeleton_2
cmake -DCGAL_DIR=CGAL-4.4 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-O2 -DCGAL_DONT_OVERRIDE_CMAKE_FLAGS=TRUE . 

16 Summary of CGAL's Configuration Variables

Most configuration variables are not environment variables but CMake variables. They are given in the command line to CMake via the -D option, or passed from the interactive interface of cmake-gui. Unless indicated differently, all the variables summarized below are CMake variables.

16.1 Component Selection

The following boolean variables indicate which CGAL components to configure and build. Their values can be ON or OFF.

VariableDefault Value
WITH_examplesOFF
WITH_demosOFF
WITH_CGAL_CoreON
WITH_CGAL_Qt3ON
WITH_CGAL_Qt4ON
WITH_CGAL_ImageIOON

16.2 Compiler and Linker Flags

The following variables specify compiler and linker flags. Each variable holds a space-separated list of command-line switches for the compiler and linker and their default values are automatically defined by CMake based on the target platform.

Have in mind that these variables specify a list of flags, not just one single flag. If you provide your own definition for a variable, you will entirely override the list of flags chosen by CMake for that particular variable.

The variables that correspond to both debug and release builds are always used in conjunction with those for the specific build type.

ProgramBoth Debug and ReleaseRelease OnlyDebug Only
C++ CompilerCMAKE_CXX_FLAGSCMAKE_CXX_FLAGS_RELEASECMAKE_CXX_FLAGS_DEBUG
Linker (shared libs)CMAKE_SHARED_LINKER_FLAGSCMAKE_SHARED_LINKER_FLAGS_RELEASECMAKE_SHARED_LINKER_FLAGS_DEBUG
Linker (static libs)CMAKE_MODULE_LINKER_FLAGSCMAKE_MODULE_LINKER_FLAGS_RELEASECMAKE_MODULE_LINKER_FLAGS_DEBUG
Linker (programs)CMAKE_EXE_LINKER_FLAGSCMAKE_EXE_LINKER_FLAGS_RELEASECMAKE_EXE_LINKER_FLAGS_DEBUG

16.3 Additional Compiler and Linker Flags

The following variables can be used to add flags without overriding the ones defined by cmake.

ProgramBoth Debug and ReleaseRelease OnlyDebug Only
C++ CompilerCGAL_CXX_FLAGSCGAL_CXX_FLAGS_RELEASECGAL_CXX_FLAGS_DEBUG
Linker (shared libs)CGAL_SHARED_LINKER_FLAGSCGAL_SHARED_LINKER_FLAGS_RELEASECGAL_SHARED_LINKER_FLAGS_DEBUG
Linker (static libs)CGAL_MODULE_LINKER_FLAGSCGAL_MODULE_LINKER_FLAGS_RELEASECGAL_MODULE_LINKER_FLAGS_DEBUG
Linker (programs)CGAL_EXE_LINKER_FLAGSCGAL_EXE_LINKER_FLAGS_RELEASECGAL_EXE_LINKER_FLAGS_DEBUG

16.4 Miscellaneous Variables

VariableDescriptionTypeDefault Value
CMAKE_BUILD_TYPEIndicates type of build. Possible values are 'Debug' or 'Release'CMakeRelease
CMAKE_CXX_COMPILERFull-path to the executable corresponding to the C++ compiler to use.CMakeplatform-dependent
CXXIdemEnvironmentIdem

16.5 Variables Used Only When Building Programs (Such as Demos or Examples)

VariableDescriptionTypeDefault Value
CGAL_DIRFull-path to the binary directory where CGAL was configuredEither CMake or Environmentnone

16.6 Variables Providing Information About 3rd-Party Libraries

The following variables provide information about the availability and location of the 3rd party libraries used by CGAL. CMake automatically searches for dependencies so you need to specify these variables if CMake was unable to locate something. This is indicated by a value ending in NOTFOUND.

Since 3rd-party libraries are system wide, many of the CMake variables listed below can alternatively be given as similarly-named environment variables instead. Keep in mind that you must provide one or the other but never both.

16.7 Boost Libraries

In most cases, if Boost is not automatically found, setting the BOOST_ROOT variable is enough. If it is not, you can specify the header and library directories individually. You can also provide the full pathname to a specific compiled library if it cannot be found in the library directory or its name is non-standard.

By default, when Boost binary libraries are needed, the shared versions are used if present. You can set the variable CGAL_Boost_USE_STATIC_LIBS to ON if you want to link with static versions explicitly.

On Windows, if you link with Boost shared libraries, you must ensure that the .dll files are found by the dynamic linker, at run time. For example, you can add the path to the Boost .dll to the PATH environment variable.

VariableDescriptionType
BOOST_ROOT[6]Root directory of your Boost installationEither CMake or Environment
Boost_INCLUDE_DIRDirectory containing the boost/version.hpp fileCMake
BOOST_INCLUDEDIRIdemEnvironment
Boost_LIBRARY_DIRSDirectory containing the compiled Boost librariesCMake
BOOST_LIBRARYDIRIdemEnvironment
Boost_(xyz)_LIBRARY_RELEASEFull pathname to a release build of the compiled 'xyz' Boost libraryCMake
Boost_(xyz)_LIBRARY_DEBUGFull pathname to a debug build of the compiled 'xyz' Boost libraryCMake

16.8 GMP and MPFR Libraries

Under Windows, auto-linking is used, so only the directory containing the libraries is needed and you would specify GMP|MPFR_LIBRARY_DIR rather than GMP|MPFR_LIBRARIES. On the other hand, under Linux the actual library filename is needed. Thus you would specify GMP|MPFR_LIBRARIES. In no case you need to specify both.

CGAL uses both Gmp and Mpfr so both need to be supported. If either of them is unavailable the usage of Gmp and of Mpfr will be disabled.

VariableDescriptionType
WITH_GMPIndicates whether to search and use Gmp/Mpfr or notCMake
GMP_DIRDirectory of Gmp default installationEnvironment
GMP_INCLUDE_DIRDirectory containing the gmp.h fileCMake
GMP_INC_DIRIdemEnvironment
GMP_LIBRARIES_DIRDirectory containing the compiled Gmp libraryCMake
GMP_LIB_DIRIdemEnvironment
GMP_LIBRARIESFull pathname of the compiled Gmp libraryCMake
MPFR_INCLUDE_DIRDirectory containing the mpfr.h fileCMake
MPFR_INC_DIRIdemEnvironment
MPFR_LIBRARIES_DIRDirectory containing the compiled Mpfr libraryCMake
MPFR_LIB_DIRIdemEnvironment
MPFR_LIBRARIESFull pathname of the compiled Mpfr libraryCMake

Under Linux, the Gmpxx is also searched for, and you may specify the following variables:

VariableDescriptionType
GMPXX_DIRDirectory of gmpxx default installationEnvironment
GMPXX_INCLUDE_DIRDirectory containing the gmpxx.h fileCMake
GMPXX_LIBRARIESFull pathname of the compiled Gmpxx libraryCMake

16.9 Qt3 Library

In most cases, if Qt3 is not automatically found, setting the QTDIR environment variable is sufficient. If it is not, you can specify the directory containing the header files and the full pathnames of the Qt3 libraries.

VariableDescriptionType
QTDIRRoot directory of the Qt3 libraryEnvironment
QT3_INCLUDE_DIRDirectory containing the qt.h fileCMake
QT3_QT_LIBRARYFull pathname to the qt library of Qt3CMake
QT3_QTMAIN_LIBRARYFull pathname to the qtmain library of Qt3CMake
QT3_QASSISTANTCLIENT_LIBRARYFull pathname to the qassistantclient library of Qt3CMake
QT3_MOC_EXECUTABLEFull pathname to the moc executable of Qt3CMake
QT3_UIC_EXECUTABLEFull pathname to the uic executable of Qt3CMake

16.10 Qt4 Library

The CMake scripts that search for Qt4 can use the introspection feature of the tool qmake included in Qt4 distributions. If Qt4 is not automatically found, it is sufficient to set the PATH environment variable, so that Qt4 qmake tool is in the path, and before Qt3 qmake if that one exists. One can alternatively set the CMake variable QT_QMAKE_EXECUTABLE. The following variables should be then assigned automatically by CMake.

VariableDescriptionType
QT_INCLUDE_DIRDirectory containing the QtCore/qglobal.h fileCMake
QT_LIBRARY_DIRDirectory containing the compiled Qt4 librariesCMake
QT_(xyz)_LIBRARYFull pathname to the compiled 'xyz' Qt4 library[7]CMake
QT_QMAKE_EXECUTABLEFull pathname to the qmake executable of Qt4CMake
QT_MOC_EXECUTABLEFull pathname to the moc executable of Qt4CMake
QT_UIC_EXECUTABLEFull pathname to the uic executable of Qt4CMake

16.11 LEDA Library

When the LEDA libraries are not automatically found, yet they are installed on the system with base names 'leda' and 'ledaD' (for the release and debug versions resp.), it might be sufficient to just indicate the library directory via the LEDA_LIBRARY_DIRS variable. If that doesn't work because, for example, the names are different, you can provide the full pathnames of each variant via LEDA_LIBRARY_RELEASE and LEDA_LIBRARY_DEBUG.

The variables specifying definitions and flags can be left undefined if they are not needed by LEDA.

VariableDescriptionType
WITH_LEDAIndicates whether to search and use LEDA or notCMake
LEDA_DIRDirectory of LEDA default installationEnvironment
LEDA_INCLUDE_DIRDirectory containing the file LEDA/system/basic.hCMake
LEDA_LIBRARIESDirectory containing the compiled LEDA librariesCMake
LEDA_INC_DIRDirectory containing the file LEDA/system/basic.hEnvironment
LEDA_LIB_DIRDirectory containing the compiled LEDA librariesEnvironment
LEDA_LIBRARY_RELEASEFull pathname to a release build of the LEDA libraryCMake
LEDA_LIBRARY_DEBUGFull pathname to a debug build of the LEDA libraryCMake
LEDA_DEFINITIONSPreprocessor definitionsCMake
LEDA_CXX_FLAGSCompiler flagsCMake
LEDA_LINKER_FLAGSLinker flagsCMake

16.12 MPFI Library

CGAL provides a number type based on this library, but the CGAL library itself does not depend on Mpfi. This means that this library must be configured when compiling an application that uses the above number type.

When Mpfi files are not on the standard path, the locations of the headers and library files must be specified by using environment variables.

VariableDescriptionType
MPFI_DIRDirectory of MPFI default installationEnvironment
MPFI_INCLUDE_DIRDirectory containing the mpfi.h fileCMake
MPFI_INC_DIRIdemEnvironment
MPFI_LIBRARIES_DIRDirectory containing the compiled Mpfi libraryCMake
MPFI_LIB_DIRIdemEnvironment
MPFI_LIBRARIESFull pathname of the compiled Mpfi libraryCMake

16.13 RS and RS3 Library

As said before, only the CGAL univariate algebraic kernel depends on the library Rs. As the algebraic kernel is not compiled as a part of the CGAL library, this library is not detected nor configured at installation time.

CMake will try to find Rs in the standard header and library directories. When it is not automatically detected, the locations of the headers and library files must be specified using environment variables.

Rs needs Gmp 4.2 or later and Mpfi 1.3.4 or later. The variables related to the latter library may also need to be defined.

VariableDescriptionType
RS_DIRDirectory of Rs default installationEnvironment
RS_INCLUDE_DIRDirectory containing the rs_exports.h fileCMake
RS_INC_DIRIdemEnvironment
RS_LIBRARIES_DIRDirectory containing the compiled Rs libraryCMake
RS_LIB_DIRIdemEnvironment
RS_LIBRARIESFull pathname of the compiled Rs libraryCMake

Similar variables exist for Rs3.

VariableDescriptionType
RS3_DIRDirectory of Rs3 default installationEnvironment
RS3_INCLUDE_DIRDirectory containing the file rs3_fncts.h fileCMake
RS3_INC_DIRIdemEnvironment
RS3_LIBRARIES_DIRDirectory containing the compiled Rs3 libraryCMake
RS3_LIB_DIRIdemEnvironment
RS3_LIBRARIESFull pathname of the compiled Rs3 libraryCMake

16.14 NTL Library

Some polynomial computations in CGAL's algebraic kernel are speed up when Ntl is available. As the algebraic kernel is not compiled as a part of the CGAL library, this library is not detected nor configured at installation time.

CMake will try to find Ntl in the standard header and library directories. When it is not automatically detected, the locations of the headers and library files must be specified using environment variables.

VariableDescriptionType
NTL_DIRDirectory of NTL default installationEnvironment
NTL_INCLUDE_DIRDirectory containing the NTL/ZZX.h fileCMake
NTL_INC_DIRIdemEnvironment
NTL_LIBRARIES_DIRDirectory containing the compiled Ntl libraryCMake
NTL_LIB_DIRIdemEnvironment
NTL_LIBRARIESFull pathname of the compiled Ntl libraryCMake

16.15 Eigen Library

Eigen is a header-only template library. Only the directory containing the header files of Eigen 3.1 (or greater) is needed.

VariableDescriptionType
EIGEN3_DIRDirectory of EIGEN default installationEnvironment
EIGEN3_INCLUDE_DIRDirectory containing the file signature_of_eigen3_matrix_libraryCMake
EIGEN3_INC_DIRIdemEnvironment

16.16 QGLViewer Library

Some demos require the GLViewer library.

In most cases, if QGLViewer is not automatically found, setting the QGLVIEWERROOT environment variable is sufficient. If it is not, you can specify the directory containing the header files and the full pathnames of the release and debug libraries

VariableDescriptionType
QGLVIEWERROOTRoot directory of the QGLViewer libraryEnvironment
QGLVIEWER_INCLUDE_DIRDirectory containing the QGLViewer/qglviewer.h fileCMake
QGLVIEWER_LIBRARY_RELEASEFull pathname to a release build of the QGLViewer libraryCMake
QGLVIEWER_LIBRARY_DEBUGFull pathname to a debug build of the QGLViewer libraryCMake

16.17 ESBTL Library

One skin surface example requires the Esbtl library in order to read Pdb files.

If Esbtl is not automatically found, setting the ESBTL_INC_DIR environment variable is sufficient.

VariableDescriptionType
ESBTL_DIRDirectory of ESBTL default installationEnvironment
ESBTL_INC_DIRDirectory containing the ESBTL/default.h fileEnvironment
ESBTL_INCLUDE_DIRDirectory containing the ESBTL/default.h fileCMake

16.18 TBB Library

If Tbb is not automatically found, the user must set the TBBROOT environment variable. On Windows, $TBBROOT\bin\tbbvars.bat <arch> <vs> must be run (running tbbvars.bat without args shows the available parameter values). On other platforms, the environment variable TBB_ARCH_PLATFORM=<arch>/<kernel> must be set: <arch> is ia32 or intel64 and <linux_kernel_or_gcc_version> is what is used in $TBBROOT/lib/<arch>.

VariableDescriptionType
TBBROOTDirectory of Tbb default installationEnvironment
TBB_INCLUDE_DIRSDirectory containing the tbb/tbb.h fileCMake
TBB_LIBRARY_DIRSDirectory(ies) containing the compiled TBB librariesCMake
TBB_LIBRARIESFull pathnames of the compiled TBB libraries (both release and debug versions, using "optimized" and "debug" CMake keywords). Note that if the debug versions are not found, the release versions will be used instead for the debug mode.CMake
TBB_RELEASE_LIBRARYFull pathname of the compiled TBB release libraryCMake
TBB_MALLOC_RELEASE_LIBRARYFull pathname of the compiled TBB release malloc libraryCMake
TBB_DEBUG_LIBRARYFull pathname of the compiled TBB debug libraryCMake
TBB_MALLOC_DEBUG_LIBRARYFull pathname of the compiled TBB debug malloc libraryCMake
TBB_MALLOCPROXY_DEBUG_LIBRARYFull pathname of the compiled TBB debug malloc_proxy library (optional)CMake
TBB_MALLOCPROXY_RELEASE_LIBRARYFull pathname of the compiled TBB release malloc_proxy library (optional)CMake

17 Compiler Workarounds

A number of boolean flags are used to workaround compiler bugs and limitations. They all start with the prefix CGAL_CFG. These flags are used to work around compiler bugs and limitations. For example, the flag CGAL_CFG_NO_CPP0X_LONG_LONG denotes that the compiler does not know the type long long.

For each installation a file <CGAL/compiler_config.h> is defined, with the correct settings of all flags. This file is generated automatically by CMake, and it is located in the include directory of where you run CMake. For an in-source configuration this means CGAL-4.4/include.

The test programs used to generate the compiler_config.h file can be found in config/testfiles. Both compiler_config.h and the test programs contain a short description of the problem. In case of trouble with one of the CGAL_CFG flags, it is a good idea to take a look at it.

The file CGAL/compiler_config.h is included from <CGAL/config.h>. which is included by all CGAL header files.

18 Compiler Optimizations

By default CMake generates makefiles for Release mode, with optimization flags switched on, and vcproj files for Release and Debug modes.

  1. ^EGC :: Home
  2. ^GCC, the GNU Compiler Collection- GNU Project
  3. ^Intel® oneAPI Toolkits
  4. ^Visual Studio: IDE and Code Editor for Software Developers and Teams
  5. ^CGAL_Core is not part of CGAL, but a custom version of the Core library distributed by CGAL for the user convenience and it has it's own license.
  6. ^The environment variable can be spelled either BOOST_ROOT or BOOSTROOT
  7. ^If both release and debug versions are available, this variable contains a list of the following form: 'optimized;<fullpath-to-release-lib>;debug;<fullpath-to-debug-lib>', where the 'optimized' and 'debug' tags should appear verbatim.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lst0426

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值