Skip to content

Commit

Permalink
Improve compatibility with minizip-ng COMPAT mode (#1902)
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi Achard <remiachard@gmail.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
  • Loading branch information
remia and doug-walker committed Nov 15, 2023
1 parent 9078753 commit ffd0f70
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
17 changes: 16 additions & 1 deletion share/cmake/modules/Findminizip-ng.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# minizip-ng_LIBRARY - minizip-ng library to link to
# minizip-ng_INCLUDE_DIR - Where to find mz.h and other headers
# minizip-ng_VERSION - The version of the library
# minizip-ng_COMPAT - Whether minizip-ng MZ_COMPAT was used or not
#
# Global targets defined by this module:
# MINIZIP::minizip-ng - IMPORTED target, if found
Expand Down Expand Up @@ -114,7 +115,9 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
PATH_SUFFIXES
include
include/minizip-ng
include/minizip
minizip-ng/include
minizip/include
)

# Minizip-ng uses prefix "lib" on all platform by default.
Expand Down Expand Up @@ -202,4 +205,16 @@ if(_minizip-ng_TARGET_CREATE)
mark_as_advanced(minizip-ng_INCLUDE_DIR minizip-ng_LIBRARY minizip-ng_VERSION)

target_link_libraries(MINIZIP::minizip-ng INTERFACE ZLIB::ZLIB)
endif()
endif()

###############################################################################
### Detect compatibility mode ###

set(minizip-ng_COMPAT FALSE)
if(minizip-ng_INCLUDE_DIR)
list(GET minizip-ng_INCLUDE_DIR 0 _minizip-ng_INCLUDE_DIR)
if(EXISTS "${_minizip-ng_INCLUDE_DIR}/mz_compat.h")
set(minizip-ng_COMPAT TRUE)
endif()
endif()
mark_as_advanced(minizip-ng_COMPAT)
2 changes: 1 addition & 1 deletion src/OpenColorIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ elseif(APPLE)


# Check for minizip first since our Findminizip module sets minizip-ng_LIBRARY.
if (minizip_LIBRARY)
if (minizip_LIBRARY OR minizip-ng_COMPAT)
get_filename_component(_minizip-ng_LIBDIR "${minizip_LIBRARY}" DIRECTORY)
set(_minizip-ng_NAME "minizip")
elseif(minizip-ng_LIBRARY)
Expand Down
1 change: 0 additions & 1 deletion src/OpenColorIO/OCIOZArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "mz_strm_mem.h"
#include "mz_strm_os.h"
#include "mz_strm_split.h"
#include "mz_strm_zlib.h"
#include "mz_zip.h"
#include "mz_zip_rw.h"

Expand Down

0 comments on commit ffd0f70

Please sign in to comment.