Windows下编译安装PBRT V1.05

由于要用到网上的一个插件。虽然现在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://blog.csdn.net/lqhbupt/article/details/7859034

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)/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值