Fix compressed format support on GME when using miniz

This commit is contained in:
Cacodemon345 2023-09-25 04:17:47 +06:00 committed by Christoph Oelckers
parent 33de9d93fc
commit 26c889088d
4 changed files with 17 additions and 11 deletions

View file

@ -1,3 +1,4 @@
add_subdirectory(miniz)
# GME is not currently released in a way that's conducive to using as a system
# library. Nevertheless at least one person tried, and so the ability to use a
# system copy exists soley to placate people following distro guidelines to the
@ -19,7 +20,6 @@
add_subdirectory(game-music-emu)
#endif()
add_subdirectory(miniz)
add_subdirectory(dumb)
add_subdirectory(adlmidi)
add_subdirectory(opnmidi)

View file

@ -21,7 +21,8 @@ if(NOT BUILD_SHARED_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
endif()
find_package(ZLIB QUIET)
# [ZMusic] We use miniz now.
# find_package(ZLIB QUIET)
# Ay_Apu is very popular around here
if (USE_GME_AY OR USE_GME_KSS)
@ -165,17 +166,20 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
# Add library to be compiled.
add_library(gme OBJECT ${libgme_SRCS})
if(ZLIB_FOUND)
message(" ** ZLib library located, compressed file formats will be supported")
# Commented our since we use miniz
#if(ZLIB_FOUND)
# message(" ** ZLib library located, compressed file formats will be supported")
target_compile_definitions(gme PRIVATE -DHAVE_ZLIB_H)
target_link_libraries(gme PRIVATE miniz)
# [ZMusic] Switch to modern target for better transitive handling.
target_link_libraries(gme PRIVATE ZLIB::ZLIB)
# target_link_libraries(gme PRIVATE ZLIB::ZLIB)
# Is not to be installed though
set(PKG_CONFIG_ZLIB -lz) # evaluated in libgme.pc.in
else()
message("ZLib library not found, disabling support for compressed formats such as VGZ")
endif()
# set(PKG_CONFIG_ZLIB -lz) # evaluated in libgme.pc.in
#else()
# message("ZLib library not found, disabling support for compressed formats such as VGZ")
#endif()
# [ZMusic] Interface include directories
target_include_directories(gme INTERFACE ..)

View file

@ -21,7 +21,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#include "blargg_source.h"
#ifdef HAVE_ZLIB_H
#include <zlib.h>
// [ZMusic] Use miniz.
#include <miniz.h>
#include <stdlib.h>
#include <errno.h>
static const unsigned char gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */

View file

@ -7,7 +7,8 @@
#include "blargg_common.h"
#ifdef HAVE_ZLIB_H
#include <zlib.h>
// [ZMusic] Use miniz.
#include <miniz.h>
#endif
// Supports reading and finding out how many bytes are remaining