Skip to content

Commit 94b089b

Browse files
dg0ytchausner
andauthored
[openexr] Update from 2 to 3.1.5, patch all consuming ports (#26862)
* Update to 3.1.5 * Add feature 'tools' * ilmbase is now imath * [theia] Use openimageio cmake config * [freeimage] Use OpenEXR 3 and Imath * [opencv4] Use upstream's OpenEXR 3 support * [opencv3] Use upstream's OpenEXR 3 support * [opencv2] Use OpenEXR 3 and Imath * [osg] Use OpenEXR 3 * [openvdb] Use Imath, enable OpenEXR * [pangolin] Use OpenEXR 3 * [directxtex] Use OpenEXR 3 * [uvatlas] Disable /guard:ehcont when directxtex uses openexr * Update versions Co-authored-by: chausner <[email protected]>
1 parent 1ea1da7 commit 94b089b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+373
-276
lines changed

Diff for: ports/directxtex/enable_openexr_support.patch

+65
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index fc0a3e8..7447741 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -156,7 +156,7 @@ target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
6+
7+
if(ENABLE_OPENEXR_SUPPORT)
8+
find_package(OpenEXR REQUIRED)
9+
- target_include_directories(${PROJECT_NAME} PRIVATE ${OPENEXR_INCLUDE_DIRS}/OpenEXR)
10+
+ target_link_libraries(${PROJECT_NAME} PRIVATE OpenEXR::OpenEXR)
11+
endif()
12+
13+
if ((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16") AND (NOT MINGW))
14+
@@ -299,6 +299,7 @@ if(MSVC)
15+
endif()
16+
17+
if((MSVC_VERSION GREATER_EQUAL 1928) AND (CMAKE_SIZEOF_VOID_P EQUAL 8)
18+
+ AND NOT ENABLE_OPENEXR_SUPPORT
19+
AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)))
20+
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
21+
target_compile_options(${t} PRIVATE "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
122
diff --git a/DirectXTexEXR.cpp b/DirectXTexEXR.cpp
223
index 17bd171..825cfe4 100644
324
--- a/DirectXTex/DirectXTexEXR.cpp
@@ -20,3 +41,47 @@ index 17bd171..825cfe4 100644
2041
namespace
2142
{
2243
struct handle_closer { void operator()(HANDLE h) noexcept { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } };
44+
@@ -161,7 +161,7 @@ namespace
45+
return result.QuadPart >= m_EOF;
46+
}
47+
48+
- Imf::Int64 tellg() override
49+
+ uint64_t tellg() override
50+
{
51+
const LARGE_INTEGER dist = {};
52+
LARGE_INTEGER result;
53+
@@ -169,10 +169,10 @@ namespace
54+
{
55+
throw com_exception(HRESULT_FROM_WIN32(GetLastError()));
56+
}
57+
- return static_cast<Imf::Int64>(result.QuadPart);
58+
+ return static_cast<uint64_t>(result.QuadPart);
59+
}
60+
61+
- void seekg(Imf::Int64 pos) override
62+
+ void seekg(uint64_t pos) override
63+
{
64+
LARGE_INTEGER dist;
65+
dist.QuadPart = static_cast<LONGLONG>(pos);
66+
@@ -213,7 +213,7 @@ namespace
67+
}
68+
}
69+
70+
- Imf::Int64 tellp() override
71+
+ uint64_t tellp() override
72+
{
73+
const LARGE_INTEGER dist = {};
74+
LARGE_INTEGER result;
75+
@@ -221,10 +221,10 @@ namespace
76+
{
77+
throw com_exception(HRESULT_FROM_WIN32(GetLastError()));
78+
}
79+
- return static_cast<Imf::Int64>(result.QuadPart);
80+
+ return static_cast<uint64_t>(result.QuadPart);
81+
}
82+
83+
- void seekp(Imf::Int64 pos) override
84+
+ void seekp(uint64_t pos) override
85+
{
86+
LARGE_INTEGER dist;
87+
dist.QuadPart = static_cast<LONGLONG>(pos);

Diff for: ports/directxtex/vcpkg.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "directxtex",
33
"version-date": "2022-07-29",
4+
"port-version": 1,
45
"description": "DirectXTex texture processing library",
56
"homepage": "https://github.com/Microsoft/DirectXTex",
67
"documentation": "https://github.com/microsoft/DirectXTex/wiki",

Diff for: ports/freeimage/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ target_link_libraries(FreeImage ${ZLIB_LIBRARIES}
107107
WebP::webp WebP::webpdemux WebP::libwebpmux WebP::webpdecoder
108108
${JXR_LIBRARIES}
109109
${LibRaw_LIBRARIES}
110-
OpenEXR::IlmImf)
110+
OpenEXR::OpenEXR
111+
Imath::Imath)
111112

112113
target_compile_definitions(FreeImage PRIVATE ${PNG_DEFINITIONS})
113114

@@ -153,6 +154,7 @@ find_dependency(WebP CONFIG)
153154
find_dependency(JXR)
154155
find_dependency(LibRaw)
155156
find_dependency(OpenEXR)
157+
find_dependency(Imath)
156158
include(\"\${CMAKE_CURRENT_LIST_DIR}/freeimage-targets.cmake\")
157159
")
158160

Diff for: ports/freeimage/use-external-openexr.patch

+30-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,38 @@ index b286430..82b3b72 100644
2525
+#include <OpenEXR/ImfRgba.h>
2626
+#include <OpenEXR/ImfArray.h>
2727
+#include <OpenEXR/ImfPreviewImage.h>
28-
+#include <OpenEXR/half.h>
28+
+#include <Imath/half.h>
2929

3030

3131
// ==========================================================
32+
@@ -66,11 +66,11 @@ public:
33+
return ((unsigned)n != _io->read_proc(c, 1, n, _handle));
34+
}
35+
36+
- virtual Imath::Int64 tellg() {
37+
+ virtual uint64_t tellg() {
38+
return _io->tell_proc(_handle);
39+
}
40+
41+
- virtual void seekg(Imath::Int64 pos) {
42+
+ virtual void seekg(uint64_t pos) {
43+
_io->seek_proc(_handle, (unsigned)pos, SEEK_SET);
44+
}
45+
46+
@@ -100,11 +100,11 @@ public:
47+
}
48+
}
49+
50+
- virtual Imath::Int64 tellp() {
51+
+ virtual uint64_t tellp() {
52+
return _io->tell_proc(_handle);
53+
}
54+
55+
- virtual void seekp(Imath::Int64 pos) {
56+
+ virtual void seekp(uint64_t pos) {
57+
_io->seek_proc(_handle, (unsigned)pos, SEEK_SET);
58+
}
59+
};
3260
diff --git a/Source/FreeImage/PluginTIFF.cpp b/Source/FreeImage/PluginTIFF.cpp
3361
index 562fdd7..ce12649 100644
3462
--- a/Source/FreeImage/PluginTIFF.cpp
@@ -38,7 +66,7 @@ index 562fdd7..ce12649 100644
3866
#include <tiffio.h>
3967
#include "../Metadata/FreeImageTag.h"
4068
-#include "../OpenEXR/Half/half.h"
41-
+#include <OpenEXR/half.h>
69+
+#include <Imath/half.h>
4270

4371
#include "FreeImageIO.h"
4472
#include "PSDParser.h"

Diff for: ports/freeimage/vcpkg.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"name": "freeimage",
33
"version": "3.18.0",
4-
"port-version": 23,
4+
"port-version": 24,
55
"description": "Support library for graphics image formats",
66
"homepage": "https://sourceforge.net/projects/freeimage/",
7+
"license": "GPL-2.0-only OR GPL-3.0-only OR FreeImage",
78
"dependencies": [
9+
"imath",
810
"jxrlib",
911
"libjpeg-turbo",
1012
"libpng",

Diff for: ports/ilmbase/vcpkg.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
22
"name": "ilmbase",
3-
"version-string": "2.3.0",
4-
"port-version": 1,
5-
"description": "empty package, linking to newer one",
3+
"version": "3",
4+
"description": "Obsolete, use port imath instead",
65
"dependencies": [
7-
"openexr"
6+
"imath"
87
]
98
}

Diff for: ports/opencv2/0003-force-package-requirements.patch

-9
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,3 @@
4545
if(PNG_FOUND)
4646
include(CheckIncludeFile)
4747
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
48-
@@ -151,7 +151,7 @@ if(WITH_OPENEXR)
49-
if(BUILD_OPENEXR)
50-
ocv_clear_vars(OPENEXR_FOUND)
51-
else()
52-
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
53-
+ find_package(OpenEXR REQUIRED)
54-
endif()
55-
56-
if(NOT OPENEXR_FOUND)

Diff for: ports/opencv2/0019-fix-openexr.patch

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake
2+
index 9b43066..c1cc11f 100644
3+
--- a/cmake/OpenCVFindLibsGrfmt.cmake
4+
+++ b/cmake/OpenCVFindLibsGrfmt.cmake
5+
@@ -151,7 +151,12 @@ if(WITH_OPENEXR)
6+
if(BUILD_OPENEXR)
7+
ocv_clear_vars(OPENEXR_FOUND)
8+
else()
9+
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
10+
+ find_package(Imath CONFIG REQUIRED)
11+
+ find_package(OpenEXR CONFIG REQUIRED)
12+
+ set(OPENEXR_LIBRARIES Imath::Imath OpenEXR::OpenEXR)
13+
+ set(OPENEXR_INCLUDE_PATHS "")
14+
+ set(OPENEXR_VERSION "${OpenEXR_VERSION}")
15+
+ set(OPENEXR_FOUND 1)
16+
endif()
17+
18+
if(NOT OPENEXR_FOUND)
19+
diff --git a/modules/highgui/src/grfmt_exr.cpp b/modules/highgui/src/grfmt_exr.cpp
20+
index 399e586..b8cd270 100644
21+
--- a/modules/highgui/src/grfmt_exr.cpp
22+
+++ b/modules/highgui/src/grfmt_exr.cpp
23+
@@ -57,6 +57,7 @@
24+
#include <ImfOutputFile.h>
25+
#include <ImfChannelList.h>
26+
#include <ImfStandardAttributes.h>
27+
+#include <ImfFrameBuffer.h>
28+
#include <half.h>
29+
#include "grfmt_exr.hpp"
30+

Diff for: ports/opencv2/portfile.cmake

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ vcpkg_from_github(
1515
0005-fix-cuda.patch
1616
0006-fix-jasper.patch
1717
0007-fix-config.patch
18+
0019-fix-openexr.patch
1819
)
20+
# Disallow accidental build of vendored copies
21+
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr")
1922

2023
file(REMOVE "${SOURCE_PATH}/cmake/FindCUDA.cmake")
2124
file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindCUDA")
@@ -126,7 +129,7 @@ find_dependency(Threads)")
126129
string(APPEND DEPS_STRING "\nfind_dependency(CUDA)")
127130
endif()
128131
if("openexr" IN_LIST FEATURES)
129-
string(APPEND DEPS_STRING "\nfind_dependency(OpenEXR CONFIG)")
132+
string(APPEND DEPS_STRING "\nfind_dependency(Imath CONFIG)\nfind_dependency(OpenEXR CONFIG)")
130133
endif()
131134
if("png" IN_LIST FEATURES)
132135
string(APPEND DEPS_STRING "\nfind_dependency(PNG)")

Diff for: ports/opencv2/vcpkg.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "opencv2",
33
"version": "2.4.13.7",
4-
"port-version": 14,
4+
"port-version": 15,
55
"description": "Open Source Computer Vision Library",
66
"homepage": "https://github.com/opencv/opencv",
77
"license": "BSD-3-Clause",
@@ -102,6 +102,7 @@
102102
"openexr": {
103103
"description": "OpenEXR support for opencv",
104104
"dependencies": [
105+
"imath",
105106
"openexr"
106107
]
107108
},

Diff for: ports/opencv3/0003-force-package-requirements.patch

-9
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@
5454
if(PNG_FOUND)
5555
include(CheckIncludeFile)
5656
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
57-
@@ -229,7 +229,7 @@ if(WITH_OPENEXR)
58-
ocv_clear_vars(HAVE_OPENEXR)
59-
if(NOT BUILD_OPENEXR)
60-
ocv_clear_internal_cache_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
61-
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
62-
+ find_package(OpenEXR REQUIRED)
63-
endif()
64-
65-
if(OPENEXR_FOUND)
6657
@@ -247,7 +247,7 @@ endif()
6758

6859
# --- GDAL (optional) ---

Diff for: ports/opencv3/portfile.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ vcpkg_from_github(
2222
0011-remove-python2.patch
2323
0012-fix-zlib.patch
2424
)
25+
# Disallow accidental build of vendored copies
26+
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr")
2527

2628
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
2729
set(TARGET_IS_AARCH64 1)

Diff for: ports/opencv3/vcpkg.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "opencv3",
33
"version": "3.4.18",
4-
"port-version": 1,
4+
"port-version": 2,
55
"description": "Open Source Computer Vision Library",
66
"homepage": "https://github.com/opencv/opencv",
77
"license": "BSD-3-Clause",

Diff for: ports/opencv4/0003-force-package-requirements.patch

-9
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@
6363
if(PNG_FOUND)
6464
include(CheckIncludeFile)
6565
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
66-
@@ -257,7 +257,7 @@ if(WITH_OPENEXR)
67-
ocv_clear_vars(HAVE_OPENEXR)
68-
if(NOT BUILD_OPENEXR)
69-
ocv_clear_internal_cache_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
70-
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
71-
+ find_package(OpenEXR REQUIRED)
72-
endif()
73-
74-
if(OPENEXR_FOUND)
7566
@@ -275,7 +275,7 @@ endif()
7667

7768
# --- GDAL (optional) ---

Diff for: ports/opencv4/portfile.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ vcpkg_from_github(
2525
0015-fix-freetype.patch
2626
0017-mingw-strsafe-no-deprecate.patch
2727
)
28+
# Disallow accidental build of vendored copies
29+
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr")
2830

2931
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
3032
set(TARGET_IS_AARCH64 1)

Diff for: ports/opencv4/vcpkg.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "opencv4",
33
"version": "4.6.0",
4-
"port-version": 4,
4+
"port-version": 5,
55
"description": "computer vision library",
66
"homepage": "https://github.com/opencv/opencv",
77
"license": "Apache-2.0",

Diff for: ports/openexr/0001-remove_find_package_macro.patch

-38
This file was deleted.

0 commit comments

Comments
 (0)