Skip to content

Commit

Permalink
[openimageio/libsquish] Export libsquish cmake target and fix find de…
Browse files Browse the repository at this point in the history
…pendency 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>
  • Loading branch information
JackBoosY and BillyONeal committed Oct 11, 2021
1 parent 822eb4b commit a6768f6
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 19 deletions.
19 changes: 19 additions & 0 deletions ports/libsquish/export-target.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3ecdde..94c7b3d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,8 +120,14 @@ INCLUDE(GNUInstallDirs)

INSTALL(
TARGETS squish
+ EXPORT unofficial-libsquishConfig
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
+
+INSTALL(EXPORT unofficial-libsquishConfig
+ NAMESPACE unofficial::libsquish::
+ DESTINATION share/unofficial-libsquish
+)
15 changes: 9 additions & 6 deletions ports/libsquish/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ vcpkg_from_sourceforge(
FILENAME "libsquish-1.15.tgz"
NO_REMOVE_ONE_LEVEL
SHA512 5b569b7023874c7a43063107e2e428ea19e6eb00de045a4a13fafe852ed5402093db4b65d540b5971ec2be0d21cb97dfad9161ebfe6cf6e5376174ff6c6c3e7a
PATCHES fix-export-symbols.patch
PATCHES
fix-export-symbols.patch
export-target.patch
)

vcpkg_configure_cmake(
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
)

vcpkg_install_cmake()
vcpkg_cmake_install()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-libsquish CONFIG_PATH share/unofficial-libsquish)

file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")

file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
14 changes: 12 additions & 2 deletions ports/libsquish/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{
"name": "libsquish",
"version-string": "1.15",
"port-version": 8,
"port-version": 9,
"description": "Open source DXT compression library.",
"homepage": "https://sourceforge.net/projects/libsquish"
"homepage": "https://sourceforge.net/projects/libsquish",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
95 changes: 88 additions & 7 deletions ports/openimageio/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
index 740da06..1a326f7 100644
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)
+ find_dependency(libheif CONFIG)
+ find_dependency(Libsquish)
+ 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 21e18b5..badee4b 100644
index 957abe3..2c093dd 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -151,7 +151,7 @@ find_python()
@@ -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.

Expand All @@ -25,7 +25,25 @@ index 21e18b5..badee4b 100644

checked_find_package (BZip2) # Used by ffmpeg and freetype
if (NOT BZIP2_FOUND)
@@ -185,7 +185,8 @@ checked_find_package (GIF
@@ -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
Expand All @@ -35,6 +53,42 @@ index 21e18b5..badee4b 100644
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
Expand Down Expand Up @@ -73,3 +127,30 @@ index 9ba76ac..13db4ac 100644
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")
1 change: 0 additions & 1 deletion ports/openimageio/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/doc"
"${CURRENT_PACKAGES_DIR}/debug/share")

file(COPY "${SOURCE_PATH}/src/cmake/modules/FindOpenImageIO.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/OpenImageIO")
file(COPY "${SOURCE_PATH}/src/cmake/modules/FindLibsquish.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/OpenImageIO")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

# Handle copyright
Expand Down
2 changes: 1 addition & 1 deletion ports/openimageio/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "openimageio",
"version": "2.3.7.2",
"port-version": 2,
"port-version": 3,
"description": "A library for reading and writing images, and a bunch of related classes, utilities, and application.",
"homepage": "https://github.com/OpenImageIO/oiio",
"dependencies": [
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3810,7 +3810,7 @@
},
"libsquish": {
"baseline": "1.15",
"port-version": 8
"port-version": 9
},
"libsrt": {
"baseline": "1.3.4",
Expand Down Expand Up @@ -4854,7 +4854,7 @@
},
"openimageio": {
"baseline": "2.3.7.2",
"port-version": 2
"port-version": 3
},
"openjpeg": {
"baseline": "2.4.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libsquish.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "97da7fd0b127d2b07821950e5aee7acadbcd9d17",
"version-string": "1.15",
"port-version": 9
},
{
"git-tree": "9e7c8060fb2b0499a31df98ef1e8652081e18944",
"version-string": "1.15",
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": "a7643bd1ea5b962a2b98a9c6c991a15021fab17d",
"version": "2.3.7.2",
"port-version": 3
},
{
"git-tree": "6084a6398514fc24fd450a7b9290937b1274d7b6",
"version": "2.3.7.2",
Expand Down

0 comments on commit a6768f6

Please sign in to comment.