pbrtビルド手順


Instructions for compiling PBRT under Windows using Visual Studio 2005

1.) Download necessary software packages
- PBRT: http://www.pbrt.org/src/pbrt-src-1.02.zip
- OpenEXR: http://savannah.nongnu.org/download/openexr/OpenEXR-1.2.2.tar.gz
- zlib: http://www.zlib.net/zlib123.zip
- Cygwin: http://www.cygwin.com/setup.exe
- FLTK: http://www.fltk.org/software.php?VERSION=2.0.x-r4886&FILE=fltk/1.1.7/fltk-1.1.7-source.zip
  (only required if you want to compile the exrdisplay utility)
- Nvidia SDK: http://download.nvidia.com/developer/SDK/9.5/NVIDIA_SDK_9.5.0923.0930.exe
  (only required if you want to compile the exrdisplay utility with fragment shader support)

2.) Install Cygwin
- note that you can do a minimal install since the only necessary utilities
  are flex and bison

3.) Install the Nvidia SDK (as noted above, this is an optional step)

4.) compile FLTK (as noted above, this is also an optional step)
- unzip the FLTK package, for the purposes of these instructions we'll assume
  C:\fltk.
- Open the C:\fltk\vc2005\fltk.sln solution in Visual Studio.
- Build both the Debug and Release versions.
  - Select the top level Solution in the Solution Explorer
  - Build->Batch Build
  - Click Select All
  - Click Build
- FLTK should now build cleanly.
- After FLTK is built, add FLTK to Visual Studio's list of directories.
  - Tools->Options->Projects And Solutions->VC++ Directories
  - Show directories for Library Files
  - Click the New Line Icon (the folder with the spark on its top right)
  - Browse to C:\fltk\lib, Click Open then OK
  - Using the black arrows, move this directory to the bottom of the list
  - Next, choose Show directories for Include Files
  - As done for the lib directory, make a new directory listing, browse to
    C:\fltk, click Open then OK, and move it to the bottom of the list
    - note that to do this in a "cleaner" manner, create an 'include'
      directory in C:\fltk, copy the C:\fltk\FL directory into 'include',
      and then in the above step add C:\fltk\include instead of C:\fltk, this
      will keep Visual Studio from inadvertently compiling against some of
      the other headers that FLTK has in its root directory.

5.) Compile zlib
- unzip the zlib package, for the purposes of these instructions we'll assume
  C:\zlib.
- Open the C:\zlib\projects\visualc6\zlib.dsw and allow Visual Studio to
  convert it to 2005 format as necessary.
- Build both the Debug and Release versions, but not the ASM versions!
  - Select the top level Solution in the Solution Explorer
  - Build->Batch Build
  - Select all those Projects without ASM in the Configuration string
  - Click Build
- After zlib is built, add zlib to Visual Studio's list of directories
  - To do this in the cleanest manner, create an 'include' and 'lib'
    subdirectory in the C:\zlib root directory.
  - Copy zconf.h, zlib.h, and zutil.h from C:\zlib into C:\zlib\include
  - Copy C:\zlib\projects\visualc6\Win32_DLL_Debug\zlib1d.lib,
         C:\zlib\projects\visualc6\Win32_DLL_Release\zlib1.lib,
         C:\zlib\projects\visualc6\Win32_LIB_Debug\zlibd.lib, and
         C:\zlib\projects\visualc6\Win32_DLL_Debug\zlib.lib
    all into C:\zlib\lib
  - As in the last instruction for FLTK, add C:\zlib\include to the list of
    Include directories, and C:\zlib\lib to the list of Lib directories.
- Add the the zlib dll's to the system path.
  - Create a 'bin' directory in C:\zlib
  - Copy C:\zlib\projects\visualc6\Win32_DLL_Debug\zlib1.dll and
         C:\zlib\projects\visualc6\Win32_DLL_Release\zlib.dll
    both into C:\zlib\bin
  - Open System Properties (Win+Break, or right-click My Computer and click
    Properties)
  - Click the Advanced tab.
  - Click the Environment Variables button.
  - In the User Variables for <username>, select "Path", and click Edit.
  - At the end of the entry, add "C:\zlib\bin", making sure that this new
    entry is separated from the current string by a semicolon, e.g.
    "C:\Progra~1\Foo;C:\zlib\bin"

6.) Compile OpenEXR
- untar the OpenEXR package, for the purposes of these instructions we'll
  assume C:\OpenEXR.
- Open the C:\OpenEXR\vc\vc7\OpenEXR.sln solution file in Visual Studio,
  allowing it convert as necessary.
- Note that if you want to compile exrdisplay with fragment shader support,
  this is the point where you will need to tell Visual Studio where the
  Nvidia SDK headers and libraries are.  The include directory (assuming a
  default install) is: C:\Program Files\NVIDIA Corporation\SDK 9.5\inc and
  the library directories are under
  C:\Program Files\NVIDIA Corporation\SDK 9.5\LIBS, of which you'll have to
  add at least the lib\Release subdirectory.
- Again, build both the OpenEXR Debug and Release solutions, using the same
  instructions as in zlib and FLTK.
- You'll probably see some errors like the following:
  LINK : fatal error LNK1181: cannot open input file 'Iex_dll_d.lib'
  don't worry too much about these, they are only if you want to use
  OpenEXR in dll format, which PBRT doesn't.
- Building OpenEXR can take a little while as it compiles and runs tests
  for each of its sub-libraries.  If you see that a test is hung or otherwise
  taking too long, you can kill it with ctrl+break and rebuild and it will
  be skipped on the second pass.
- As for the previous libraries, you will now need to tell Visual Studio where
  to look for the OpenEXR headers and libs.  The include directories you will
  need are C:\OpenEXR\Half, C:\OpenEXR\Iex, C:\OpenEXR\IlmImf and
  C:\OpenEXR\Imath.  The library directory is C:\OpenEXR\vc\vc7\lib.  Add them
  to Visual Studio in the same manner as before.
- You'll probably also want to add C:\OpenEXR\vc\vc7\bin to your Path so you
  can easily run the OpenEXR utilities from the command line.  To do so follow
  the same steps as for C:\zlib\bin as given above.

7.) Compile PBRT (finally!)
- unzip the PBRT package, for the purposes of these instructions we'll assume
  C:\pbrt
- Open the C:\pbrt\win32\pbrt.sln solution file, allowing Visual Studio to
  convert as necessary.
- Before compiling, there are a few project changes you will need to make.
  - Select the "core" project, and expand the "Parser Files" directory.
  - Right-click pbrtlex.l and click Properties
  - Select Custom Build Step and then General
  - Change the Command Line to reflect the directory into which you installed
    Cygwin in Step 1.  Furthermore, if you have spaces in either the Cygwin
    directory name or the pbrt directory you created, you will have to
    appropriately quote the offending part of the command line.  See
    http://www.pbrt.org/faq.php#faqs_build-win32_win32cygwin for more info.
  - Do the same as the above for pbrtparse.y.
  - Next, right-click the core project and select Properties
  - Go to Configuration Properties->Linker->Input and change the zlib library
    reference to zlib1.lib.  Do the same for both Release and Debug versions
    of the core project.
  - Next, go to Linker->General and erase the entire string in Additional
    Library Directories (again, for both Release and Debug)
  - Lastly, go to C/C++->General and erase the string in Additional Include
    Directories for OpenEXR (after you're done it should read only
    "../../core;../..", and again, do the same for both Release and Debug)
- As before, now you should be able to build both the Release and Debug
  versions of PBRT using Batch Build.
- To facilitate running PBRT, you will probably want to add
  C:\pbrt\win32\Projects\Release to your Path environment variable and you'll
  want to also add the same directory to a new environment variable named
  PBRT_SEARCHPATH (so that PBRT can find all the plug-ins). Substitute
  ..\Projects\Debug if you want to run the debug build.  Alternatively, you
  can copy ..\Projects\Debug\pbrt.exe (as pbrtd.exe) and
   ..\Projects\Release\pbrt.exe both into a new directory, C:\pbrt\bin, and
  add that to your Path and then specify the searchPath directive in your
  scene files for added flexibility in switching between Debug and Release
  versions.
最終更新:2007年07月20日 00:49