VS2012编译安装VTK-6.2.0(支持Qt5.2.1)

0 开发环境    

    计算机系统:Win8.1,CPU:i5-5200

1 VTKData、VTKLargeData

    详见《VTK编译安装 —— VTKData和VTKLargeData使用说明(一)》、《VTK编译安装 —— VTKData和VTKLargeData使用说明(二)》。

2 OpenGL

    一开始时,使用qt-opensource-windows-x86-msvc2012_64-5.2.1.exe,编译失败。后来发现需要OpenGL的支持,改用qt-opensource-windows-x86-msvc2012_64_opengl-5.2.1.exe就好!

   关于Qt的支持,见参考资料[1]。

3 CMAKE_PREFIX_PATH

    在参考资料[1]中提示,使用cmake对VTK进行配置时,需要添加CMAKE_PREFIX_PATH,由于不知其作用,并且觉没有这个必要,因此没有添加,结果编译阶段提示错误:

-- Configuring incomplete, errors occurred!
127>  See also "D:/VTK/build_Qt/CMakeFiles/CMakeOutput.log".
127>  See also "D:/VTK/build_Qt/CMakeFiles/CMakeError.log".
129>  CMake Error at GUISupport/Qt/CMakeLists.txt:58 (find_package):
129>    By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
129>    has asked CMake to find a package configuration file provided by
129>    "Qt5Widgets", but CMake did not find one.
129>  
129>    Could not find a package configuration file provided by "Qt5Widgets" with
129>    any of the following names:
129>  
129>      Qt5WidgetsConfig.cmake
129>      qt5widgets-config.cmake
129>  
129>    Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
129>    "Qt5Widgets_DIR" to a directory containing one of the above files.  If
129>    "Qt5Widgets" provides a separate development package or SDK, be sure it has
129>    been installed.

    再次使用cmake配置时,也提示

CMake Error at GUISupport/Qt/CMakeLists.txt:58 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.

    看来,不添加是不行的了,因此按照参考资料[1]的方法,点击cmake界面坐上角的“Add Entry”按钮,添加CMAKE_PREFIX_PATH选项

    注意:另外一个解决方法就是,将Qt库的路径添加到系统环境变量PATH中即可,见《VS2013编译安装VTK-6.2.0_支持Qt5.4.2》。

4 Qt5Gui_glu32_LIBRAYRY

    解决了第3章的问题后,配置过程中又出现了新问题:

 

CMake Error at C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:16 (message):
  Failed to find "glu32" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE "".
Call Stack (most recent call first):
  C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:52 (_qt5gui_find_extra_libs)
  C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:152 (include)
  C:/Qt/Qt5.2.1/5.2.1/msvc2012_64_opengl/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:94 (find_package)
  GUISupport/Qt/CMakeLists.txt:58 (find_package)

   根据参考资料[2]的提示,需添加CMAKE_PREFIX_PATH(第3章中已经将此项的值设为Qt的安装路径)的值:

C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64

    照着参考资料[2]的方法设置后,发现第4章的问题是解决了,但是第3章的问题又出现了!

    于是将CMAKE_PREFIX_PATH的值同时设为第3章设置的值和C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64,两者之间用分号隔开(就像环境变量Path中各个变量的分隔一样)。

    其实根据参考资料[2]的提示,可以将第3章的值设置为环境变量Path的值即可,无需都在CMAKE_PREFIX_PATH中设置(未经测试)。

    因此可以猜测CMAKE_PREFIX_PATH指定的是库的路径,相当于环境变量的作用。

参考资料

[1]VTK/Configure and Build

[2]QT5.2.1+VTK6.1 配置

[3]VTK/Tutorials/QtSetup

[4]CMake 2.8.11 Docs

[5]MSVC2012+QT5.2.1+VTK6.1+win8

[6]VTK/Building/Windows

[7]Solution to Failed to find "glu32" in "" with CMAKE_CXX_LIBRARY_ARCHITECTURE ""

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

OneSea

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

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

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

打赏作者

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

抵扣说明:

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

余额充值