Skip to content

Commit

Permalink
Switch to miniz from zlib
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 authored and coelckers committed Sep 17, 2023
1 parent 576b7da commit b5bd930
Show file tree
Hide file tree
Showing 39 changed files with 9,267 additions and 14,811 deletions.
2 changes: 1 addition & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ if(WIN32)
)
endif()

target_link_libraries(zmusic-obj INTERFACE dumb gme ZLIB::ZLIB ${CMAKE_DL_LIBS})
target_link_libraries(zmusic-obj INTERFACE dumb gme miniz ${CMAKE_DL_LIBS})

target_include_directories(zmusic-obj
INTERFACE
Expand Down
2 changes: 1 addition & 1 deletion source/zmusic/zmusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <stdint.h>
#include <vector>
#include <string>
#include <zlib.h>
#include <miniz.h>
#include "m_swap.h"
#include "zmusic_internal.h"
#include "midiconfig.h"
Expand Down
20 changes: 1 addition & 19 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
if(NOT TARGET ZLIB::ZLIB)
option(FORCE_INTERNAL_ZLIB "Use internal zlib" OFF)
find_package(ZLIB QUIET)
if(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)
message(STATUS "Using system zlib, includes found at ${ZLIB_INCLUDE_DIRS}")
set_property(TARGET ZLIB::ZLIB PROPERTY IMPORTED_GLOBAL TRUE)
determine_package_config_dependency(ZMUSIC_PACKAGE_DEPENDENCIES TARGET ZLIB::ZLIB MODULE ZLIB)
else()
message(STATUS "Using internal zlib")
set(SKIP_INSTALL_ALL TRUE) # Avoid installing zlib alongside ZMusic
add_subdirectory(zlib)
add_library(ZLIB::ZLIB ALIAS z)

# Setup variables for GME's CMakeLists
set(ZLIB_LIBRARY ZLIB::ZLIB)
get_property(ZLIB_INCLUDE_DIR TARGET ZLIB::ZLIB PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif()
endif()

# 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
Expand All @@ -38,6 +19,7 @@ endif()
add_subdirectory(game-music-emu)
#endif()

add_subdirectory(miniz)
add_subdirectory(dumb)
add_subdirectory(adlmidi)
add_subdirectory(opnmidi)
Expand Down
9 changes: 9 additions & 0 deletions thirdparty/miniz/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
make_release_only()

if (MSVC)
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244" )
endif()

add_library( miniz miniz.c )
target_compile_definitions( miniz PRIVATE -DMINIZ_NO_STDIO )
target_include_directories( miniz INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" )
Loading

0 comments on commit b5bd930

Please sign in to comment.