Skip to content

Commit

Permalink
[openimageio] Update to 3.0.0.3 (#42175)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwang118 authored Nov 20, 2024
1 parent 9e71cb7 commit 6e1219d
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 88 deletions.
76 changes: 39 additions & 37 deletions ports/openimageio/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
diff -u -r a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
index ceaea62..2a2a359 100644
--- a/src/cmake/Config.cmake.in
+++ b/src/cmake/Config.cmake.in
@@ -6,6 +6,30 @@
@@ -6,6 +6,33 @@

include(CMakeFindDependencyMacro)

+find_dependency(Boost COMPONENTS @Boost_COMPONENTS@)
+if(@USE_GIF@)
+ find_dependency(GIF)
Expand All @@ -28,60 +29,61 @@ diff -u -r a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
+if(@USE_WEBP@)
+ find_dependency(WebP CONFIG)
+endif()
+if(@USE_LIBRAW@)
+ find_dependency(LibRaw)
+endif()
+
# add here all the find_dependency() whenever switching to config based dependencies
if (NOT @OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH@ AND NOT OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH)
if (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 3.0)
diff -u -r a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
find_dependency(Imath @Imath_VERSION@
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index f8670a8..816ba08 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -177,10 +177,13 @@
checked_find_package (Freetype
DEFINITIONS -DUSE_FREETYPE=1 )
@@ -125,16 +125,18 @@ checked_find_package (Freetype
VERSION_MIN 2.10.0
DEFINITIONS USE_FREETYPE=1 )

-checked_find_package (OpenColorIO
-checked_find_package (OpenColorIO REQUIRED
- VERSION_MIN 2.2
- VERSION_MAX 2.9
- )
+find_package(OpenColorIO CONFIG REQUIRED)
+set(OPENCOLORIO_INCLUDES "")
+set(OPENCOLORIO_LIBRARIES OpenColorIO::OpenColorIO)
+checked_find_package (OpenColorIO CONFIG
DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1
# PREFER_CONFIG
)
+set(OPENCOLORIO_FOUND "${OpenColorIO_FOUND}")
if (OpenColorIO_FOUND)
option (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS
"For deveoper debugging/testing ONLY! Disable OCIO 2.2 builtin configs." OFF)
@@ -191,7 +194,9 @@
set (OpenColorIO_FOUND 0)
+checked_find_package (OpenColorIO CONFIG)
if (NOT OPENCOLORIO_INCLUDES)
get_target_property(OPENCOLORIO_INCLUDES OpenColorIO::OpenColorIO INTERFACE_INCLUDE_DIRECTORIES)
endif ()
include_directories(BEFORE ${OPENCOLORIO_INCLUDES})

-checked_find_package (OpenCV 3.0
-checked_find_package (OpenCV 4.0
+set(OPENCV_INCLUDES "")
+set(OPENCV_LIBRARIES opencv_core)
+checked_find_package (OpenCV CONFIG
DEFINITIONS -DUSE_OPENCV=1)
DEFINITIONS USE_OPENCV=1)

# Intel TBB
@@ -205,12 +210,16 @@
PREFER_CONFIG)
@@ -146,11 +148,15 @@ checked_find_package (TBB 2017
# DCMTK is used to read DICOM images
checked_find_package (DCMTK CONFIG VERSION_MIN 3.6.1)

-checked_find_package (FFmpeg VERSION_MIN 3.0)
-checked_find_package (FFmpeg VERSION_MIN 4.0)
+checked_find_package (FFmpeg)
+set(FFmpeg_FOUND "${FFMPEG_FOUND}")
+set(FFMPEG_INCLUDES "${FFMPEG_INCLUDE_DIRS}")
checked_find_package (GIF
VERSION_MIN 4
RECOMMEND_MIN 5.0
RECOMMEND_MIN_REASON "for stability and thread safety")

checked_find_package (GIF VERSION_MIN 5.0)

# For HEIF/HEIC/AVIF formats
+set(LIBHEIF_INCLUDES "")
+set(LIBHEIF_LIBRARIES heif)
checked_find_package (Libheif VERSION_MIN 1.3
checked_find_package (Libheif VERSION_MIN 1.11
RECOMMEND_MIN 1.16
RECOMMEND_MIN_REASON "for orientation support")
@@ -231,9 +240,8 @@
# set (LIBRAW_FOUND 0)
endif ()
@@ -159,9 +165,8 @@ checked_find_package (LibRaw
VERSION_MIN 0.20.0
PRINT LibRaw_r_LIBRARIES)

-checked_find_package (OpenJPEG VERSION_MIN 2.0
- RECOMMEND_MIN 2.2
Expand All @@ -91,12 +93,12 @@ diff -u -r a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
# Note: Recent OpenJPEG versions have exported cmake configs, but we don't
# find them reliable at all, so we stick to our FindOpenJPEG.cmake module.

@@ -255,6 +263,8 @@
@@ -178,6 +183,8 @@ if (NOT Ptex_FOUND OR NOT Ptex_VERSION)
checked_find_package (Ptex)
endif ()

+set(WEBP_INCLUDES "")
+set(WEBP_LIBRARIES WebP::webp WebP::webpdemux)
checked_find_package (WebP)
# Note: When WebP 1.1 (released late 2019) is our minimum, we can use their
# exported configs and remove our FindWebP.cmake module.
checked_find_package (WebP VERSION_MIN 1.1)

option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF)
14 changes: 0 additions & 14 deletions ports/openimageio/fix-dependency-libraw.patch

This file was deleted.

13 changes: 0 additions & 13 deletions ports/openimageio/fix-openexr-dll.patch

This file was deleted.

18 changes: 9 additions & 9 deletions ports/openimageio/fix-openexr-target-missing.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
index 08401a2..4f2694e 100644
index 9ee9c9d..6b9e7c2 100644
--- a/src/cmake/Config.cmake.in
+++ b/src/cmake/Config.cmake.in
@@ -24,6 +24,8 @@ if (NOT @OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH@ AND NOT OPENIMAGEIO_CONFIG_DO_NOT
if (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 3.0)
find_dependency(Imath @Imath_VERSION@
HINTS @Imath_DIR@)
+ find_dependency(OpenEXR @OpenEXR_VERSION@
@@ -31,6 +31,8 @@ endif()
if (NOT @OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH@ AND NOT OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH)
find_dependency(Imath @Imath_VERSION@
HINTS @Imath_DIR@)
+ find_dependency(OpenEXR @OpenEXR_VERSION@
+ HINTS @OpenEXR_DIR@)
elseif (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 2.4 AND @FOUND_OPENEXR_WITH_CONFIG@)
find_dependency(IlmBase @OpenEXR_VERSION@
HINTS @IlmBase_DIR@ @OpenEXR_DIR@)
endif ()

if (NOT @fmt_LOCAL_BUILD@ AND NOT @OIIO_INTERNALIZE_FMT@)
11 changes: 6 additions & 5 deletions ports/openimageio/imath-version-guard.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
diff -u -r a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index 816ba08..7fe6a14 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -193,6 +193,11 @@
else ()
set (OpenColorIO_FOUND 0)
@@ -133,6 +133,11 @@ if (NOT OPENCOLORIO_INCLUDES)
get_target_property(OPENCOLORIO_INCLUDES OpenColorIO::OpenColorIO INTERFACE_INCLUDE_DIRECTORIES)
endif ()
include_directories(BEFORE ${OPENCOLORIO_INCLUDES})
+if(USE_OPENCOLORIO AND TARGET Imath::Imath AND OIIO_USING_IMATH STREQUAL "2")
+ message(FATAL_ERROR
+ "OpenColorIO and OpenEXR use incompatible versions of Imath. "
+ "You cannot use openimageio[opencolorio] for this configuration.")
+endif()

set(OPENCV_INCLUDES "")
set(OPENCV_LIBRARIES opencv_core)
9 changes: 6 additions & 3 deletions ports/openimageio/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO AcademySoftwareFoundation/OpenImageIO
REF "v${VERSION}"
SHA512 1e24d7ffc3ad65a1fe1f53ae59006de912c0a8d85827d64671fab95350977e22e2d147cf26ffe362646c768747ec11e6f9aeae04ea66030f82ad597adf3135a5
SHA512 16d357fc6f75d39b1c9265edb45fe78dd2ea67a094885174a0a2bdd39ad19f8f69c16a7aaacac82a106a295e08e311d0315daafcb5641c24f644a52e66aaf667
HEAD_REF master
PATCHES
fix-dependencies.patch
fix-static-ffmpeg.patch
fix-openexr-dll.patch
imath-version-guard.patch
fix-openimageio_include_dir.patch
fix-openexr-target-missing.patch
fix-dependency-libraw.patch
)

file(REMOVE_RECURSE "${SOURCE_PATH}/ext")
Expand Down Expand Up @@ -70,6 +68,11 @@ vcpkg_cmake_configure(
MAYBE_UNUSED_VARIABLES
ENABLE_INSTALL_testtex
ENABLE_IV
BUILD_MISSING_DEPS
BUILD_MISSING_FMT
BUILD_MISSING_ROBINMAP
INTERNALIZE_FMT
REQUIRED_DEPS
)

vcpkg_cmake_install()
Expand Down
4 changes: 2 additions & 2 deletions ports/openimageio/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "openimageio",
"version": "2.5.16.0",
"port-version": 1,
"version": "3.0.0.3",
"description": "A library for reading and writing images, and a bunch of related classes, utilities, and application.",
"homepage": "https://github.com/OpenImageIO/oiio",
"license": "BSD-3-Clause",
Expand All @@ -22,6 +21,7 @@
"fmt",
"libjpeg-turbo",
"libpng",
"opencolorio",
"openexr",
"robin-map",
{
Expand Down
44 changes: 44 additions & 0 deletions ports/theia/fix-last-openimageio.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/src/theia/image/image.cc b/src/theia/image/image.cc
index 6175a1f..18cb59b 100644
--- a/src/theia/image/image.cc
+++ b/src/theia/image/image.cc
@@ -296,7 +296,7 @@ FloatImage FloatImage::ComputeGradient() const {

void FloatImage::ApproximateGaussianBlur(const int kernel_size) {
oiio::ImageBuf kernel;
- oiio::ImageBufAlgo::make_kernel(kernel, "gaussian",
+ oiio::ImageBufAlgo::make_kernel("gaussian",
static_cast<float>(kernel_size),
static_cast<float>(kernel_size));
oiio::ImageBufAlgo::convolve(image_, image_, kernel);
diff --git a/src/theia/sfm/exif_reader.cc b/src/theia/sfm/exif_reader.cc
index c63465a..6b0e702 100644
--- a/src/theia/sfm/exif_reader.cc
+++ b/src/theia/sfm/exif_reader.cc
@@ -150,7 +150,7 @@ bool ExifReader::ExtractEXIFMetadata(
camera_intrinsics_prior->focal_length.is_set = true;

// Set GPS latitude.
- const oiio::ImageIOParameter* latitude =
+ const OIIO::ParamValue* latitude =
image_spec.find_attribute("GPS:Latitude");
if (latitude != nullptr) {
camera_intrinsics_prior->latitude.is_set = true;
@@ -169,7 +169,7 @@ bool ExifReader::ExtractEXIFMetadata(
}

// Set GPS longitude.
- const oiio::ImageIOParameter* longitude =
+ const OIIO::ParamValue* longitude =
image_spec.find_attribute("GPS:Longitude");
if (longitude != nullptr) {
camera_intrinsics_prior->longitude.is_set = true;
@@ -189,7 +189,7 @@ bool ExifReader::ExtractEXIFMetadata(


// Set GSP altitude.
- const oiio::ImageIOParameter* altitude =
+ const OIIO::ParamValue* altitude =
image_spec.find_attribute("GPS:Altitude");
if (altitude != nullptr) {
camera_intrinsics_prior->altitude.is_set = true;
7 changes: 6 additions & 1 deletion ports/theia/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ vcpkg_from_github(
fix-external-dependencies2.patch
eigen-3.4.patch
266.diff
fix-last-openimageio.patch
)

file(REMOVE "${SOURCE_PATH}/cmake/FindSuiteSparse.cmake")
Expand All @@ -30,6 +31,10 @@ vcpkg_cmake_configure(
-DTHEIA_USE_EXTERNAL_FLANN=ON
-DCMAKE_POLICY_DEFAULT_CMP0012=NEW
-DCMAKE_POLICY_DEFAULT_CMP0057=NEW
MAYBE_UNUSED_VARIABLES
CMAKE_POLICY_DEFAULT_CMP0012
THEIA_USE_EXTERNAL_CEREAL
THEIA_USE_EXTERNAL_FLANN
)

vcpkg_cmake_install()
Expand All @@ -47,5 +52,5 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/theia/libraries/akaze/datas
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/theia/libraries/spectra/doxygen")

# Handle copyright
file(INSTALL "${SOURCE_PATH}/license.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license.txt")
file(COPY "${SOURCE_PATH}/data/camera_sensor_database_license.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
2 changes: 1 addition & 1 deletion ports/theia/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "theia",
"version": "0.8",
"port-version": 11,
"port-version": 12,
"description": "An open source library for multiview geometry and structure from motion",
"homepage": "https://github.com/sweeneychris/TheiaSfM",
"license": "BSD-3-Clause",
Expand Down
6 changes: 3 additions & 3 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6697,8 +6697,8 @@
"port-version": 4
},
"openimageio": {
"baseline": "2.5.16.0",
"port-version": 1
"baseline": "3.0.0.3",
"port-version": 0
},
"openjpeg": {
"baseline": "2.5.2",
Expand Down Expand Up @@ -8894,7 +8894,7 @@
},
"theia": {
"baseline": "0.8",
"port-version": 11
"port-version": 12
},
"think-cell-range": {
"baseline": "2023.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/openimageio.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "92a3a8f30923e5f433c6c4123a8bd6062a2c0646",
"version": "3.0.0.3",
"port-version": 0
},
{
"git-tree": "d9bbe547fec5d39df8a0ac27a2e66b4ba4f2f598",
"version": "2.5.16.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/theia.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "fcce9342a3c7301139dd9d9a388657d99fdcc159",
"version": "0.8",
"port-version": 12
},
{
"git-tree": "f05ea8c0e0055843afe42b688e3b55af9218d62a",
"version": "0.8",
Expand Down

0 comments on commit 6e1219d

Please sign in to comment.