如何安装具有Cocoa/XCode支持的OSX 10.8的VTK 6.1? [英] How to install VTK 6.1 for OSX 10.8 with Cocoa/XCode support?

查看:83
本文介绍了如何安装具有Cocoa/XCode支持的OSX 10.8的VTK 6.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发布在 http://www.vtk.org/Wiki/Cocoa_VTK 和自述文件中的非常有用的准则VTK存储库中的Sean McBride和Mike Jackson提交的文件对于VTK 6.1来说已经有些过时了.因此,如果这对任何人有帮助,我都会发布有关在OSX 10.8上安装VTK 6.1的说明,并支持SimpleCocoaVTK Xcode项目.

解决方案

*为支持Cocoa的OSX 10.8安装VTK 6.1 *

这些说明在 http://www.vtk.org/Wiki/Cocoa_VTK 和Sean McBride和Mike Jackson的VTK/Examples/GUI/Cocoa/Documentation文件夹中的README.rtf.

  1. 将VTK git存储库克隆到您选择的目录中:

    cd/用户/您/

    git clone https://github.com/Kitware/VTK.git

    cd VTK

    git checkout标签/v6.1.0

  2. 创建一个构建目录

    mkdir VTKBuild

    cd VTKBuild

  3. 运行VTK cmake脚本

    • 您现在将位于/Users/you/VTK/VTKBuild中,从此处运行cmake(使用父目录的CMake文件):

    cmake ..

  4. 在新生成的CMakeCache.txt(在当前VTKBuild目录中)中编辑许多行.我遇到的一个问题是,如果不对CMAKE_INSTALL_PREFIX使用完整路径,则会出错.因此,请确保使用"/Users/you/"而不是〜":

    CMAKE_INSTALL_PREFIX:PATH =/用户/您/VTK/VTKBuild

    BUILD_SHARED_LIBS:BOOL = OFF

    CMAKE_BUILD_TYPE:STRING =调试

    VTK_USE_SYSTEM_ZLIB:BOOL = ON

    CMAKE_OSX_ARCHITECTURES:STRING = i386; x86_64

    CMAKE_OSX_SYSROOT:STRING =/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

  5. 编译VTK项目(这可能需要一个多小时才能运行!):

    制作

  6. 将标题复制到包含目录:

    进行安装

  7. VTK现在应该完全安装在VTKBuild目录中,并可以在XCode项目中使用!

  8. 转到查找器,导航到Users/you/VTK/Examples/GUI/Cocoa/,然后双击以XCode打开SimpleCocoaVTK.xcodeproj.

  9. 在XCode菜单栏中(位于屏幕顶部),转到首选项"->位置"->源树",然后使用+按钮添加两个源树:

    vtk-debug-include vtk-debug-include用户/you/VTK/VTKBuild/include/vtk-6.1

    vtk-debug-lib vtk-debug-lib Users/you/VTK/VTKBuild/lib

  10. 单击XCode项目并删除所有对vtk 6.0的引用:

    • 在项目视图中,选择Targets-> SimpleCocoaVTK,然后按"Build Phases",然后打开"Link Binary With Libraries".删除所有以"libvtk"开头并以"6.0.a"结尾的文件

    • 在SimpleCocoaVTK项目的文件视图中,突出显示并删除vtk-libraries文件夹中的所有文件.

  11. 确保XCode文件视图处于活动状态.然后在查找器中,导航到/Users/you/VTK/VTKBuild/lib,然后选择所有以"libvtk"开头和以"6.1.a"结尾的文件.将这些文件拖到XCode文件视图中的文件夹"vtk-libraries"中.

  12. 在XCode中,执行Product-> Clean

  13. 您现在可以构建并运行示例SimpleCocoaVTK项目.

The extremely helpful guidelines posted at http://www.vtk.org/Wiki/Cocoa_VTK and via the readme file by Sean McBride and Mike Jackson inside the VTK repo were slightly out of date for VTK 6.1. So in case this helps anybody, I'm posting instructions for installing VTK 6.1 on OSX 10.8 with support for the SimpleCocoaVTK Xcode project.

解决方案

* Installing VTK 6.1 for OSX 10.8 with Cocoa support *

These instructions slightly modify Ryan Glover's instructions at http://www.vtk.org/Wiki/Cocoa_VTK and the README.rtf in the VTK/Examples/GUI/Cocoa/Documentation folder by Sean McBride and Mike Jackson.

  1. Clone the VTK git repo into a directory of your choice:

    cd /Users/you/

    git clone https://github.com/Kitware/VTK.git

    cd VTK

    git checkout tags/v6.1.0

  2. make a build directory

    mkdir VTKBuild

    cd VTKBuild

  3. Run the VTK cmake script

    • You will now be inside /Users/you/VTK/VTKBuild, run cmake from here (using the parent directory's CMake files):

    cmake ..

  4. Edit lots of lines in the newly generated CMakeCache.txt (in the current VTKBuild directory). One issue I had was that there were error if I didn't use a full path for the CMAKE_INSTALL_PREFIX. So make sure to use "/Users/you/" instead of "~":

    CMAKE_INSTALL_PREFIX:PATH=/Users/you/VTK/VTKBuild

    BUILD_SHARED_LIBS:BOOL=OFF

    CMAKE_BUILD_TYPE:STRING=Debug

    VTK_USE_SYSTEM_ZLIB:BOOL=ON

    CMAKE_OSX_ARCHITECTURES:STRING=i386;x86_64

    CMAKE_OSX_SYSROOT:STRING=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

  5. Compile the VTK project (this might take over an hour to run!):

    make

  6. Copy headers to an include directory:

    make install

  7. VTK should now be completely installed in the VTKBuild directory and ready to use in an XCode project!

  8. Go to your finder, navigate to Users/you/VTK/Examples/GUI/Cocoa/ and double click to open SimpleCocoaVTK.xcodeproj in XCode.

  9. In the XCode menubar (at the top of the screen) Go to Preferences->Locations->Source Trees and use the + button to add in two source trees:

    vtk-debug-include vtk-debug-include Users/you/VTK/VTKBuild/include/vtk-6.1

    vtk-debug-lib vtk-debug-lib Users/you/VTK/VTKBuild/lib

  10. Click on the XCode project and delete all the references to vtk 6.0:

    • In the project view, select Targets->SimpleCocoaVTK and then press "Build Phases" and then open the "Link Binary With Libraries". Delete all the files that begin with "libvtk" and end with "6.0.a"

    • In the file view of the SimpleCocoaVTK project, hightlight and delete all the files in the vtk-libraries folder.

  11. Make sure the XCode file view is active. Then in the finder, navigate to /Users/you/VTK/VTKBuild/lib, and select all the files that begin with "libvtk" and end with "6.1.a". Drag these files into the folder "vtk-libraries" in the XCode file view.

  12. In XCode, do a Product->Clean

  13. You can now build and run the sample SimpleCocoaVTK project.

这篇关于如何安装具有Cocoa/XCode支持的OSX 10.8的VTK 6.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆