近期需要读取.exr文件,网上找了2天的方法,现在终于找到正确的方法了,记录一下.
顺便帮一下需要的人..
先大概说下我的配置
win10、vs2015、OpenEXR2.2.0、zlib12.11.
OpenEXR官网
http://www.openexr.com/downloads.html
zlib官网
https://zlib.net/
(我在官网上只能下载最新版本openexr2.3.0版本..但是始终无法正确安装)
之后我找了半天找到了OpenEXR2.2.0版本
两种方法:(我使用的方法1.)
(这个方法我是按csdn上一个哥们的方法做的..花积分下的他的..直接公布不知道会不会有啥问题..)
⦁ 解压zlib-1.2.11,在解压主目录CMakeLists.txt中增加红色的行
if(MSVC)
if(ASM686)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx86/inffas32.asm
contrib/masmx86/match686.asm
)
elseif (AMD64)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx64/gvmat64.asm
contrib/masmx64/inffasx64.asm
)
set(ZLIB_SRCS
${ZLIB_SRCS} contrib/masmx64/inffas8664.c
)
endif()
if(ZLIB_ASMS)
add_definitions(-DASMV -DASMINF)
endif()
endif()
⦁ 环境变量PATH增加x64编译器
H:\software\win10chs\vs2015ent\VC\bin\x86_amd64
⦁ 选择编译器:
⦁ cmake选项选择x64,设置install 路径
⦁ 进入生成目录,打开zlib.sln进行编译。
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
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
以上适用于openEXR2.2.0其他版本不一定ok..
下面是原始库链接
openEXR2.2.0和zlib1211链接