Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[openexr] Update from 2 to 3.1.5, patch all consuming ports #26862

Merged
merged 14 commits into from
Sep 26, 2022
65 changes: 65 additions & 0 deletions ports/directxtex/enable_openexr_support.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc0a3e8..7447741 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,7 +156,7 @@ target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)

if(ENABLE_OPENEXR_SUPPORT)
find_package(OpenEXR REQUIRED)
- target_include_directories(${PROJECT_NAME} PRIVATE ${OPENEXR_INCLUDE_DIRS}/OpenEXR)
+ target_link_libraries(${PROJECT_NAME} PRIVATE OpenEXR::OpenEXR)
endif()

if ((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16") AND (NOT MINGW))
@@ -299,6 +299,7 @@ if(MSVC)
endif()

if((MSVC_VERSION GREATER_EQUAL 1928) AND (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ AND NOT ENABLE_OPENEXR_SUPPORT
AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)))
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
diff --git a/DirectXTexEXR.cpp b/DirectXTexEXR.cpp
index 17bd171..825cfe4 100644
--- a/DirectXTex/DirectXTexEXR.cpp
Expand All @@ -20,3 +41,47 @@ index 17bd171..825cfe4 100644
namespace
{
struct handle_closer { void operator()(HANDLE h) noexcept { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } };
@@ -161,7 +161,7 @@ namespace
return result.QuadPart >= m_EOF;
}

- Imf::Int64 tellg() override
+ uint64_t tellg() override
{
const LARGE_INTEGER dist = {};
LARGE_INTEGER result;
@@ -169,10 +169,10 @@ namespace
{
throw com_exception(HRESULT_FROM_WIN32(GetLastError()));
}
- return static_cast<Imf::Int64>(result.QuadPart);
+ return static_cast<uint64_t>(result.QuadPart);
}

- void seekg(Imf::Int64 pos) override
+ void seekg(uint64_t pos) override
{
LARGE_INTEGER dist;
dist.QuadPart = static_cast<LONGLONG>(pos);
@@ -213,7 +213,7 @@ namespace
}
}

- Imf::Int64 tellp() override
+ uint64_t tellp() override
{
const LARGE_INTEGER dist = {};
LARGE_INTEGER result;
@@ -221,10 +221,10 @@ namespace
{
throw com_exception(HRESULT_FROM_WIN32(GetLastError()));
}
- return static_cast<Imf::Int64>(result.QuadPart);
+ return static_cast<uint64_t>(result.QuadPart);
}

- void seekp(Imf::Int64 pos) override
+ void seekp(uint64_t pos) override
{
LARGE_INTEGER dist;
dist.QuadPart = static_cast<LONGLONG>(pos);
1 change: 1 addition & 0 deletions ports/directxtex/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "directxtex",
"version-date": "2022-07-29",
"port-version": 1,
"description": "DirectXTex texture processing library",
"homepage": "https://github.com/Microsoft/DirectXTex",
"documentation": "https://github.com/microsoft/DirectXTex/wiki",
Expand Down
4 changes: 3 additions & 1 deletion ports/freeimage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ target_link_libraries(FreeImage ${ZLIB_LIBRARIES}
WebP::webp WebP::webpdemux WebP::libwebpmux WebP::webpdecoder
${JXR_LIBRARIES}
${LibRaw_LIBRARIES}
OpenEXR::IlmImf)
OpenEXR::OpenEXR
Imath::Imath)

target_compile_definitions(FreeImage PRIVATE ${PNG_DEFINITIONS})

Expand Down Expand Up @@ -153,6 +154,7 @@ find_dependency(WebP CONFIG)
find_dependency(JXR)
find_dependency(LibRaw)
find_dependency(OpenEXR)
find_dependency(Imath)
include(\"\${CMAKE_CURRENT_LIST_DIR}/freeimage-targets.cmake\")
")

Expand Down
32 changes: 30 additions & 2 deletions ports/freeimage/use-external-openexr.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,38 @@ index b286430..82b3b72 100644
+#include <OpenEXR/ImfRgba.h>
+#include <OpenEXR/ImfArray.h>
+#include <OpenEXR/ImfPreviewImage.h>
+#include <OpenEXR/half.h>
+#include <Imath/half.h>


// ==========================================================
@@ -66,11 +66,11 @@ public:
return ((unsigned)n != _io->read_proc(c, 1, n, _handle));
}

- virtual Imath::Int64 tellg() {
+ virtual uint64_t tellg() {
return _io->tell_proc(_handle);
}

- virtual void seekg(Imath::Int64 pos) {
+ virtual void seekg(uint64_t pos) {
_io->seek_proc(_handle, (unsigned)pos, SEEK_SET);
}

@@ -100,11 +100,11 @@ public:
}
}

- virtual Imath::Int64 tellp() {
+ virtual uint64_t tellp() {
return _io->tell_proc(_handle);
}

- virtual void seekp(Imath::Int64 pos) {
+ virtual void seekp(uint64_t pos) {
_io->seek_proc(_handle, (unsigned)pos, SEEK_SET);
}
};
diff --git a/Source/FreeImage/PluginTIFF.cpp b/Source/FreeImage/PluginTIFF.cpp
index 562fdd7..ce12649 100644
--- a/Source/FreeImage/PluginTIFF.cpp
Expand All @@ -38,7 +66,7 @@ index 562fdd7..ce12649 100644
#include <tiffio.h>
#include "../Metadata/FreeImageTag.h"
-#include "../OpenEXR/Half/half.h"
+#include <OpenEXR/half.h>
+#include <Imath/half.h>

#include "FreeImageIO.h"
#include "PSDParser.h"
4 changes: 3 additions & 1 deletion ports/freeimage/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "freeimage",
"version": "3.18.0",
"port-version": 23,
"port-version": 24,
"description": "Support library for graphics image formats",
"homepage": "https://sourceforge.net/projects/freeimage/",
"license": "GPL-2.0-only OR GPL-3.0-only OR FreeImage",
"dependencies": [
"imath",
"jxrlib",
"libjpeg-turbo",
"libpng",
Expand Down
7 changes: 3 additions & 4 deletions ports/ilmbase/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "ilmbase",
"version-string": "2.3.0",
"port-version": 1,
"description": "empty package, linking to newer one",
"version": "3",
"description": "Obsolete, use port imath instead",
"dependencies": [
"openexr"
"imath"
]
}
9 changes: 0 additions & 9 deletions ports/opencv2/0003-force-package-requirements.patch
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,3 @@
if(PNG_FOUND)
include(CheckIncludeFile)
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
@@ -151,7 +151,7 @@ if(WITH_OPENEXR)
if(BUILD_OPENEXR)
ocv_clear_vars(OPENEXR_FOUND)
else()
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
+ find_package(OpenEXR REQUIRED)
endif()

if(NOT OPENEXR_FOUND)
30 changes: 30 additions & 0 deletions ports/opencv2/0019-fix-openexr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake
index 9b43066..c1cc11f 100644
--- a/cmake/OpenCVFindLibsGrfmt.cmake
+++ b/cmake/OpenCVFindLibsGrfmt.cmake
@@ -151,7 +151,12 @@ if(WITH_OPENEXR)
if(BUILD_OPENEXR)
ocv_clear_vars(OPENEXR_FOUND)
else()
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
+ find_package(Imath CONFIG REQUIRED)
+ find_package(OpenEXR CONFIG REQUIRED)
+ set(OPENEXR_LIBRARIES Imath::Imath OpenEXR::OpenEXR)
+ set(OPENEXR_INCLUDE_PATHS "")
+ set(OPENEXR_VERSION "${OpenEXR_VERSION}")
+ set(OPENEXR_FOUND 1)
endif()

if(NOT OPENEXR_FOUND)
diff --git a/modules/highgui/src/grfmt_exr.cpp b/modules/highgui/src/grfmt_exr.cpp
index 399e586..b8cd270 100644
--- a/modules/highgui/src/grfmt_exr.cpp
+++ b/modules/highgui/src/grfmt_exr.cpp
@@ -57,6 +57,7 @@
#include <ImfOutputFile.h>
#include <ImfChannelList.h>
#include <ImfStandardAttributes.h>
+#include <ImfFrameBuffer.h>
#include <half.h>
#include "grfmt_exr.hpp"

5 changes: 4 additions & 1 deletion ports/opencv2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ vcpkg_from_github(
0005-fix-cuda.patch
0006-fix-jasper.patch
0007-fix-config.patch
0019-fix-openexr.patch
)
# Disallow accidental build of vendored copies
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr")

file(REMOVE "${SOURCE_PATH}/cmake/FindCUDA.cmake")
file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindCUDA")
Expand Down Expand Up @@ -126,7 +129,7 @@ find_dependency(Threads)")
string(APPEND DEPS_STRING "\nfind_dependency(CUDA)")
endif()
if("openexr" IN_LIST FEATURES)
string(APPEND DEPS_STRING "\nfind_dependency(OpenEXR CONFIG)")
string(APPEND DEPS_STRING "\nfind_dependency(Imath CONFIG)\nfind_dependency(OpenEXR CONFIG)")
endif()
if("png" IN_LIST FEATURES)
string(APPEND DEPS_STRING "\nfind_dependency(PNG)")
Expand Down
3 changes: 2 additions & 1 deletion ports/opencv2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencv2",
"version": "2.4.13.7",
"port-version": 14,
"port-version": 15,
"description": "Open Source Computer Vision Library",
"homepage": "https://github.com/opencv/opencv",
"license": "BSD-3-Clause",
Expand Down Expand Up @@ -102,6 +102,7 @@
"openexr": {
"description": "OpenEXR support for opencv",
"dependencies": [
"imath",
"openexr"
]
},
Expand Down
9 changes: 0 additions & 9 deletions ports/opencv3/0003-force-package-requirements.patch
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@
if(PNG_FOUND)
include(CheckIncludeFile)
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
@@ -229,7 +229,7 @@ if(WITH_OPENEXR)
ocv_clear_vars(HAVE_OPENEXR)
if(NOT BUILD_OPENEXR)
ocv_clear_internal_cache_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
+ find_package(OpenEXR REQUIRED)
endif()

if(OPENEXR_FOUND)
@@ -247,7 +247,7 @@ endif()

# --- GDAL (optional) ---
Expand Down
2 changes: 2 additions & 0 deletions ports/opencv3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ vcpkg_from_github(
0011-remove-python2.patch
0012-fix-zlib.patch
)
# Disallow accidental build of vendored copies
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr")

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(TARGET_IS_AARCH64 1)
Expand Down
2 changes: 1 addition & 1 deletion ports/opencv3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencv3",
"version": "3.4.18",
"port-version": 1,
"port-version": 2,
"description": "Open Source Computer Vision Library",
"homepage": "https://github.com/opencv/opencv",
"license": "BSD-3-Clause",
Expand Down
9 changes: 0 additions & 9 deletions ports/opencv4/0003-force-package-requirements.patch
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@
if(PNG_FOUND)
include(CheckIncludeFile)
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
@@ -257,7 +257,7 @@ if(WITH_OPENEXR)
ocv_clear_vars(HAVE_OPENEXR)
if(NOT BUILD_OPENEXR)
ocv_clear_internal_cache_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
+ find_package(OpenEXR REQUIRED)
endif()

if(OPENEXR_FOUND)
@@ -275,7 +275,7 @@ endif()

# --- GDAL (optional) ---
Expand Down
2 changes: 2 additions & 0 deletions ports/opencv4/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ vcpkg_from_github(
0015-fix-freetype.patch
0017-mingw-strsafe-no-deprecate.patch
)
# Disallow accidental build of vendored copies
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr")

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(TARGET_IS_AARCH64 1)
Expand Down
2 changes: 1 addition & 1 deletion ports/opencv4/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencv4",
"version": "4.6.0",
"port-version": 4,
"port-version": 5,
"description": "computer vision library",
"homepage": "https://github.com/opencv/opencv",
"license": "Apache-2.0",
Expand Down
38 changes: 0 additions & 38 deletions ports/openexr/0001-remove_find_package_macro.patch

This file was deleted.

Loading