你好,游客 登录 注册 搜索
背景:
阅读新闻

Windows下编译安装PBRT V1.05

[日期:2012-08-23] 来源:Linux社区  作者:lqhbupt [字体:大 中 小]

由于要用到网上的一个插件。虽然现在PBRT已经出了V2版本。仍然需要编译下PBRTV1版本。V1的各个版本功能相似,只是不断的修正BUGS的过程。因此选择了V1的最后一个版本PBRTV 1.05。

1)首先从官网上下载:

pbrt-src-1.05.zip, for Windows (620kB)

2)将文件解压到目录

c:\pbrt-v1

3)在Windows下编译OpenEXR 见http://www.linuxidc.com/Linux/2012-08/68605.htm

4)先编译项目core。通过后再编译其他项目

在目录C:\pbrt-v1\pbrt-1.05\win32下打开pbrt.sln

4.1)将配置属性设置为All Configurations。

项目属性->Configuration Properties->General->IntermediateDirectory设置为../tmp/$(ProjectName)/

Output Directory设置为../../bin

4.2) 在core项目的属性里VC++Directories中的Include Directories中加入:C:\Deploy\include

core项目右键->Properties->Linker->General->AdditionalLibrary Directories改为C:\Deploy\lib\Win32\Release

4.3)由于我用的是ZLIB-1.2.5版本,其对应的dll和lib分别为zlibwapi.dll和zlibwapi.lib

将core右键->Properties->Linker->AdditionalDependecies,将其改为:

Half.lib

Iex.lib

IlmImf.lib

Imath.lib

zlibwapi.lib

IlmThread.lib

4.4)在core目录下新建文件unistd.h。内容如下:

#ifndef _UNISTD_H  

#define _UNISTD_H  

#include <io.h> 

#include <process.h> 

#endif /* _UNISTD_H */

4.5) 在core右键->Properties->C/C++->Preprocessor->PreprocessorDefinition部分加入OPENEXR_DLL

4.6) 在core/exrio.cpp文件中,注释掉

#define hypotf hypot

4.7)编译core项目成功

4.8) 将renderer右键->Properties->Build Events->Post-BuildEvent中的zlib1.dll换成zlibwapi.dll。并将zlibwapi.dll放在解决方案目录下,即win32/目录下。

4.9)修改所有项目的Output Directory为../../bin。

Intermediate Directory为../tmp/$(ProjectName)/

4.10)Build整个解决方案。

 

5)需要把C:\Deploy\bin\Win32\Release中的所有dll文件拷贝到C:\pbrt-v1\pbrt-1.05\bin中,并设定系统变量PBRT_SEARCHPATH指向C:\pbrt-v1\pbrt-1.05\bin

下载一个测试用的 pbrt 脚本文件,再写个批处理脚本 pbrt.cmd,都放到PBRT 文件夹下的 \scenes 文件夹下,来测试下pbrt 程序吧,批处理脚本如下:

SET PATH=%PATH%;%PBRT_SEARCHPATH%

pbrt.exe sharp.pbrt

"..\...\bin\exrdisplay.exe" sharp.exr

 

遇到问题及解决方案:

1)c:\pbrt-v1\pbrt-1.05\core\exrio.cpp(29):fatal error C1083: Cannot open include file: 'ImfInputFile.h': No such file ordirectory

在core项目的属性里VC++Directories中的Include Directories中加入:C:\Deploy\include

2)c:\pbrt-v1\pbrt-1.05\core\pbrtlex.cpp(771):fatal error C1083: Cannot open include file: 'unistd.h': No such file ordirectory

在core目录下新建文件unistd.h。内容如下:

#ifndef _UNISTD_H  

#define _UNISTD_H  

#include <io.h> 

#include <process.h> 

#endif /* _UNISTD_H */

3)c:\program files(x86)\microsoft visual studio 10.0\vc\include\math.h(167): error C2733: secondC linkage of overloaded function 'hypot' not allowed

解决方法,在exrio.cpp文件中,注释掉

#define hypotf hypot

4)将core项目右键->Properties->Linker->General->AdditionalLibrary Directories改为C:\Deploy\lib\Win32\Release

5)由于我用的是ZLIB-1.2.5版本,其对应的dll和lib分别为zlibwapi.dll和zlibwapi.lib

将core右键->Properties->Linker->AdditionalDependecies,将其改为:

Half.lib

Iex.lib

IlmImf.lib

Imath.lib

zlibwapi.lib

IlmThread.lib

6)1>exrio.obj : errorLNK2001: unresolved external symbol "private: static union half::uif const* const half::_toFloat" (?_toFloat@half@@0QBTuif@1@B)

1>exrio.obj : error LNK2001: unresolved external symbol"private: static unsigned short const * const half::_eLut"(?_eLut@half@@0QBGB)

解决方案:在core右键->Properties->C/C++->Preprocessor->PreprocessorDefinition部分加入OPENEXR_DLL

7)C:\Program Files(x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(392,5):error MSB6003: The specified task executable "link.exe" could not berun. The process cannot access the file'C:\pbrt-v1\pbrt-1.05\win32\Projects\Debug\link.read.1.tlog' because it is beingused by another process.

原因:多个项目将tlog文件输出到同一目录,导致冲突。

解决方法:发现所有项目的IntermediateDirectory指定到不同的目录。项目属性->ConfigurationProperties->General->Intermediate Directory。原来为Debug\,将其改为../tmp/$(ProjectName)/

linux
相关资讯       PBRT 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* 匿名 发表于 2013/1/4 10:26:41
在Core编译时候不通过,错误是:
Lexing pbrtlex
1> 系统找不到指定的路径。Yacc'ing pbrtparse
1> 系统找不到指定的路径。
请问这是什么原因呢?