Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to miniz from zlib #50

Merged
merged 2 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 OBJECT miniz.c )
target_compile_definitions( miniz PRIVATE -DMINIZ_NO_STDIO )
target_include_directories( miniz INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" )
Loading