如何使用 Visual Studio 14 2015 x64 构建 OpenEXR 2.2?
How to build OpenEXR 2.2 using Visual Studio 14 2015 x64?
我正在使用 CMake 3.7.1。我想使用 Visual Studio 2015 x64 构建 OpenEXR 2.2。发布版本包含详细的构建说明:
Launch a command window, navigate to the IlmBase folder with CMakeLists.txt,and type command: setlocal del /f CMakeCache.txt
cmake
-DCMAKE_INSTALL_PREFIX=
-G "Visual Studio 10 Win64"
..\ilmbase
Navigate to IlmBase folder in Windows Explorer, open ILMBase.sln and build the solution. When it build successfully, right click
INSTALL project and build. It will install the output to the path you
set up at the previous step.
Go to http://www.zlib.net and download zlib
Launch a command window, navigate to the OpenEXR folder with CMakeLists.txt, and type command: setlocal del /f CMakeCache.txt
cmake
-DZLIB_ROOT=
-DILMBASE_PACKAGE_PREFIX=
-DCMAKE_INSTALL_PREFIX=
-G "Visual Studio 10 Win64" ^
..\openexr
Navigate to OpenEXR folder in Windows Explorer, open OpenEXR.sln and build the solution. When it build successfully, right click
INSTALL project and build. It will install the output to the path you
set up at the previous step.
步骤 1 到 2 对我来说没有问题。 IlmBase的lib、dll和头文件存放在"build"文件夹中:
我执行的步骤 1 到 2 的说明:
wget.exe https://github.com/openexr/openexr/archive/v2.2.0.zip -OC:\thirdparty\vs2015\x64\openexr-2.2.0.zip
7za.exe x C:\thirdparty\vs2015\x64\openexr-2.2.0.zip -oC:\thirdparty\vs2015\x64
del C:\thirdparty\vs2015\x64\openexr-2.2.0.zip
C:
cd C:\thirdparty\vs2015\x64\openexr-2.2.0\IlmBase
cmake -G"Visual Studio 14 2015 Win64" -HC:\thirdparty\vs2015\x64\openexr-2.2.0 -BC:\build\vs2015\x64\openexr-2.2.0 ^
setlocal
del /f CMakeCache.txt
cmake -DCMAKE_INSTALL_PREFIX="..\ilmbase\build" -G "Visual Studio 14 2015 Win64" ..\ilmbase
cmake --build . --config Release
cmake --build . --config Debug
cmake --build . --target INSTALL
第 3 步(下载并构建 zlib-1.2.8)也很简单:
wget.exe http://zlib.net/zlib128.zip -OC:\thirdparty\vs2015\x64\zlib-1.2.8.zip
7za.exe x C:\thirdparty\vs2015\x64\zlib-1.2.8.zip -oC:\thirdparty\vs2015\x64
del C:\thirdparty\vs2015\x64\zlib-1.2.8.zip
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
cmake -G"Visual Studio 14 2015 Win64" -HC:\thirdparty\vs2015\x64\zlib-1.2.8 -BC:\build\vs2015\x64\zlib-1.2.8
C:
cd C:\build\vs2015\x64\zlib-1.2.8
cmake --build . --config Release
cmake --build . --config Debug
mkdir C:\thirdparty\vs2015\x64\zlib-1.2.8\lib
mkdir C:\thirdparty\vs2015\x64\zlib-1.2.8\bin
copy Debug\zlibd.dll C:\thirdparty\vs2015\x64\zlib-1.2.8\bin\zlibd.dll
copy Debug\zlibd.exp C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibd.exp
copy Debug\zlibd.ilk C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibd.ilk
copy Debug\zlibd.lib C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibd.lib
copy Debug\zlibd.pdb C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibd.pdb
copy Debug\zlibstaticd.lib C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibstaticd.lib
copy Release\zlib.dll C:\thirdparty\vs2015\x64\zlib-1.2.8\bin\zlib.dll
copy Release\zlib.exp C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlib.exp
copy Release\zlib.lib C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlib.lib
copy Release\zlibstatic.lib C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibstatic.lib
cd C:\thirdparty\vs2015\x64
rmdir C:\build\vs2015\x64\zlib-1.2.8 /S /Q
现在进入第4+5步。我正在执行以下语句:
cmake -DZLIB_ROOT="C:\thirdparty\vs2015\x64\zlib-1.2.8" ^
-DILMBASE_PACKAGE_PREFIX="C:\thirdparty\vs2015\x64\openexr-2.2.0\IlmBase\build" ^
-DCMAKE_INSTALL_PREFIX="..\OpenEXR\build" ^
-G "Visual Studio 14 2015 Win64" ^
..\openexr
我正在打开 openexr.sln 然后尝试构建 IlmInf。存在一个错误:"cmd.exe" 已退出,代码为 -1073741515
这是错误日志:
4>------ Build started: Project: IlmImf, Configuration: Debug x64 ------
4> Building Custom Rule C:/thirdparty/vs2015/x64/openexr-2.2.0/OpenEXR/IlmImf/CMakeLists.txt
4> CMake does not need to re-run because C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\CMakeFiles\generate.stamp is up-to-date.
4> Generating b44ExpLogTable.h
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code -1073741515.
========== Build: 3 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我不明白为什么会出现此错误。我在这里做错了什么?
顺便说一句:我用来构建 zlib 和 OpenEXR 的批处理脚本可以在这里找到:https://bitbucket.org/snippets/Vertexwahn/
IlmImf 尝试 运行 b44ExpLogTable.exe,这需要 Half.dll 文件位于正确的位置。将 Half.dll 等文件复制到正确位置时一切正常。
我使用以下 windows 批处理脚本来处理构建 OpenEXR 并将所有内容复制到正确的位置:
Build_openexr-2.2.0_Visual 工作室 14 2015 Win64.cmd
wget.exe https://github.com/openexr/openexr/archive/v2.2.0.zip -OC:\thirdparty\vs2015\x64\openexr-2.2.0.zip
7za.exe x C:\thirdparty\vs2015\x64\openexr-2.2.0.zip -oC:\thirdparty\vs2015\x64
del C:\thirdparty\vs2015\x64\openexr-2.2.0.zip
C:
cd C:\thirdparty\vs2015\x64\openexr-2.2.0\IlmBase
cmake -DCMAKE_INSTALL_PREFIX="C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy" ^
-G "Visual Studio 14 2015 Win64" ^
..\ilmbase
setlocal
del /f CMakeCache.txt
cmake -DCMAKE_INSTALL_PREFIX="..\deploy" -G "Visual Studio 14 2015 Win64" ..\ilmbase
cmake --build . --config Release
cmake --build . --config RelWithDebInfo
cmake --build . --config Debug
cmake --build . --target INSTALL
cd C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR
setlocal
del /f CMakeCache.txt
cmake -DZLIB_ROOT="C:\thirdparty\vs2015\x64\zlib-1.2.11" ^
-DILMBASE_PACKAGE_PREFIX="C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy" ^
-DCMAKE_INSTALL_PREFIX="..\deploy" ^
-G "Visual Studio 14 2015 Win64" ^
..\openexr
mkdir C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Half.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\Half.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Iex-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\Iex-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IexMath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\IexMath.2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IlmThread-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\IlmThread-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Imath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\Imath-2_2.dll
mkdir C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Half.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\Half.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Iex-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\Iex-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IexMath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\IexMath.2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IlmThread-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\IlmThread-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Imath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\Imath-2_2.dll
mkdir C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Half.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\Half.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Iex-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\Iex-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IexMath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\IexMath.2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IlmThread-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\IlmThread-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Imath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\Imath-2_2.dll
cmake --build . --config Release
cmake --build . --config RelWithDebInfo
cmake --build . --config Debug
cmake --build . --target INSTALL
构建 OpenEXR 需要预构建 zlib 版本。我使用以下脚本构建 zlib:
Build_zlib-1.2.11_Visual 工作室 14 2015 Win64.cmd
wget.exe http://zlib.net/zlib1211.zip -OC:\thirdparty\vs2015\x64\zlib-1.2.11.zip
7za.exe x C:\thirdparty\vs2015\x64\zlib-1.2.11.zip -oC:\thirdparty\vs2015\x64
del C:\thirdparty\vs2015\x64\zlib-1.2.11.zip
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
cmake -G"Visual Studio 14 2015 Win64" -HC:\thirdparty\vs2015\x64\zlib-1.2.11 -BC:\thirdparty\vs2015\x64\zlib-1.2.11\build
C:
cd C:\thirdparty\vs2015\x64\zlib-1.2.11\build
cmake --build . --config Debug
cmake --build . --config Release
cmake --build . --config RelWithDebInfo
mkdir C:\thirdparty\vs2015\x64\zlib-1.2.11\lib
mkdir C:\thirdparty\vs2015\x64\zlib-1.2.11\bin
copy Debug\zlibd.dll C:\thirdparty\vs2015\x64\zlib-1.2.11\bin\zlibd.dll
copy Debug\zlibd.exp C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibd.exp
copy Debug\zlibd.ilk C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibd.ilk
copy Debug\zlibd.lib C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibd.lib
copy Debug\zlibd.pdb C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibd.pdb
copy Debug\zlibstaticd.lib C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibstaticd.lib
copy Release\zlib.dll C:\thirdparty\vs2015\x64\zlib-1.2.11\bin\zlib.dll
copy Release\zlib.exp C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlib.exp
copy Release\zlib.lib C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlib.lib
copy Release\zlibstatic.lib C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibstatic.lib
copy zconf.h C:\thirdparty\vs2015\x64\zlib-1.2.11\zconf.h
下载这些脚本
修复错误 MSB6006 的步骤 "cmd.exe":
确保您已构建 ilmbase.sln 解决方案,然后构建“INSTALL”部分ilmbase。结果,您会在 ilmbase 目录中找到 lib 和 include 文件夹。
打开高级系统设置和你的路径...\ilmbase-2.2.0\lib; 到“Path”系统变量的末尾。关闭高级系统设置。
重启Visual Studio并重建openexr.sln
已接受的答案不适用于 OpenEXR 2.3.0。下面是一个批处理文件,适用于 Windows 10 with VS 2015 x64。
您需要将 wget.exe、7za.exe 和以下批次的内容放在同一个文件夹中。
请注意,我已禁用 Python 库,因为我不需要它们并且我没有安装 Python。
rem ### ZLIB ###
wget.exe http://zlib.net/zlib1211.zip -O.\zlib-1.2.11.zip
7za.exe x .\zlib-1.2.11.zip -o.\
del .\zlib-1.2.11.zip
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
cmake -G"Visual Studio 14 2015 Win64" -H.\zlib-1.2.11 -B.\zlib-1.2.11\build
cd zlib-1.2.11\build
cmake --build . --config Debug
cmake --build . --config Release
cmake --build . --config RelWithDebInfo
cd..
mkdir lib
mkdir bin
cd build
copy Debug\zlibd.dll ..\bin\zlibd.dll
copy Debug\zlibd.exp ..\lib\zlibd.exp
copy Debug\zlibd.ilk ..\lib\zlibd.ilk
copy Debug\zlibd.lib ..\lib\zlibd.lib
copy Debug\zlibd.pdb ..\lib\zlibd.pdb
copy Debug\zlibstaticd.lib ..\lib\zlibstaticd.lib
copy Release\zlib.dll ..\bin\zlib.dll
copy Release\zlib.exp ..\lib\zlib.exp
copy Release\zlib.lib ..\lib\zlib.lib
copy Release\zlibstatic.lib ..\lib\zlibstatic.lib
copy zconf.h ..\zconf.h
cd..\..
rem ### OPENEXR ###
wget.exe https://github.com/openexr/openexr/archive/v2.3.0.zip -O.\openexr-2.3.0.zip
7za.exe x .\openexr-2.3.0.zip -o.
del .\openexr-2.3.0.zip
cd openexr-2.3.0\
setlocal
del /f CMakeCache.txt
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="%~dp0openexr-2.3.0" -DCMAKE_PREFIX_PATH="%~dp0zlib-1.2.11" -DOPENEXR_BUILD_PYTHON_LIBS=0
cmake --build . --target INSTALL --config Debug -- /maxcpucount:8
cmake --build . --target INSTALL --config Release -- /maxcpucount:8
cmake --build . --target INSTALL --config RelWithDebInfo -- /maxcpucount:8
pause
在 OpenEXR 2.3.0 上似乎有一个 open issue 和 IlmImf CMake 文件。
建议的解决方法(搜索 OPENEXR_PACKAGE_PREFIX
并将其替换为 CMAKE_INSTALL_PREFIX
)在我的情况下效果很好。
在我的例子中,我只是调用
sed -i "s/OPENEXR_PACKAGE_PREFIX/CMAKE_INSTALL_PREFIX/g" ./OpenEXR/IlmImf/CMakeLists.txt
在 运行 cmake
之前(git 对于 windows)
我正在使用 CMake 3.7.1。我想使用 Visual Studio 2015 x64 构建 OpenEXR 2.2。发布版本包含详细的构建说明:
Launch a command window, navigate to the IlmBase folder with CMakeLists.txt,and type command: setlocal del /f CMakeCache.txt cmake -DCMAKE_INSTALL_PREFIX= -G "Visual Studio 10 Win64" ..\ilmbase
Navigate to IlmBase folder in Windows Explorer, open ILMBase.sln and build the solution. When it build successfully, right click INSTALL project and build. It will install the output to the path you set up at the previous step.
Go to http://www.zlib.net and download zlib
Launch a command window, navigate to the OpenEXR folder with CMakeLists.txt, and type command: setlocal del /f CMakeCache.txt cmake -DZLIB_ROOT= -DILMBASE_PACKAGE_PREFIX= -DCMAKE_INSTALL_PREFIX= -G "Visual Studio 10 Win64" ^ ..\openexr
Navigate to OpenEXR folder in Windows Explorer, open OpenEXR.sln and build the solution. When it build successfully, right click INSTALL project and build. It will install the output to the path you set up at the previous step.
步骤 1 到 2 对我来说没有问题。 IlmBase的lib、dll和头文件存放在"build"文件夹中:
我执行的步骤 1 到 2 的说明:
wget.exe https://github.com/openexr/openexr/archive/v2.2.0.zip -OC:\thirdparty\vs2015\x64\openexr-2.2.0.zip
7za.exe x C:\thirdparty\vs2015\x64\openexr-2.2.0.zip -oC:\thirdparty\vs2015\x64
del C:\thirdparty\vs2015\x64\openexr-2.2.0.zip
C:
cd C:\thirdparty\vs2015\x64\openexr-2.2.0\IlmBase
cmake -G"Visual Studio 14 2015 Win64" -HC:\thirdparty\vs2015\x64\openexr-2.2.0 -BC:\build\vs2015\x64\openexr-2.2.0 ^
setlocal
del /f CMakeCache.txt
cmake -DCMAKE_INSTALL_PREFIX="..\ilmbase\build" -G "Visual Studio 14 2015 Win64" ..\ilmbase
cmake --build . --config Release
cmake --build . --config Debug
cmake --build . --target INSTALL
第 3 步(下载并构建 zlib-1.2.8)也很简单:
wget.exe http://zlib.net/zlib128.zip -OC:\thirdparty\vs2015\x64\zlib-1.2.8.zip
7za.exe x C:\thirdparty\vs2015\x64\zlib-1.2.8.zip -oC:\thirdparty\vs2015\x64
del C:\thirdparty\vs2015\x64\zlib-1.2.8.zip
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
cmake -G"Visual Studio 14 2015 Win64" -HC:\thirdparty\vs2015\x64\zlib-1.2.8 -BC:\build\vs2015\x64\zlib-1.2.8
C:
cd C:\build\vs2015\x64\zlib-1.2.8
cmake --build . --config Release
cmake --build . --config Debug
mkdir C:\thirdparty\vs2015\x64\zlib-1.2.8\lib
mkdir C:\thirdparty\vs2015\x64\zlib-1.2.8\bin
copy Debug\zlibd.dll C:\thirdparty\vs2015\x64\zlib-1.2.8\bin\zlibd.dll
copy Debug\zlibd.exp C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibd.exp
copy Debug\zlibd.ilk C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibd.ilk
copy Debug\zlibd.lib C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibd.lib
copy Debug\zlibd.pdb C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibd.pdb
copy Debug\zlibstaticd.lib C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibstaticd.lib
copy Release\zlib.dll C:\thirdparty\vs2015\x64\zlib-1.2.8\bin\zlib.dll
copy Release\zlib.exp C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlib.exp
copy Release\zlib.lib C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlib.lib
copy Release\zlibstatic.lib C:\thirdparty\vs2015\x64\zlib-1.2.8\lib\zlibstatic.lib
cd C:\thirdparty\vs2015\x64
rmdir C:\build\vs2015\x64\zlib-1.2.8 /S /Q
现在进入第4+5步。我正在执行以下语句:
cmake -DZLIB_ROOT="C:\thirdparty\vs2015\x64\zlib-1.2.8" ^
-DILMBASE_PACKAGE_PREFIX="C:\thirdparty\vs2015\x64\openexr-2.2.0\IlmBase\build" ^
-DCMAKE_INSTALL_PREFIX="..\OpenEXR\build" ^
-G "Visual Studio 14 2015 Win64" ^
..\openexr
我正在打开 openexr.sln 然后尝试构建 IlmInf。存在一个错误:"cmd.exe" 已退出,代码为 -1073741515
这是错误日志:
4>------ Build started: Project: IlmImf, Configuration: Debug x64 ------
4> Building Custom Rule C:/thirdparty/vs2015/x64/openexr-2.2.0/OpenEXR/IlmImf/CMakeLists.txt
4> CMake does not need to re-run because C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\CMakeFiles\generate.stamp is up-to-date.
4> Generating b44ExpLogTable.h
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code -1073741515.
========== Build: 3 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我不明白为什么会出现此错误。我在这里做错了什么?
顺便说一句:我用来构建 zlib 和 OpenEXR 的批处理脚本可以在这里找到:https://bitbucket.org/snippets/Vertexwahn/
IlmImf 尝试 运行 b44ExpLogTable.exe,这需要 Half.dll 文件位于正确的位置。将 Half.dll 等文件复制到正确位置时一切正常。
我使用以下 windows 批处理脚本来处理构建 OpenEXR 并将所有内容复制到正确的位置:
Build_openexr-2.2.0_Visual 工作室 14 2015 Win64.cmd
wget.exe https://github.com/openexr/openexr/archive/v2.2.0.zip -OC:\thirdparty\vs2015\x64\openexr-2.2.0.zip
7za.exe x C:\thirdparty\vs2015\x64\openexr-2.2.0.zip -oC:\thirdparty\vs2015\x64
del C:\thirdparty\vs2015\x64\openexr-2.2.0.zip
C:
cd C:\thirdparty\vs2015\x64\openexr-2.2.0\IlmBase
cmake -DCMAKE_INSTALL_PREFIX="C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy" ^
-G "Visual Studio 14 2015 Win64" ^
..\ilmbase
setlocal
del /f CMakeCache.txt
cmake -DCMAKE_INSTALL_PREFIX="..\deploy" -G "Visual Studio 14 2015 Win64" ..\ilmbase
cmake --build . --config Release
cmake --build . --config RelWithDebInfo
cmake --build . --config Debug
cmake --build . --target INSTALL
cd C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR
setlocal
del /f CMakeCache.txt
cmake -DZLIB_ROOT="C:\thirdparty\vs2015\x64\zlib-1.2.11" ^
-DILMBASE_PACKAGE_PREFIX="C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy" ^
-DCMAKE_INSTALL_PREFIX="..\deploy" ^
-G "Visual Studio 14 2015 Win64" ^
..\openexr
mkdir C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Half.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\Half.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Iex-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\Iex-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IexMath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\IexMath.2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IlmThread-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\IlmThread-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Imath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Release\Imath-2_2.dll
mkdir C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Half.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\Half.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Iex-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\Iex-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IexMath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\IexMath.2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IlmThread-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\IlmThread-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Imath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\RelWithDebInfo\Imath-2_2.dll
mkdir C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Half.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\Half.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Iex-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\Iex-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IexMath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\IexMath.2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\IlmThread-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\IlmThread-2_2.dll
copy C:\thirdparty\vs2015\x64\openexr-2.2.0\deploy\lib\Imath-2_2.dll C:\thirdparty\vs2015\x64\openexr-2.2.0\OpenEXR\IlmImf\Debug\Imath-2_2.dll
cmake --build . --config Release
cmake --build . --config RelWithDebInfo
cmake --build . --config Debug
cmake --build . --target INSTALL
构建 OpenEXR 需要预构建 zlib 版本。我使用以下脚本构建 zlib:
Build_zlib-1.2.11_Visual 工作室 14 2015 Win64.cmd
wget.exe http://zlib.net/zlib1211.zip -OC:\thirdparty\vs2015\x64\zlib-1.2.11.zip
7za.exe x C:\thirdparty\vs2015\x64\zlib-1.2.11.zip -oC:\thirdparty\vs2015\x64
del C:\thirdparty\vs2015\x64\zlib-1.2.11.zip
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
cmake -G"Visual Studio 14 2015 Win64" -HC:\thirdparty\vs2015\x64\zlib-1.2.11 -BC:\thirdparty\vs2015\x64\zlib-1.2.11\build
C:
cd C:\thirdparty\vs2015\x64\zlib-1.2.11\build
cmake --build . --config Debug
cmake --build . --config Release
cmake --build . --config RelWithDebInfo
mkdir C:\thirdparty\vs2015\x64\zlib-1.2.11\lib
mkdir C:\thirdparty\vs2015\x64\zlib-1.2.11\bin
copy Debug\zlibd.dll C:\thirdparty\vs2015\x64\zlib-1.2.11\bin\zlibd.dll
copy Debug\zlibd.exp C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibd.exp
copy Debug\zlibd.ilk C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibd.ilk
copy Debug\zlibd.lib C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibd.lib
copy Debug\zlibd.pdb C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibd.pdb
copy Debug\zlibstaticd.lib C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibstaticd.lib
copy Release\zlib.dll C:\thirdparty\vs2015\x64\zlib-1.2.11\bin\zlib.dll
copy Release\zlib.exp C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlib.exp
copy Release\zlib.lib C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlib.lib
copy Release\zlibstatic.lib C:\thirdparty\vs2015\x64\zlib-1.2.11\lib\zlibstatic.lib
copy zconf.h C:\thirdparty\vs2015\x64\zlib-1.2.11\zconf.h
下载这些脚本
修复错误 MSB6006 的步骤 "cmd.exe":
确保您已构建 ilmbase.sln 解决方案,然后构建“INSTALL”部分ilmbase。结果,您会在 ilmbase 目录中找到 lib 和 include 文件夹。
打开高级系统设置和你的路径...\ilmbase-2.2.0\lib; 到“Path”系统变量的末尾。关闭高级系统设置。
重启Visual Studio并重建openexr.sln
已接受的答案不适用于 OpenEXR 2.3.0。下面是一个批处理文件,适用于 Windows 10 with VS 2015 x64。 您需要将 wget.exe、7za.exe 和以下批次的内容放在同一个文件夹中。 请注意,我已禁用 Python 库,因为我不需要它们并且我没有安装 Python。
rem ### ZLIB ###
wget.exe http://zlib.net/zlib1211.zip -O.\zlib-1.2.11.zip
7za.exe x .\zlib-1.2.11.zip -o.\
del .\zlib-1.2.11.zip
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
cmake -G"Visual Studio 14 2015 Win64" -H.\zlib-1.2.11 -B.\zlib-1.2.11\build
cd zlib-1.2.11\build
cmake --build . --config Debug
cmake --build . --config Release
cmake --build . --config RelWithDebInfo
cd..
mkdir lib
mkdir bin
cd build
copy Debug\zlibd.dll ..\bin\zlibd.dll
copy Debug\zlibd.exp ..\lib\zlibd.exp
copy Debug\zlibd.ilk ..\lib\zlibd.ilk
copy Debug\zlibd.lib ..\lib\zlibd.lib
copy Debug\zlibd.pdb ..\lib\zlibd.pdb
copy Debug\zlibstaticd.lib ..\lib\zlibstaticd.lib
copy Release\zlib.dll ..\bin\zlib.dll
copy Release\zlib.exp ..\lib\zlib.exp
copy Release\zlib.lib ..\lib\zlib.lib
copy Release\zlibstatic.lib ..\lib\zlibstatic.lib
copy zconf.h ..\zconf.h
cd..\..
rem ### OPENEXR ###
wget.exe https://github.com/openexr/openexr/archive/v2.3.0.zip -O.\openexr-2.3.0.zip
7za.exe x .\openexr-2.3.0.zip -o.
del .\openexr-2.3.0.zip
cd openexr-2.3.0\
setlocal
del /f CMakeCache.txt
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="%~dp0openexr-2.3.0" -DCMAKE_PREFIX_PATH="%~dp0zlib-1.2.11" -DOPENEXR_BUILD_PYTHON_LIBS=0
cmake --build . --target INSTALL --config Debug -- /maxcpucount:8
cmake --build . --target INSTALL --config Release -- /maxcpucount:8
cmake --build . --target INSTALL --config RelWithDebInfo -- /maxcpucount:8
pause
在 OpenEXR 2.3.0 上似乎有一个 open issue 和 IlmImf CMake 文件。
建议的解决方法(搜索 OPENEXR_PACKAGE_PREFIX
并将其替换为 CMAKE_INSTALL_PREFIX
)在我的情况下效果很好。
在我的例子中,我只是调用
sed -i "s/OPENEXR_PACKAGE_PREFIX/CMAKE_INSTALL_PREFIX/g" ./OpenEXR/IlmImf/CMakeLists.txt
在 运行 cmake
之前(git 对于 windows)