vcpkg/ports/openimageio/fix-dependencies.patch
Jack·Boos·Yu a6768f6426
[openimageio/libsquish] Export libsquish cmake target and fix find dependency libsquish (#20240)
* [libsquish] Export cmake target

* [openimageio] Fix find dependency libsquish

* version

* Rename the target

* Re-fix dependency libsquish, apply official changes

* version stuff

* more version

* Change namespace

* Update patch

* version

* Remove unused patch

* version

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2021-10-11 10:22:36 -07:00

157 lines
6.3 KiB
Diff

diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
index 740da06..a34d4c9 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 ()
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index 957abe3..2c093dd 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.
-checked_find_package (PNG)
+checked_find_package (png PREFER_CONFIG)
checked_find_package (BZip2) # Used by ffmpeg and freetype
if (NOT BZIP2_FOUND)
@@ -158,8 +158,6 @@ endif ()
checked_find_package (Freetype
DEFINITIONS -DUSE_FREETYPE=1 )
-checked_find_package (HDF5
- ISDEPOF Field3D)
checked_find_package (OpenColorIO
DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1
# PREFER_CONFIG
@@ -176,15 +174,15 @@ checked_find_package (TBB 2017
checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images
checked_find_package (FFmpeg VERSION_MIN 3.0)
checked_find_package (Field3D
- DEPS HDF5
- DEFINITIONS -DUSE_FIELD3D=1)
+ DEFINITIONS -DUSE_FIELD3D=1)
checked_find_package (GIF
VERSION_MIN 4
RECOMMEND_MIN 5.0
RECOMMEND_MIN_REASON "for stability and thread safety")
# For HEIF/HEIC/AVIF formats
-checked_find_package (Libheif VERSION_MIN 1.3
+checked_find_package (libheif VERSION_MIN 1.3
+ PREFER_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)
@@ -291,7 +289,8 @@ 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)
endif ()
diff --git a/src/dds.imageio/CMakeLists.txt b/src/dds.imageio/CMakeLists.txt
index d693453..9bef055 100644
--- a/src/dds.imageio/CMakeLists.txt
+++ b/src/dds.imageio/CMakeLists.txt
@@ -5,7 +5,7 @@
if (Libsquish_FOUND)
# External libsquish was found -- use it
add_oiio_plugin (ddsinput.cpp
- LINK_LIBRARIES Libsquish::Libsquish
+ LINK_LIBRARIES unofficial::libsquish::squish
)
else ()
# No external libsquish was found -- use the embedded version.
diff --git a/src/field3d.imageio/CMakeLists.txt b/src/field3d.imageio/CMakeLists.txt
index a9e54e3..cc73ac4 100644
--- a/src/field3d.imageio/CMakeLists.txt
+++ b/src/field3d.imageio/CMakeLists.txt
@@ -9,7 +9,7 @@ if (Field3D_FOUND)
endif ()
add_oiio_plugin (field3dinput.cpp field3doutput.cpp
INCLUDE_DIRS ${FIELD3D_INCLUDES}
- LINK_LIBRARIES Field3D::Field3D
+ LINK_LIBRARIES ${FIELD3D_LIBRARIES}
# ${HDF5_LIBRARIES}
${SZIP_LIBRARY})
endif()
diff --git a/src/heif.imageio/CMakeLists.txt b/src/heif.imageio/CMakeLists.txt
index fed8001..15e87ae 100644
--- a/src/heif.imageio/CMakeLists.txt
+++ b/src/heif.imageio/CMakeLists.txt
@@ -2,9 +2,9 @@
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
-if (Libheif_FOUND)
+if (libheif_FOUND)
add_oiio_plugin (heifinput.cpp heifoutput.cpp
- LINK_LIBRARIES Libheif::Libheif
+ LINK_LIBRARIES heif
DEFINITIONS "-DUSE_HEIF=1")
else ()
message (WARNING "heif plugin will not be built")
diff --git a/src/ico.imageio/CMakeLists.txt b/src/ico.imageio/CMakeLists.txt
index 9ba76ac..13db4ac 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/blob/master/LICENSE.md
-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)
diff --git a/src/openvdb.imageio/CMakeLists.txt b/src/openvdb.imageio/CMakeLists.txt
index 57a0f62..3a07c31 100644
--- a/src/openvdb.imageio/CMakeLists.txt
+++ b/src/openvdb.imageio/CMakeLists.txt
@@ -4,6 +4,6 @@
if (OpenVDB_FOUND)
add_oiio_plugin (openvdbinput.cpp
- INCLUDE_DIRS ${TBB_INCLUDE_DIRS}
- LINK_LIBRARIES OpenVDB::OpenVDB ${TBB_tbb_LIBRARY} ${BOOST_LIBRARIES})
+ INCLUDE_DIRS ${OPENVDB_INCLUDES} ${TBB_INCLUDE_DIRS}
+ LINK_LIBRARIES ${OPENVDB_LIBRARIES} ${TBB_tbb_LIBRARY} ${BOOST_LIBRARIES})
endif()
diff --git a/src/webp.imageio/CMakeLists.txt b/src/webp.imageio/CMakeLists.txt
index 44462c4..e1cb068 100644
--- a/src/webp.imageio/CMakeLists.txt
+++ b/src/webp.imageio/CMakeLists.txt
@@ -4,7 +4,8 @@
if (WebP_FOUND)
add_oiio_plugin (webpinput.cpp webpoutput.cpp
- LINK_LIBRARIES WebP::WebP WebP::WebPDemux
+ INCLUDE_DIRS ${WEBP_INCLUDES}
+ LINK_LIBRARIES ${WEBP_LIBRARIES}
DEFINITIONS "-DUSE_WEBP=1")
else ()
message (STATUS "WebP plugin will not be built")