From fadb57e4cdfd1a83de227eaa33899dc68f471136 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Thu, 19 Jun 2014 18:27:08 +0900 Subject: [PATCH] Added a Windows-friendly build option ZLIB_SOURCE. --- CMakeLists.txt | 5 +++++ ConfigureChecks.cmake | 1 - INSTALL | 1 + taglib/CMakeLists.txt | 18 ++++++++++++++++-- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a27b2f6e..02eb9893 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,11 @@ if(NOT WIN32 AND NOT BUILD_FRAMEWORK) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) endif() +if(NOT HAVE_ZLIB AND ZLIB_SOURCE) + set(HAVE_ZLIB 1) + set(HAVE_ZLIB_SOURCE 1) +endif() + include_directories(${CMAKE_CURRENT_BINARY_DIR}) configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index b0f164a9..1df69f95 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -216,7 +216,6 @@ else() set(HAVE_ZLIB 0) endif() - set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) find_package(CppUnit) diff --git a/INSTALL b/INSTALL index 5e36d30c..0f905006 100644 --- a/INSTALL +++ b/INSTALL @@ -72,6 +72,7 @@ Useful configuration options used with CMake (GUI and/or Command line): Assumes parent of: \include and \lib. ZLIB_INCLUDE_DIR= Where to find ZLib's Include directory. ZLIB_LIBRARY= Where to find ZLib's Library. + ZLIB_SOURCE= Where to find ZLib's source code. CMAKE_INSTALL_PREFIX= Where to install Taglib. CMAKE_BUILD_TYPE= Release, Debug, etc ... (Not available in MSVC) diff --git a/taglib/CMakeLists.txt b/taglib/CMakeLists.txt index 89cb8e12..0325ea94 100644 --- a/taglib/CMakeLists.txt +++ b/taglib/CMakeLists.txt @@ -28,6 +28,8 @@ include_directories( if(ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIR}) +elseif(HAVE_ZLIB_SOURCE) + include_directories(${ZLIB_SOURCE}) endif() set(tag_HDRS @@ -300,6 +302,18 @@ set(toolkit_SRCS toolkit/unicode.cpp ) +if(HAVE_ZLIB_SOURCE) + set(zlib_SRCS + ${ZLIB_SOURCE}/adler32.c + ${ZLIB_SOURCE}/crc32.c + ${ZLIB_SOURCE}/inffast.c + ${ZLIB_SOURCE}/inflate.c + ${ZLIB_SOURCE}/inftrees.c + ${ZLIB_SOURCE}/uncompr.c + ${ZLIB_SOURCE}/zutil.c + ) +endif() + set(tag_LIB_SRCS ${mpeg_SRCS} ${id3v1_SRCS} ${id3v2_SRCS} ${frames_SRCS} ${ogg_SRCS} ${vorbis_SRCS} ${oggflacs_SRCS} ${mpc_SRCS} ${ape_SRCS} ${toolkit_SRCS} ${flacs_SRCS} @@ -311,10 +325,10 @@ set(tag_LIB_SRCS audioproperties.cpp ) -add_library(tag ${tag_LIB_SRCS} ${tag_HDRS}) +add_library(tag ${tag_LIB_SRCS} ${zlib_SRCS} ${tag_HDRS}) if(ZLIB_FOUND) - target_link_libraries(tag ${ZLIB_LIBRARIES}) + target_link_libraries(tag ${ZLIB_LIBRARIES}) endif() set_target_properties(tag PROPERTIES