vs2008环境下cgal安装

来源:互联网 发布:杭州淘宝大学地址 编辑:程序博客网 时间:2024/05/01 23:10
感想:CGAL是一个计算几何函数库,包含了计算几何领域绝大部分的计算。现在所做研究用到CGAL,安装的过程让我对它印象深刻。 安装cgal需要先安装好cmake,boost,qt三个环境,很是麻烦。在安装过程中翻阅了网上大量资料,终于成功安装好CGAL3.8。安装过程记录如下。
安装过程大致是基于官网上http://acg.cs.tau.ac.il/cgal-at-tau/installing-cgal-and-related-programs-on-windows的方法,在具体过程上有一些细节不一样。


download:
1,CMake 2.8.4: http://www.cmake.org/files/v2.8/cmake-2.8.4-win32-x86.exe
2,Boost 1.46.1: http://www.boostpro.com/download/boost_1_46_1_setup.exe
3,CGAL 3.8 https://gforge.inria.fr/frs/download.php/28508/CGAL-3.8-Setup.exe 
4,QT 4.7.1
   http://code.google.com/p/qt-msvc-installer/downloads/detail?name=qt-win32-opensource-4.7.1-vs2008.exe
    http://qt-msvc-installer.googlecode.com/files/Qt-Win32-4.7.1-pdb.zip
 

安装过程
(安装过程的每一步,都会导致环境变量的改变,将在每一步的后面注明,有些环境变量在安装过程中软件会自动添加,有些需要手工添加)
(我把环境安装在了"D:\cgal\"下,后面的路径都以此为基准)


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
 (cmake的安装一般很顺利,不会出什么问题!)
 环境变量:
 添加“D:\cgal\CMake 2.8\bin”到path中
 
Boost
 - Agree to both licenses.
 - Nearest SourceForge mirror.
 - Choose "Visual C++ 9.0 (Visual Studio 2008)" and the following variants: "Multithreaded" and "Multithreaded debug".
 - (最好是把所有组件都安装上,官网教程里说有些东西可以省略,实验过发现会导致后面问题,本人比较懒,就直接都安装上了)
 - Don't forget to check the "Add to path"

 - Install

(这一步需要注意的有两点,环境变量和必须安装必要的组件)

 环境变量:
 添加“D:\cgal\boost\boost_1_46_1”到path中
 新建环境变量BOOST_ROOT=“D:\cgal\boost\boost_1_46_1”
 
QT
 - Agree to the license.
 - Next, Next, Next, Install.
 - Add QTDIR variable with the value "D:\cgal\qt\4.7.1" to the environment variables (if it's not already there).
 - Add <QT>\bin to the system PATH. (D:\cgal\qt\4.7.1\bin)

 - Extract the Qt-Win32-4.7.1-pdb.zip files to the "bin" folder of the installed Qt to have the full distribution.

(这一步也不会出什么问题)

 环境变量:
 新建环境变量QTDIR="D:\cgal\qt\4.7.1"
 添加“D:\cgal\qt\4.7.1\bin”到path中
 
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>\auxiliary\gmp\lib to the system PATH. (D:\cgal\CGAL-3.8\auxiliary\gmp\lib)
 
编译
 - 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-3.7)
 - Click Configure.
 - Choose "Visual Studio 9 2008" and click "Finish"
 - Click Generate
 - A solution named CGAL was created in the directory.
 - Compile ALL_BUILD project both in Debug and Release.

 - All CGAL libraries should be under the lib directory. 

(编译cgal是最可能出问题的地方,因为前面任何一个部分安装不正确,比如有的环境变量没有设定好,有的组件没有安装等问题,都会导致这一步失败!)

 环境变量:
 Add <CGAL>\auxiliary\gmp\lib to the system PATH. (D:\cgal\CGAL-3.8\auxiliary\gmp\lib)
 新建环境变量CGAL_DIR=“D:\cgal\CGAL-3.8\”
 
Sanity check
 - 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-3.7/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-3.7) and open the solution and compile. Run the Delaunay_triangulation project for check (in debug and release)

(这一步的成功说明cgal安装成功)

 (附上另外一个介绍安装cgal的博客http://www.qtcn.org/bbs/apps.php?q=diary&uid=111650&a=detail&did=52,也会有所帮助)
原创粉丝点击