`
yhk051hf
  • 浏览: 15524 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

visual studio 2008下装CGAL

阅读更多

visual studio 2008下装CGAL
2010年10月31日
  1、安装CGAL需要boost,qt的库,我是在win7下装的
  1)、首先下载CGAL(3.5)的安装程序,从http://gforge.inria.fr/frs/?group_id=52(在页面的最下面) 
  2)、获得最新版本的CMake(目前是2.8),从http://www.cmake.org/cmake/resources/software.html
  3)、获得最新版本的QT(目前是4.5.3),从http://www.qtsoftware.com/downloads/windows-cpp
  4)、获得最新版本的boost(目前是1.38)从http://www.boost.org/users/download/
  或者是从http://www.boostpro.com/download 这里下载window的安装程序 
  2、安装CMake
  使用默认的编译器并且不要忘记,将X:\Program Files\CMake 2.6\bin 增加到环境变量当中。 
  本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/scarletty/archive/2009/05/24/ 4212703.aspx
  3安装boost
  这个教程上讲的boost的安装会出现问题  http://acg.cs.tau.ac.il/cgal-at-tau/installing-cga l-and-related-programs-on-windows
  就是boost thread no found。原因在这个网站上有分析  https://lists-sop.inria.fr/sympa/arc/cgal-discuss/ 2009-11/msg00131.html       If you compiled Boost using Visual Studio, I doubt you can use it with  the MinGW g++ compiler. In C++ world, binaries coming from different compilers (even even different compiler versions of the same compiler  suite) are not binary compatible.You need to choose if you want to use CGAL with MinGW or Visual. Then you need to compile Boost and Qt with the same compiler. VS2008中编译Boost 1.38出处(http://blog.csdn.net/wrx_2009/archive/2009/06/04/4 242841.aspx) 编译Boost 1.38
  一、下载Boost
  首先,我们到http://www.boost.org去下载 boost1.38的代码包。得到一个压缩包boost_1_38_0.zip,你也可以选择下载其它格式的。 
  然后我们把它解压出来,我把它解压在D盘根目录下面: 
  二、获取编译工具
  首先,我们需要到bjam.exe这是一个用于编译的工具。 
  接下来我将会在Visual Studio 2008 SP1简体中文专业版中编译Boost1.38。我们去开始菜单,使用管理员身份运行Visual Studio 2008 命令提示(非Vista请无视): 
  然后我们通过cd等DOS指令进入到: 
  Setting environment for using Microsoft Visual Studio 2008 x86 tools. 
  C:\Windows\system32>d: 
  D:\>cd boost_1_38_0 
  D:\boost_1_38_0>cd tools 
  D:\boost_1_38_0\tools>cd jam 
  D:\boost_1_38_0\tools\jam>cd src 
  D:\boost_1_38_0\tools\jam\src> 
  然后我们在这个src目录下面执行build.bat: 
  D:\boost_1_38_0\tools\jam\src>build.bat 
  然后我们稍等一小会儿等待系统自动为我们生成编译工具。 
  生成完毕之后src目录下会出现一个bin.ntx86目录。进入这个目录会看见bjam.exe。 
  我们把这个bjam.exe拷贝到boost 1.38的根目录即我的D:\boost_1_38_0。 
  同上面的方法打开Visual Studio 2008 命令提示,进入D:\boost_1_38_0。通过如下命令我们就可以查看当前版本的Boost的哪些组件需要编译了,因为Boost大部分组件都是以模板的形式存在的,不需要编译: 
  D:\boost_1_38_0>bjam --show-libraries 
  The following libraries require building: 
  - date_time 
  - filesystem 
  - function_types 
  - graph 
  - iostreams 
  - math 
  - mpi 
  - program_options 
  - python 
  - regex 
  - serialization 
  - signals 
  - system 
  - test 
  - thread 
  - wave 
  三、编译Boost1.38 
  我们再去D盘根目录创建一个我们的目标安装文件夹:D:\BoostLib 1_38 
  接下来使用默认的方式将Boost1.38完整编译到目标文件夹: 
  D:\boost_1_38_0>bjam install --prefix="D:\BoostLib 1_38" debug 
  剩下的参数都用默认的了。敲下回车,好了,开始耐心等待编译完成吧。在此之前请确认您的D盘的剩余空间,要完整编译需要大约3G的剩余空间,主要是会生成很多临时文件,编译连接完之后我们可以删除掉的。曾经在网上看到说需要12G的空间,编译需要好几个小时,可能是现在不一样了吧,呵呵,电脑配置越来越好了。而且整个编译过程也需要一定的时间,编译Debug版本大约需要40-80分钟不等,Release也差不多,根据不同的机器配置会有所不同,当然配置越好越快啦。 
  编译的过程中会出现很多的Warning,你可以无视它们,基本上用于学习的目的,你很难很因为这些Warning而使得程序挂掉。 
  warning: No toolsets are configured. 
  warning: Configuring default toolset "msvc".  // 这里由于我们没有选择编译器,所以这里默认选择了VC,由于我们是在Visual Studio 2008的命令提示下面,因此自动选择了VC9。VC2005也是同样的道理,我们选择VC2005的命令提示符就可以了。 
  warning: If the default is wrong, your build may not work correctly. 
  warning: Use the "toolset=xxxxx" option to override our guess. 
  warning: For more configuration options, please consult 
  编译的过程中会自动的帮你Copy一些诸如模板头文件等到目标文件夹去: 
  这个Copy过程大约需要三分钟。完成之后便开始编译: 
  期间会有一些警告,这些都可以无视。开始编译之后会在lib文件夹中出现相应的lib和dll文件,并且由于时间的推移会越来越多,这至少说明您的编译过程正在进行中。而且在编译的过程中还会发生COPY行为。 
  大家可以看看Boost生成的这些Lib文件,比如boost_regex-vc90-mt-gd-1_38.lib。它的命名很考究的。 
  boost代表这是boost库的组件 
  regex代表这个是正则表达式的库 
  VC90代表它是什么编译器版本 
  mt代表它支持多线程/ Multithreads 
  gd代表这是debug版本 
  1_38代表了Boost的版本号 
  是不是很有艺术感呢? 
  另外还有一些这样的Lib文件,比如libboost_iostreams-vc90-mt-gd-1_38.lib。它以libboost开头,这表示这些lib是静态库文件,属于静态连接的库文件。它们没有对应的dll文件。同时您也可以注意到它们都比只具备索引功能的lib大得多。跟动态库版本有啥区别不用我解释了吧? 
  O(∩_∩)O~ 
  Debug版本编译完我生成了107个文件,你有多少个呢?       好了,接下来我们使用类似的步骤来编译Release版本的Boost: 
  Release版本的Lib和Dll的命名和Debug版本的差别就在于没有gd,比如:boost_math_c99f-vc90-mt-1_38.lib。 
  在等待了和编译Debug差不多的时间之后,我们的Boost就成功编译了。 
  为了符合我们通常SDK的习惯,我们把D:\BoostLib 1_38\include\boost-1_38\下面的boost目录全部拷贝到include目录下面,然后再把boost-1_38这个空的文件夹删除。 
  现在我们的所有头文件都在include文件夹下面了,保留boost文件夹只是为了符合boost的习惯;所有的lib和dll都位于lib文件夹下面。 
  四、配置IDE和删除临时文件 
  但是整个过程还没有结束,我们还需要配置IDE。打开Visual Studio 2008 SP1(其它VC开发平台也类似),选择"工具",再选择"选项",然后在"项目和解决方案"下面选择vc++目录,在"包含目录"下面添加Boost的include路径: 
  在库文件下面添加Boost的lib路径: 
  现在Boost的安装目录已经膨胀到了1.04G: 
  源代码的目录,即D:\boost_1_38_0已经变得硕大无比,因为生成了大量的临时文件,我建议您删除该文件夹下面的bin.v2即可。 
  爽,编译完成,赶快来段代码,试试:  #include  #include  using namespace std; using namespace boost; int main() { cout>strBirthday; try { gregorian::date birthday( gregorian::from_simple_string(strBirthday) ); gregorian::date today( gregorian::day_clock::local_day() ); gregorian::days days_alive = today - birthday; if( days_alive Programs->Visual Studio->Visual Studio Tools->Visual Studio CommandPrompt)然后写cd c:\QT\4.5.3 
  7)、在黑色窗口中写"configure",即运行文件夹里的configure.exe程序 
  8)、同意license,等待一会 
  9)、在cmd窗口中写"nmake",大概等待5个小时 
  10)、将路径 C:\Qt\4.5.3\bin添加到环境变量中 
  11)、QT安装完成 
  12)、重启电脑 
  5、安装CGAL
  1)、最终的时候安装CGAL,运行安装程序,选择你的编译器及所有的Variants,下一步,下一步 
  2)、我建议安装在 C:\CGAL\CGAL-3.5 
  3)、选中所有的环境变量,等待完成,包括最后的下载 
  4)、增加环境变量QTDIR = C:\Qt\4.5.3 
  5)、增加环境变量BOOST_ROOT = C:\boost\boost_1_38 
  6)、打开命令行窗口(start->run->cmd) 
  7)、键入cd C:\CGAL\CGAL-3.5 
  8)、运行cmake-gui .(很重要,.表示当前目录) 
  9)、选择你的编译器并点击configure 
  10)、如果你安装了Cygwin,configure将失败,编辑GMP_INCLUDE_DIR和MPFR_INCLUDE_DIR为C:/CGAL/CGAL-3.5/auxiliary/gmp/include 
  11)、编辑CMAKE_BUILD_TYPE为Debug 
  12)、如果你希望安装演示实例,请选择WITH_demos与WITH_examples(其实没有必要安装,可以用的时候再编译) 
  13)、你需要增加变量Boost_INCLUDE_DIR (=C:/boost/boost_1_38_0), 并且编辑变量Boost_THREAD_LIBRARY_DEBUG (=C:/boost/boost_1_38_0/lib/libboost_thread-vc90-m t-gd-1_38.lib) 以及变量Boost_THREAD_LIBRARY_RELEASE (= C:/boost/boost_1_38_0/lib/libboost_thread-vc90-mt- 1_38.lib) 
  14)、点击Configure,知道Generate能够操作之后,点击Generate 
  15)、在C:\CGAL\CGAL-3.5中将会产生一个解决方法,用Visual Studio打开 
  16)、关闭CMAKE 
  17)、选择 Build->Clean Solution,选择 Build->Rebuild Solution。安装完成。 
  18)、此时,你的PATH应该是这样的:PATH=C:\Windows\system32;C:\Windows;C:\Windows\Sys tem32\Wbem;C:\Program Files\ATITechnologies\ATI.ACE\Core-Static;c:\Progr am Files\Microsoft SQL Server\90\Tools\binn\;C:\cygwin\bin;C:\cygwin\usr\ bin;C:\cygwin\usr\local\bin;C:\cygwin\usr\X11R6\bin ;C:\gs\gs8.63\bin;C:\gs\gs8.63\lib;C:\boost\boost_1 _38_0\bin;C:\cygwin\usr\include;C:\MinGW\bin;C:\Qt\ 4.5.4\bin;C:\Program Files\CMake 2.8\bin;C:\CGAL\CGAL-3.5\auxiliary\gmp\lib 
  Creating a Visual Studio Project that uses CGAL and QT 
  Now that you have installed CGAL you need to configure your visual studio to work with it. 
  Open an empty C++ project using the Win32 Console Application wizard (select empty project and click finish) File->New->Project  ... Other Languages -> C++ -> Win32 -> Win32 Console Application 
  When the solution loads up go to Tools->Options ... Projects and Solutions -> VC++ Directories 
  Make sure that Executable Files (Combobox at the top right)  contains the $(PATH) variable (at the end there) 
  Select Include Files in the combobox and add : 
  C:\CGAL\CGAL-3.4\auxiliary\gmp\include 
  C:\Qt\4.5.0\include 
  C:\boost\boost_1_38_0 
  C:\CGAL\CGAL-3.4\include 
  They should appear at that order at the topmost part of the list (use the arrows to move items up and down) 
  Select Library Files from the combobox and add : 
  C:\CGAL\CGAL-3.4\auxiliary\gmp\lib 
  C:\CGAL\CGAL-3.4\lib 
  C:\boost\boost_1_38_0\lib 
  C:\Qt\4.5.0\lib 
  Press OK until you are back at the main window 
  Right click your project and select Properties 
  Go to Configuration Properties -> C/C++ -> General. In there you will see Additional Include Directories. Copy this line there :"C:\Qt\4.5.3\include\QtCore","C:\Qt\4.5.3\include \QtCore","C:\Qt\4.5.3\include\QtGui","C:\Qt\4.5.3\i nclude\QtGui","C:\Qt\4.5.3\include","C:\Qt\4.5.3\in clude\ActiveQt","debug",".",C:\Qt\4.5.3\mkspecs\win 32-msvc2005 
  QT has a bunch of directories in their include so you need to add each directory individualy. The ones I write there should be enough for a beginner 
  Go to Configuration Properties -> Linker -> Input and copy the following line to the Additional Dependancies line : C:\Qt\4.5.3\lib\qtmaind.lib C:\Qt\4.5.3\lib\QtGuid4.lib C:\Qt\4.5.3\lib\QtCored4.lib 
  You will generaly need some of the libs as dependant files. The ones I gave above should be enoguh for a beginner program. 
  Thats it, you can write your code and compile it here is an example of a main.cpp that should compile now : 
  ----------------- CUT HERE ------------------  #include  #include  #include  #include  #include  #include  int main(int argc, char **argv) { QApplication app(argc, argv); QGraphicsScene scene; scene.setSceneRect(0,0, 100, 100); scene.addRect(QRectF(0,0, 100, 100), QPen(QColor(255,0,0))); scene.addLine(QLineF(0,0, 100, 100)); scene.addLine(QLineF(0,100, 100, 0)); QGraphicsView* view = new QGraphicsView(&scene); CGAL::Qt::GraphicsViewNavigation navigation; view->installEventFilter(&navigation); view->viewport()->installEventFilter(&navigation); view->setRenderHint(QPainter::Antialiasing); view->show(); return app.exec(); }  ----------------- CUT HERE -------------------  Good Luck and feel free to ask us questions.  Setting up PATH variable or other Enviroment variables on windows systems  From the desktop, right-click My Computer and click properties.  (on Vista 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  后半部分来自CSDN博客,转载请标明出处:http://blog.csdn.net/scarletty/archive/2009/05/24/ 4212703.aspx
分享到:
评论

相关推荐

    cgal-releases-CGAL-5.0.zip

    Using CGAL on Windows (with Visual C++) https://doc.cgal.org/latest/Manual/windows.html Essential and Optional Third Party Dependencies gives information (supported versions, download links) of the ...

    CGAL参考手册(CGAL_4.7 Hello World)

    本章适用于CGAL新手。学习CGAL之前,需要对C++语言、几何算法有基本的了解。第一小节将会向读者展示如何定义点和直线,以及如何把几何谓词作用在这些元素上。之后,本小节还将进一步说明使用浮点数表示坐标会引起一...

    CGAL 4.12 minGW版本,Qt5.9.3

    CGAL 4.12网上只有依赖于Visual studio 的版本,这是一个自己编译的 minGW版本,使用Qt5.9.3,

    cgal_4.4_manual.zip_CGAL 4_CGAL使用手册_cgal 手册_cgal手册_cgal用户手册

    最新的CGAL库的用户帮助手册,虽然CGAL官方有在线的帮助手册,但是离线情况下这个还是很有用的。

    CGAL Install Doc 帮你安装

    Installing CGAL and related programs on ...The following section explains how to install CGAL 3.7 with Boost 1.44 with QT4.7.1 on Windows XP SP3 32-bit/ Windows 7 32-bit with Visual Studio 2008 Express.

    CGAL安装文件CGAL_setup

    CGAL 安装文件,用于安装 CGAL,安装方便快捷

    CGAL安装文件CGAL_setup 4.1

    CGAL安装,4.1版本,CGAL 安装文件,用于安装 CGAL,安装方便快捷

    cgal-releases-CGAL-5.0.tar.gz

    CGAL,Computational Geometry Algorithms Library,计算几何算法库,设计目标是,以C++库的形式,提供方便,高效,可靠的几何算法。CGAL可用于各种需要几何计算的领域,如计算机图形学,科学可视化,计算机辅助设计...

    CGAL-4.9(百度云)

    CGAL-4.9 (百度云) 包含 1.CGAL-4.9.tar.xz 2.CGAL-4.9.zip 3.CGAL-4.9-doc_html.tar.xz 4.CGAL-4.9-doc_html.zip 5.CGAL-4.9-Setup.exe 6.cgal-releases-CGAL-4.9.tar.gz 7.cgal-releases-CGAL-4.9.zip 8.md5sum....

    cgal 模型布尔运算代码

    生成dll的主要代码部分,需提前配置cgal和相关boost库,本人用于在ue4中使用

    CGAL_CGAL编程_cgal_

    一个优秀的编程图形库,本编程手册给出了专业指导

    CGAL官方安装+个人安装经验总结

    boost1.44+QT4.7+CMAKE2.6+CGAL3.7,我最开始弄得就是这个,后来我对新版本也试了下,都通过了,新版本到Boost1.48,CGAL3.9,QT4.7.4.供大家参考。 里面有这四个工具的官方下载地址。

    CGAL计算几何算法库-概述

    CGAL的中文概述,主要翻译了关于英文CGAL-overview中的主要内容。

    CGAL的vs2017库

    CGAL的vs2017库

    CGAL-5.0.2官方文档

    CGAL-5.0.2官方文档

    CGAL4.12已编译.rar

    用VS2015编译好的CGAL4.12库,因为VS2015,2017,2019有二进制兼容性,理论上这三个版本都可以使用。

    CGAL 计算几何算法库

    CGAL 计算几何算法库安装文件 徐如demo样式,请留言邮箱,看到了发

    CGAL-5.2-win64-auxiliary-libraries-gmp-mpfr--CGAL计算几何算法库.zip

    CGAL或计算几何算法库是一个C ++库,可让您轻松访问各种高效而可靠的几何算法。这些算法可用于广泛的应用程序,包括计算机辅助设计,机器人技术,分子生物学,医学成像,地理信息系统等。 CGAL具有广泛的数据结构和...

    CGAL图形编程库

    Cgal编程函数库,方便图形学编程,能够为您提供方便的程序调用

    CGAL最新3.5说明文档

    CGAL最新3.5说明文档,PDF格式,是CGAL开发的必备参考

Global site tag (gtag.js) - Google Analytics