From fadb57e4cdfd1a83de227eaa33899dc68f471136 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Thu, 19 Jun 2014 18:27:08 +0900 Subject: [PATCH 1/3] 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 From 5feabe0988d342857acb3e481d5ae1268521bc6a Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Fri, 20 Jun 2014 10:36:09 +0900 Subject: [PATCH 2/3] Updated INSTALL. --- INSTALL | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/INSTALL b/INSTALL index 0f905006..205b4d31 100644 --- a/INSTALL +++ b/INSTALL @@ -72,7 +72,8 @@ 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. + ZLIB_SOURCE= Where to find ZLib's Source Code. + Alternative to ZLIB_INCLUDE_DIR and ZLIB_LIBRARY. CMAKE_INSTALL_PREFIX= Where to install Taglib. CMAKE_BUILD_TYPE= Release, Debug, etc ... (Not available in MSVC) From 5f738a9819357bc17867cfe053e205d24bebc85a Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Wed, 9 Jul 2014 09:52:08 +0900 Subject: [PATCH 3/3] Changed to skip the ZLib check when ZLIB_SOURCE is set. --- ConfigureChecks.cmake | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 1df69f95..f2d4cae0 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -209,13 +209,14 @@ check_cxx_source_compiles(" # Check for libz using the cmake supplied FindZLIB.cmake -find_package(ZLIB) -if(ZLIB_FOUND) - set(HAVE_ZLIB 1) -else() - set(HAVE_ZLIB 0) +if(NOT ZLIB_SOURCE) + find_package(ZLIB) + if(ZLIB_FOUND) + set(HAVE_ZLIB 1) + else() + set(HAVE_ZLIB 0) + endif() endif() - set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) find_package(CppUnit)