Q1302182594的专栏

计算机系统:Win8.1

CPU:i5-5200

1 ExternalData

关于VTK-6.2.0的编译安装,其实和VTK-5.10.1大致相同(VS2012编译安装VTK-5.10.1_支持python),主要区别在于外部数据的使用。下图是VTK官网上6.2.0版本的数据文件:

由上图可见,主要有2种数据文件VTKData和VTKLargeData,解压可见其目录结构为

—-.ExternalData

|–MD5

|–README.rst

其中,MD5目录中大约包含2000个如下文件

经过查看发现,上面的并非什么数据文件。查看README.rst,其内容如下

.ExternalData=============The VTK “.ExternalData“ directory is an object store for theCMake ExternalData module that VTK uses to manage test inputand baseline data.

这么说,编译之后是不是会将相关的数据文件保存到这目录中?经过测试发现,也不是!有可能是这些文件的使用方法不对。那么这些文件应该如何使用呢?

1.1 ExternalData_URL_TEMPLATES

使用cmake对VTK-6.2.0进行配置时,有一个ExternalData_URL_TEMPLATES项(参考资料[4]对ExternalData和ExternalData_URL_TEMPLATES都有说明),其说明如下图所示:

从《URL》可以了解到,上图的file:///var/bigharddrive/%(algo)/%(hash)是一种URL格式。由于我将VTKData.zip加压在目录目录中,其中的.ExternalData目录的结构在上面已经有说明。因此将ExternalData_URL_TEMPLATES的值设为:

file:///E:/VTK/VTKData-6.2.0/VTK-6.2.0/.ExternalData/%(algo)/%(hash)

本来以为在编译过程中,编译器(VS2012)会根据.ExternalData文件的内容来i通过网络获取真正的数据,后来我发现我错了!其实上述.ExternalData/MD5目录中的各个文件就是真正的数据,只不过都以其MD5值来命名而已!例如为文件00d368a21ef258f1658767a93419d0bc添加后缀.png,然后使用图片浏览器打开可见:

注意:并非每个文件都可以通过添加后缀.png然后用图片浏览器打开,只有那些内容为.png格式的文件才可以。可以通过使用二进制阅读器查看文件内容是否以.PNG开头,如果是就很大程度上表面它是一个png格式的图像文件。

因此,在配置VTK-6.2.0时,ExternalData_URL_TEMPLATES可以不设置,不用考虑数据的问题。

由于所有数据文件都是通过其MD5值来命名的,因此使用起来不方便,具体使用方法可见《VTKData-6.2.0的使用方法》。

1.2 VTK_DATA_STORE

2 OpenGL

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

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

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 project129> has asked CMake to find a package configuration file provided by129> "Qt5Widgets", but CMake did not find one.129> 129> Could not find a package configuration file provided by "Qt5Widgets" with129> any of the following names:129> 129>Qt5WidgetsConfig.cmake129>qt5widgets-config.cmake129> 129> Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set129> "Qt5Widgets_DIR" to a directory containing one of the above files. If129> "Qt5Widgets" provides a separate development package or SDK, be sure it has129> 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.cmakeqt5widgets-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选项

4 Qt5Gui_glu32_LIBRAYRY

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

别想一下造出大海,必须先由小河川开始。

Q1302182594的专栏

相关文章:

你感兴趣的文章:

标签云: