这里使用的是OpenImageIO 1.1.11,要将OIIO解压到[工作目录]/openimageio/oiio里面。
先要给OIIO打一个patch,patch文件是Blender提供的:
下载OpenImageIO 1.1.11 Windows Patch
打好patch以后,对于Debug,在[工作目录]/openimageio创建如下bat文件并用Visual Studio 2008命令行运行:
@Echo off
cd oiio
set LIBDIR=%CD%\..\..
:: create build directory
mkdir build\windows_debug
cd build\windows_debug
cmake -G "NMake Makefiles" ..\..\src ^
-DCMAKE_INSTALL_PREFIX=%LIBDIR%\openimageio\debug ^
-DILMBASE_INCLUDE_DIR=%LIBDIR%\openexr\include ^
-DILMBASE_HALF_LIBRARIES=%LIBDIR%\openexr\lib\Half_d.lib ^
-DILMBASE_IMATH_LIBRARIES=%LIBDIR%\openexr\lib\Imath_d.lib ^
-DILMBASE_ILMTHREAD_LIBRARIES=%LIBDIR%\openexr\lib\IlmThread_d.lib ^
-DILMBASE_IEX_LIBRARIES=%LIBDIR%\openexr\lib\Iex_d.lib ^
-DOPENEXR_INCLUDE_DIR=%LIBDIR%\openexr\include ^
-DOPENEXR_ILMIMF_LIBRARIES=%LIBDIR%\openexr\lib\IlmImf_d.lib ^
-DLINKSTATIC=ON ^
-DBUILDSTATIC=ON ^
-DBOOST_ROOT=%LIBDIR%\boost ^
-DBoost_USE_STATIC_RUNTIME=ON ^
-DZLIB_INCLUDE_DIR=%LIBDIR%\zlib\include ^
-DZLIB_LIBRARY=%LIBDIR%\zlib\lib\libz_d.lib ^
-DPNG_PNG_INCLUDE_DIR=%LIBDIR%\png\include ^
-DPNG_LIBRARY=%LIBDIR%\png\lib\libpng_d.lib ^
-DJPEG_INCLUDE_DIR=%LIBDIR%\jpeg\include ^
-DJPEG_LIBRARY=%LIBDIR%\jpeg\lib\libjpeg_d.lib ^
-DTIFF_INCLUDE_DIR=%LIBDIR%\tiff\include ^
-DTIFF_LIBRARY=%LIBDIR%\tiff\lib\libtiff_d.lib ^
-DUSE_OPENGL=OFF ^
-DUSE_TBB=OFF ^
-DUSE_FIELD3D=OFF ^
-DUSE_QT=OFF ^
-DUSE_PYTHON=OFF ^
-DCMAKE_BUILD_TYPE=Debug
nmake
nmake install
cd ..\..\..
对于Release使用如下bat文件:
@Echo off
cd oiio
set LIBDIR=%CD%\..\..
:: create build directory
mkdir build\windows
cd build\windows
cmake -G "NMake Makefiles" ..\..\src ^
-DCMAKE_INSTALL_PREFIX=%LIBDIR%\openimageio ^
-DILMBASE_INCLUDE_DIR=%LIBDIR%\openexr\include ^
-DILMBASE_HALF_LIBRARIES=%LIBDIR%\openexr\lib\Half.lib ^
-DILMBASE_IMATH_LIBRARIES=%LIBDIR%\openexr\lib\Imath.lib ^
-DILMBASE_ILMTHREAD_LIBRARIES=%LIBDIR%\openexr\lib\IlmThread.lib ^
-DILMBASE_IEX_LIBRARIES=%LIBDIR%\openexr\lib\Iex.lib ^
-DOPENEXR_INCLUDE_DIR=%LIBDIR%\openexr\include ^
-DOPENEXR_ILMIMF_LIBRARIES=%LIBDIR%\openexr\lib\IlmImf.lib ^
-DLINKSTATIC=ON ^
-DBUILDSTATIC=ON ^
-DBOOST_ROOT=%LIBDIR%\boost ^
-DBoost_USE_STATIC_RUNTIME=ON ^
-DZLIB_INCLUDE_DIR=%LIBDIR%\zlib\include ^
-DZLIB_LIBRARY=%LIBDIR%\zlib\lib\libz.lib ^
-DPNG_PNG_INCLUDE_DIR=%LIBDIR%\png\include ^
-DPNG_LIBRARY=%LIBDIR%\png\lib\libpng.lib ^
-DJPEG_INCLUDE_DIR=%LIBDIR%\jpeg\include ^
-DJPEG_LIBRARY=%LIBDIR%\jpeg\lib\libjpeg.lib ^
-DTIFF_INCLUDE_DIR=%LIBDIR%\tiff\include ^
-DTIFF_LIBRARY=%LIBDIR%\tiff\lib\libtiff.lib ^
-DUSE_OPENGL=OFF ^
-DUSE_TBB=OFF ^
-DUSE_FIELD3D=OFF ^
-DUSE_QT=OFF ^
-DUSE_PYTHON=OFF ^
-DCMAKE_BUILD_TYPE=Release
nmake
nmake install
cd ..\..\..