转自:http://acg.cs.tau.ac.il/cgal-at-tau/installing-cgal-and-related-programs-on-windows
The following section explains how to install CGAL 4.2 with Boost 1.50.0 with QT4.8.4 on Windows 7 32-bit with Visual Studio 2010.
Note that during the entire setup you need internet connection!
Note that the installation requires significant disk space. Make sure to free enough disk space before the installation.
Instructions on adding Environment Variables in Windows are at the end.
DOWNLOADS:
- Visual Studio 2010 Professional (recommended) or Express.
Professional - Students can get a free version from https://www.dreamspark.com
- Boost 1.50.0: http://boostpro.com/download/boost_1_50_setup.exe
- CMake 2.8.10.2: http://www.cmake.org/files/v2.8/cmake-2.8.10.2-win32-x86.exe
- CGAL 4.2.0 - https://gforge.inria.fr/frs/download.php/32189/CGAL-4.2-beta1-Setup.exe
- QT 4.8.4 - http://releases.qt-project.org/qt4/source/qt-win-opensource-4.8.4-vs2010.exe
QT Visual Studio 2010 Professional addin - http://releases.qt-project.org/vsaddin/qt-vs-addin-1.2.0-opensource.exe
INSTALLATION:
In parentheses are the paths on my computer.
In parentheses are the paths on my computer.
1) Visual C++ 2010:
- If you use the offline version choose to install Visual C++.
- Accept the license terms.
- You may select a custom installation (instead of full) and select only Visual C++ (unselect other features).
- Don't install "SQL Server" & "Silverlight Runtime" (you can if you want...)
- There is a chance that it is recommended to reboot now.
2) Boost
- No easy offline install.
- Agree to both licenses.
- Nearest SourceForge mirror.
- Choose "Visual C++ 10.0 (Visual Studio 2010)" and the following variants:
- Multithreaded debug DLL
- Multithreaded DLL
- Multithreaded
- Multithreaded debug
- Don't forget to check the "Add to path"
-Add BOOST_INCLUDEDIR variable with the value D:\software\boost_1_50\boost to the environment variables.
-Add BOOST_ROOT variable with the value D:\software\boost_1_50 to the environment variables.
-Add D:\software\boost_1_50\lib;D:\software\boost_1_50\bin to PATH.
- Install
3) CMake
- Agree to the license.
- Check "Add CMake to the system PATH for all users". We can check "create desktop icon".
- Next, Next, Next.
- Finish
4) QT
- Agree to the license.
- Next, Next, Next, Install.
- Add QTDIR variable with the value C:\Qt\4.8.4 to the environment variables (if it's not already there).
- Add <QT>\bin to the system PATH. (C:\Qt\4.8.4\bin)
4.1) QT Visual Studio 2010 addin:
- install the addin (works only in VS2010 Professional edition)
5) CGAL
- CGAL installation will need to connect to the internet for GMP and MPFR.
- Be amazed by the splash screen.
- Agree to the license.
- Just choose the default: with GMP and MPFR, and with examples and demos.
- 32-bit (for me).
- In the "Setting Environment Variables" screen, choose all users and make sure that CGAL_DIR is checked.
- Install.
- Add <CGAL_DIR >\auxiliary\gmp\lib to the system PATH. (C:\Program Files\CGAL-4.2-beta1\auxiliary\gmp\lib)
Now you need to compile CGAL
- Open CMake - cmake-gui (on the Desktop) - if you are using win7 make sure you open the program in administrator mode - right click on the icon and click on "run as administrator".
- For both "Where is the source code" and "Where to build the binaries" specify the CGAL Installation folder (C:\Program Files\CGAL-4.2-beta1)
- Click Configure.
- Choose "Visual Studio 10 2010" and click "Finish"
- Click Generate
- A solution named CGAL was created in the directory.
- Compile ALL_BUILD project both in Debug and Release (ignore the compilation error in CGAL_imageIO).
- All CGAL libraries should be under the lib directory.
6) Sanity check (optional)
- Open CMake (cmake-gui, can be found on the desktop) - (for win7 users, use "Run as admin")
- Choose "Where is the source code:" to be the Triangulation_2 demo directory under the CGAL installation. Namely, <CGAL>/demo/Triangulation_2 (C:\Program Files\CGAL-4.2-beta1/demo/Triangulation_2).
- Choose "Where to build the binaries:" to the same directory.
- Click Configure
- Click Generate
- Go to the directory (C:\Program Files\CGAL-4.2-beta1) and open the solution and compile. Run the Delaunay_triangulation project for check (in debug and release)
7) Customizing env - If you are not using CMake to create new VS projects
Note: the following operations should be repeated for the Debug and Release modes
- Right-click on the selected project and select "Properties".
Go to C/C++ -> General . Add the following to "Additional Include Directories" (include)
* include: <Boost> (C:\Program Files\boost\boost_1_50)
* include: <CGAL>\include (C:\Program Files\CGAL-4.2-beta1\include)
* include: <CGAL>\auxiliary\gmp\include (C:\Program Files\CGAL-4.2-beta1\auxiliary\gmp\include)
* include: <QT>\include\Qt (C:\Qt\4.8.4\include\Qt)
* include: <QT>\include\QtCore (C:\Qt\4.8.4\include\QtCore)
* include: <QT>\include\QtGui (C:\Qt\4.8.4\include\QtGui)
Go to Linker -> General. Add the following to "Additional Dependencies" (include)
* library: <CGAL>\lib (C:\Program Files\CGAL-4.2-beta1\lib)
* library: <QT>\lib (C:\Qt\4.8.4\lib)
* library: <Boost>\lib (C:\Program Files\boost\boost_1_50\lib)
* library: <CGAL>\auxiliary\gmp\lib (C:\Program Files\CGAL-4.2-beta1\auxiliary\gmp\lib)
For a specific project using CGAL you need to ignore the auto-link of gmp and mpfr. The names below are for
Debug.
- Linker -> Input
* Add libgmp-10.lib and libmpfr-4.lib to "Additional Dependencies"
* Add gmp-vc100-mt-gd.lib and mpfr-vc100-mt-gd.lib to "Ignore Specific Library" (gmp-vc100-mt.lib and mpfr-vc100-mt.lib in
release mode).
For a specific project using QT:
- Linker -> Input
* Add qtmaind.lib, QtGuid4.lib, and QtCored4.lib to "Additional Dependencies" (qtmain.lib;QtCore4.lib;QtGui4.lib in
release).
Important: In case that the compilation succeeds but the linker is unable to find cgal-related dlls ("
the program can't start because cgal-vc100-mt-gd-4.2.dl is missing")
find these files in the CGAL directory and copy them either to the system32 folder of windows, or the folder of the visual studio project.
Try to compile this programs:
Hello CGAL: http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Introduction/Chapter_main.html
Setting up PATH variable or other Enviroment variables on windows systems
- From the desktop, right-click My Computer and click properties.
- (on Vista/Win7 click Advanced system settings on the left side)
- In the System Properties window, click on the Advanced tab.
- In the Advanced section, click the Environment Variables button.
- Finally, in the Environment Variables window, highlight the path variable in the Systems Variable section and click edit. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32
If you were looking for the previous version of this page (CGAL 3.7, Boost 1.44, QT 4.7.1) please follow thislink.