[openimageio] Update to v2.3.17.0, revise dependencies and export (#23918)

* Fix exported Imath dependency

* Drop unused deps from patches and config

* Handle DLL import in installed header

* Fix non-required find_package(OpenColorIO)

* Omit unrelocatable script

* Installation cleanup

* Update to 2.1.2

* Fix exported pc file

* Update versions

* Silence warning

* Update versions

* OpenImageIO features CI test

* Consolidate patches

* Revise OpenJPEG patching

* Revise PNG patching

* Revise libheif patching

* Revise libsquish patching

* Revise ffmpeg patching

* Fix static ffmpeg linking

* Fix webp usage

* More dependency control

* Misc cleanup

* Update copyright, add usage

* Move config to share/openimageio

* Trim dependencies

* Revise opencv dependency

* Remove find modules which might clash with opencv

* Use opencolorio config and target

* Update openimageio to 2.3.17.0

* LINKSTATIC breaks CRT lib linkage

* Catch Imath version conflicts.

This is not a regression but the result of previous opencolorio changes.
It will eventually be resolved by upgrading openexr.

* Remove llvm from opencv CI test port [skip actions]

* [libheif] Fix symbol export

* [skip actions]

* Update versions

* Add baseline =pass entries.

Co-authored-by: Billy O'Neal <bion@microsoft.com>
This commit is contained in:
Kai Pastor 2022-07-29 07:19:42 +02:00 committed by GitHub
parent 162a88fa44
commit 40ec948687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 226 additions and 120 deletions

View File

@ -26,10 +26,11 @@ endif()
vcpkg_fixup_pkgconfig()
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libheif/heif.h" "!defined(LIBHEIF_STATIC_BUILD)" "1")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libheif/heif.h" "defined(_MSC_VER) && !defined(LIBHEIF_STATIC_BUILD)" "defined(_WIN32)")
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libheif/heif.h" "!defined(LIBHEIF_STATIC_BUILD)" "0")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libheif/heif.h" "defined(_MSC_VER) && !defined(LIBHEIF_STATIC_BUILD)" "0")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libheif/heif.h" "#ifdef LIBHEIF_EXPORTS" "#if 0")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

View File

@ -1,7 +1,7 @@
{
"name": "libheif",
"version": "1.12.0",
"port-version": 3,
"port-version": 4,
"description": "Open h.265 video codec implementation.",
"homepage": "http://www.libheif.org/",
"license": "LGPL-3.0-only",

View File

@ -1,13 +0,0 @@
diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
index b498ece..fb45388 100644
--- a/src/cmake/Config.cmake.in
+++ b/src/cmake/Config.cmake.in
@@ -30,7 +30,7 @@ endif ()
#...logic to determine installedPrefix from the own location...
#set (@PROJECT_NAME@_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@")
-include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/OpenImageIOTargets.cmake")
check_required_components ("@PROJECT_NAME@")

View File

@ -2,68 +2,105 @@ diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
index b690864..fb45388 100644
--- a/src/cmake/Config.cmake.in
+++ b/src/cmake/Config.cmake.in
@@ -11,6 +11,9 @@ elseif (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 2.4 AND @FOUND_OPENEXR_WITH_CONF
HINTS @IlmBase_DIR@ @OpenEXR_DIR@)
find_dependency(OpenEXR @OpenEXR_VERSION@
HINTS @OpenEXR_DIR@)
+ find_dependency(libpng CONFIG REQUIRED)
+ find_dependency(libheif CONFIG REQUIRED)
+ find_dependency(unofficial-libsquish CONFIG REQUIRED)
find_dependency(ZLIB @ZLIB_VERSION@) # Because OpenEXR doesn't do it
find_dependency(Threads) # Because OpenEXR doesn't do it
endif ()
@@ -1,6 +1,21 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
+find_dependency(libheif CONFIG)
+find_dependency(PNG)
+find_dependency(unofficial-libsquish CONFIG)
+if(@USE_OPENCV@)
+ find_dependency(OpenCV CONFIG)
+endif()
+if(@USE_OPENCOLORIO@)
+ find_dependency(OpenColorIO CONFIG)
+endif()
+if(@USE_OPENJPEG@)
+ find_dependency(OpenJPEG CONFIG)
+endif()
+if(@USE_WEBP@)
+ find_dependency(WebP CONFIG)
+endif()
# add here all the find_dependency() whenever switching to config based dependencies
if (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 3.0)
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index 631035a..9f4d096 100644
index 631035a..d416d78 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -148,7 +148,7 @@ find_python()
# Dependencies for optional formats and features. If these are not found,
# we will continue building, but the related functionality will be disabled.
@@ -158,14 +158,19 @@ endif ()
checked_find_package (Freetype
DEFINITIONS -DUSE_FREETYPE=1 )
-checked_find_package (PNG)
+checked_find_package (png PREFER_CONFIG)
-checked_find_package (OpenColorIO
+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 (NOT OPENCOLORIO_FOUND)
set (OPENCOLORIO_FOUND 0)
endif ()
-checked_find_package (OpenCV 3.0
+set(OPENCV_INCLUDES "")
+set(OPENCV_LIBRARIES opencv_core)
+checked_find_package (OpenCV CONFIG
DEFINITIONS -DUSE_OPENCV=1)
checked_find_package (BZip2) # Used by ffmpeg and freetype
if (NOT BZIP2_FOUND)
@@ -200,7 +200,8 @@ if (ENABLE_FIELD3D)
# Intel TBB
@@ -175,7 +177,9 @@ checked_find_package (TBB 2017
PREFER_CONFIG)
checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images
-checked_find_package (FFmpeg VERSION_MIN 3.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
@@ -200,7 +200,9 @@ if (ENABLE_FIELD3D)
endif ()
# For HEIF/HEIC/AVIF formats
-checked_find_package (Libheif VERSION_MIN 1.3
+checked_find_package (libheif VERSION_MIN 1.3
+ PREFER_CONFIG
+set(LIBHEIF_INCLUDES "")
+set(LIBHEIF_LIBRARIES heif)
+checked_find_package (Libheif CONFIG
RECOMMEND_MIN 1.7
RECOMMEND_MIN_REASON "for AVIF support")
if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11)
@@ -307,7 +308,8 @@ endmacro()
@@ -221,9 +222,8 @@ if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VER
# set (LIBRAW_FOUND 0)
endif ()
-checked_find_package (OpenJPEG VERSION_MIN 2.0
- RECOMMEND_MIN 2.2
- RECOMMEND_MIN_REASON "for multithreading support")
+set(CMAKE_REQUIRE_FIND_PACKAGE_OpenJPEG ${USE_OPENJPEG})
+checked_find_package (OpenJPEG CONFIG)
# 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.
@@ -240,6 +243,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)
option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF)
@@ -307,7 +309,9 @@ endmacro()
option (USE_EMBEDDED_LIBSQUISH
"Force use of embedded Libsquish, even if external is found" OFF)
if (NOT USE_EMBEDDED_LIBSQUISH)
- checked_find_package (Libsquish)
+ checked_find_package (unofficial-libsquish PREFER_CONFIG)
+ set(libsquish_FOUND 1)
+ set(LIBSQUISH_INCLUDES "")
+ set(LIBSQUISH_LIBRARIES unofficial::libsquish::squish)
+ checked_find_package (Libsquish NAMES unofficial-libsquish)
endif ()
diff --git a/src/ico.imageio/CMakeLists.txt b/src/ico.imageio/CMakeLists.txt
index d290625..cff954c 100644
--- a/src/ico.imageio/CMakeLists.txt
+++ b/src/ico.imageio/CMakeLists.txt
@@ -2,9 +2,15 @@
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
-if (TARGET PNG::PNG)
+if (libpng_FOUND)
+ if (TARGET png_static)
+ set(PNG_TARGET png_static)
+ elseif (TARGET png)
+ set(PNG_TARGET png)
+ endif()
+
add_oiio_plugin (icoinput.cpp icooutput.cpp
- LINK_LIBRARIES PNG::PNG ZLIB::ZLIB)
+ LINK_LIBRARIES ${PNG_TARGET} ZLIB::ZLIB)
else ()
message (WARNING "libpng not found, so ICO support will not work")
set (format_plugin_definitions ${format_plugin_definitions} DISABLE_ICO=1 PARENT_SCOPE)

View File

@ -1,17 +0,0 @@
diff --git a/src/ffmpeg.imageio/CMakeLists.txt b/src/ffmpeg.imageio/CMakeLists.txt
index 5840206..cc52e4c 100644
--- a/src/ffmpeg.imageio/CMakeLists.txt
+++ b/src/ffmpeg.imageio/CMakeLists.txt
@@ -2,9 +2,10 @@
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
-if (FFmpeg_FOUND)
+if (USE_FFMPEG)
+ find_package(FFMPEG REQUIRED)
add_oiio_plugin (ffmpeginput.cpp
- INCLUDE_DIRS ${FFMPEG_INCLUDES}
+ INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS}
LINK_LIBRARIES ${FFMPEG_LIBRARIES}
${BZIP2_LIBRARIES}
DEFINITIONS "-DUSE_FFMPEG"

View File

@ -0,0 +1,13 @@
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index b50a923..c3250b9 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -108,7 +108,7 @@ if (CMAKE_COMPILER_IS_CLANG AND OPENEXR_VERSION VERSION_LESS 2.3)
# clang C++ >= 11 doesn't like 'register' keyword in old exr headers
add_compile_options (-Wno-deprecated-register)
endif ()
-if (MSVC AND NOT LINKSTATIC)
+if (WIN32 AND BUILD_SHARED_LIBS)
add_definitions (-DOPENEXR_DLL) # Is this needed for new versions?
endif ()

View File

@ -1,13 +0,0 @@
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index 1fc2059..62c4efb 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -222,7 +222,7 @@ if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VER
# set (LIBRAW_FOUND 0)
endif ()
-checked_find_package (OpenJPEG VERSION_MIN 2.0)
+checked_find_package (OpenJPEG PREFER_CONFIG VERSION_MIN 2.0)
checked_find_package (OpenVDB
VERSION_MIN 5.0

View File

@ -0,0 +1,18 @@
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index dc260a7..433ffbb 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -6,6 +6,13 @@
checked_find_package (pybind11 REQUIRED
VERSION_MIN 2.4.2)
+if(USE_FFMPEG AND UNIX AND NOT BUILD_SHARED_LIBS AND VCPKG_CRT_LINKAGE STREQUAL "dynamic")
+ include(CheckLinkerFlag)
+ check_linker_flag(C "LINKER:-Bsymbolic" supports_bsymbolic)
+ if(supports_bsymbolic)
+ add_link_options("LINKER:-Bsymbolic")
+ endif()
+endif()
file (GLOB python_srcs *.cpp)
setup_python_module (TARGET PyOpenImageIO

View File

@ -0,0 +1,16 @@
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index b50a923..cec6e43 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -168,6 +168,11 @@ set(OPENCOLORIO_FOUND "${OpenColorIO_FOUND}")
if (NOT OPENCOLORIO_FOUND)
set (OPENCOLORIO_FOUND 0)
endif ()
+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)
checked_find_package (OpenCV CONFIG

View File

@ -1,25 +1,27 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OpenImageIO/oiio
REF ff71703961f7758409fb7e6e689258e2997f7c18 # 2.3.10.1
SHA512 f56cb58329a496ca1fe3537fe87d469038ac0e74a555990a4510d2c019d2ad14b556240c0d5087a9a25ac01d9b371b5c77ce5a719e71a85fcd56e9cd099bc31e
REF v2.3.17.0
SHA512 25cb1a671e7cd5154e363eef178ab091fd7d55868746a4394340567a794f6c6f0295e58721a5b4ee8bf66b4cc0e6a01c3e82f9cc9de9953ae349d45738a04700
HEAD_REF master
PATCHES
fix-dependencies.patch
fix-config-cmake.patch
fix-openjpeg-linkage.patch
fix-ffmpeg-tool.patch
fix-static-ffmpeg.patch
fix-openexr-dll.patch
imath-version-guard.patch
)
file(REMOVE_RECURSE "${SOURCE_PATH}/ext")
file(REMOVE "${SOURCE_PATH}/src/cmake/modules/FindLibRaw.cmake"
file(REMOVE
"${SOURCE_PATH}/src/cmake/modules/FindFFmpeg.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindLibheif.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindLibRaw.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindLibsquish.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindOpenCV.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindFFmpeg.cmake")
file(MAKE_DIRECTORY "${SOURCE_PATH}/ext/robin-map/tsl")
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LINKSTATIC)
"${SOURCE_PATH}/src/cmake/modules/FindOpenJPEG.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindWebP.cmake"
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
@ -33,22 +35,23 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
webp USE_WEBP
pybind11 USE_PYTHON
tools OIIO_BUILD_TOOLS
tools USE_OPENGL
tools USE_QT
tools USE_QT5
)
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path("${PYTHON3_DIR}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DOIIO_BUILD_TESTS=OFF
-DBUILD_TESTING=OFF
-DUSE_DCMTK=OFF
-DUSE_NUKE=OFF
-DUSE_QT=OFF
-DUSE_OpenVDB=OFF
-DUSE_PTEX=OFF
-DLINKSTATIC=${LINKSTATIC}
-DUSE_TBB=OFF
-DLINKSTATIC=OFF # LINKSTATIC breaks library lookup
-DBUILD_MISSING_FMT=OFF
-DBUILD_MISSING_ROBINMAP=OFF
-DBUILD_MISSING_DEPS=OFF
@ -56,13 +59,14 @@ vcpkg_cmake_configure(
-DVERBOSE=ON
-DBUILD_DOCS=OFF
-DINSTALL_DOCS=OFF
"-DREQUIRED_DEPS=fmt;JPEG;Libheif;Libsquish;PNG;Robinmap"
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME OpenImageIO CONFIG_PATH lib/cmake/OpenImageIO)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/OpenImageIO)
if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(
@ -72,11 +76,19 @@ if("tools" IN_LIST FEATURES)
endif()
# Clean
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/doc"
"${CURRENT_PACKAGES_DIR}/debug/doc"
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/doc"
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share")
vcpkg_fixup_pkgconfig()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(READ "${SOURCE_PATH}/THIRD-PARTY.md" third_party)
string(REGEX REPLACE
"^.*The remainder of this file"
"\n-------------------------------------------------------------------------\n\nThe remainder of this file"
third_party
"${third_party}"
)
file(APPEND "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "${third_party}")

4
ports/openimageio/usage Normal file
View File

@ -0,0 +1,4 @@
The package openimageio provides CMake targets:
find_package(OpenImageIO CONFIG REQUIRED)
target_link_libraries(main PRIVATE OpenImageIO::OpenImageIO)

View File

@ -1,6 +1,6 @@
{
"name": "openimageio",
"version": "2.3.10.1",
"version": "2.3.17.0",
"port-version": 4,
"description": "A library for reading and writing images, and a bunch of related classes, utilities, and application.",
"homepage": "https://github.com/OpenImageIO/oiio",
@ -43,6 +43,7 @@
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avresample"
]
@ -68,7 +69,10 @@
]
},
"opencolorio": {
"description": "Enable opencolorio support for openimageio",
"description": [
"Enable opencolorio support for openimageio.",
"This feature can only be used when openexr and opencolorio use the same version of Imath."
],
"dependencies": [
"opencolorio"
]
@ -76,7 +80,10 @@
"opencv": {
"description": "Enable opencv support for openimageio",
"dependencies": [
"opencv"
{
"name": "opencv",
"default-features": false
}
]
},
"openjpeg": {
@ -95,7 +102,10 @@
"description": "Build openimageio tools",
"dependencies": [
"opengl",
"qt5-base"
{
"name": "qt5-base",
"default-features": false
}
]
},
"webp": {

View File

@ -1285,6 +1285,12 @@ vcpkg-ci-opencv:x64-windows-static-md=pass
vcpkg-ci-opencv:x64-windows-static=pass
vcpkg-ci-opencv:x64-windows=pass
vcpkg-ci-opencv:x86-windows=pass
vcpkg-ci-openimageio:x86-windows=pass
vcpkg-ci-openimageio:x64-windows=pass
vcpkg-ci-openimageio:x64-windows-static=pass
vcpkg-ci-openimageio:x64-windows-static-md=pass
vcpkg-ci-openimageio:x64-osx=pass
vcpkg-ci-openimageio:x64-linux=pass
vcpkg-ci-paraview:x64-linux=pass
vcpkg-ci-paraview:x64-osx=pass
vcpkg-ci-paraview:x64-windows-static-md=pass

View File

@ -38,7 +38,6 @@
"cuda",
"cudnn",
"gstreamer",
"halide",
"ovis",
"tbb"
],

View File

@ -0,0 +1 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

View File

@ -0,0 +1,22 @@
{
"name": "vcpkg-ci-openimageio",
"version": "1",
"description": "OpenImageIO features testing within CI.",
"license": "MIT",
"dependencies": [
{
"name": "openimageio",
"features": [
"ffmpeg",
"freetype",
"gif",
"libraw",
"opencv",
"openjpeg",
"pybind11",
"tools",
"webp"
]
}
]
}

View File

@ -3702,7 +3702,7 @@
},
"libheif": {
"baseline": "1.12.0",
"port-version": 3
"port-version": 4
},
"libhsplasma": {
"baseline": "2022-05-19",
@ -5217,7 +5217,7 @@
"port-version": 2
},
"openimageio": {
"baseline": "2.3.10.1",
"baseline": "2.3.17.0",
"port-version": 4
},
"openjpeg": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f183481e325abb8be75988c2061260ebf60ad7d4",
"version": "1.12.0",
"port-version": 4
},
{
"git-tree": "9638a1f823a06ad68484b408f5640ac2204b5262",
"version": "1.12.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4317b62fd8bf1e11d9da42132ecfdf1ccb03a8af",
"version": "2.3.17.0",
"port-version": 4
},
{
"git-tree": "4c60e9a4adf07bdd6ff8bf766f295af17d8a0818",
"version": "2.3.10.1",