如何从源和第三方依赖项构建 OpenSceneGraph? [英] How to build OpenSceneGraph from source and third party dependencies?

查看:37
本文介绍了如何从源和第三方依赖项构建 OpenSceneGraph?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从源代码构建 OpenSceneGraph?我应该怎么做才能为 OSG 构建第三方依赖项?

How can I build OpenSceneGraph from source? What should I do to get the third party dependencies for OSG built?

推荐答案

这只是一个初始指南,它将在您的系统上安装基本的 OSG.还有许多其他配置更改和带有依赖项的编译,您可以稍后进行(在第一个长虚线后指定构建第三方库).

This is just an initial guide which will get basic OSG installed on your system. There are many other configuration changes and compilation with dependencies that you can do later (building third party libraries is specified after the first long dotted line).

  • 将 OSG 源代码 zip 文件解压到一个文件夹中
  • 从 CMake 网站下载并安装 CMake
  • 运行 CMake
  • 在 CMake 中,将源代码文件夹设置为等效于 F:/ProgramFiles/OSG/OpenSceneGraph–3.1.1 而不是 F:/ProgramFiles/OSG/OpenSceneGraph–3.1.1/src
  • 为 OSG 二进制文件指定另一个文件夹,如下所示:F:/ProgramFiles/OSG/OSG_3–1–1_Build
  • 点击配置",选择你的编译器(在我的例子中是 VS2010 本地编译器)
  • 点击生成"
  • 如果在配置或生成过程中发生任何问题,您可以使用 CMake 菜单选项删除缓存并重试整个过程.
  • 生成完成后,导航到 Binaries 文件夹(我们称之为构建文件夹"),您将看到 OpenSceneGraph.sln
  • 在 Visual Studio 中打开 .sln 文件,使用解决方案资源管理器查找并构建 ALL_BUILD 项目.在具有 2GB RAM 的双核系统上,构建过程大约需要 35-40 分钟.如果由于编译器未找到任何依赖项而遇到任何错误,只需再次构建 ALL_BUILD 项目.建造;不重新构建.然后,在同一个 .sln 文件中搜索 INSTALL 项目并构建它.
  • 就是这样!您已准备好使用 OSG.

为了统一起见,您可以使用这些环境变量:
OSG_ROOT 用于指定构建文件夹的位置
OSG_FILE_PATH 用于指定示例模型和图像的位置(您从 OpenSceneGraph–Data–3.0.0.zip 中提取的文件夹)
OSG_SOURCE 用于指定您刚刚从 zip 文件中提取的源文件的位置.
(OSG_SOURCE 除外,其余均取自 OSG 教程/指南 pdf)

For the sake of uniformity, you can use these environment variables:
OSG_ROOT for specifying the location of the build folder
OSG_FILE_PATH for specifying the location of the sample models and images (The folder which you extract from OpenSceneGraph–Data–3.0.0.zip)
OSG_SOURCE for specifying the location of the source files which you just extracted from the zip file.
(Except for OSG_SOURCE, the rest were taken from the OSG tutorial/guide pdf's)

....................................................................

构建第三方库:
–––––––––––––––––––––––––––––––
无论您是否已经完成上述构建过程,您都可以重新配置 CMake 以构建第三方库.
如果您按照上述步骤操作,您可能记得在配置过程中显示Could not find libcurl"等
现在你要告诉 CMake 在哪里可以找到它.

Building third party libraries:
–––––––––––––––––––––––––––––––
Whether you've already done the above build process or not, you can reconfigure CMake to be able to build the third party libraries.
If you followed the above procedure, you might remember in the configuration process, it showed "Could not find libcurl" etc.
Now you're gonna show CMake where to find it.

假设您正在为 curl 库进行配置.
* 在 CMake 中单击配置",在 CMake gui 中,您会发现 CMake gui 有一个搜索字段.搜索curl",它会显示要为 curl 设置的两个参数.将右侧参数(类似于 CURL–INCLUDE–NOT–FOUND)替换为 curl 标头所在的第三方库的包含路径.
* 同样的方法,对于像 CURL–LIB–NOT–FOUND 这样的内容,将其替换为 lib 文件的路径,并在路径末尾键入 lib 文件的名称.例如:F:\ProgramFiles\OSG\ThirdPartyLibraries\debug_vc10_x86\lib\curllib.lib
* 为 TIFF、ZLIB、PNG 等其他库做类似的事情
* 完成所有操作后,单击配置",然后单击生成".
* 转到您的 OSG 构建文件夹,找到 OpenSceneGraph.sln 并按照我上面提到的方式构建它.
* 就是这样!

Lets say you're configuring for the curl library.
* Click 'configure' in CMake and in the CMake gui, you'll find that the CMake gui has a search field. Search for 'curl' and it'll show you two parameters to be set for curl. Replace the right side parameters (which will be something like CURL–INCLUDE–NOT–FOUND), to the include path of your third party library where curl's header is located.
* Same way, for what would be something like CURL–LIB–NOT–FOUND, replace it with the path to the lib file and at the end of the path, type the name of the lib file too. Eg: F:\ProgramFiles\OSG\ThirdPartyLibraries\debug_vc10_x86\lib\curllib.lib
* Do a similar thing for other libraries like TIFF, ZLIB, PNG etc.
* Once you're done with all of them, click 'Configure' and then 'Generate'.
* Go to your OSG build folder, find OpenSceneGraph.sln and build it as I've mentioned above.
* That's it!

有关构建第三方库的更多信息位于:http://binglongx.wordpress.com/2011/07/27/building–openscenegraph–3–0–0–from–source–for–both–x86–and–x64/

More info on building third party libraries is in: http://binglongx.wordpress.com/2011/07/27/building–openscenegraph–3–0–0–from–source–for–both–x86–and–x64/

这篇关于如何从源和第三方依赖项构建 OpenSceneGraph?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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