From db2951c8c3a777f323d4d1621d44456c6e5c4190 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 24 Mar 2021 15:40:41 +0100 Subject: [PATCH] Fix patching for ZLIB --- deps/CMakeLists.txt | 3 ++ .../ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch | 38 +++++++++---------- deps/ZLIB/ZLIB.cmake | 3 +- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index f1ad67478..3ce6b88a9 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -52,6 +52,9 @@ message(STATUS "PrusaSlicer deps debug build: ${DEP_DEBUG}") find_package(Git REQUIRED) +# The default command line for patching. Only works for newer +set(PATCH_CMD ${GIT_EXECUTABLE} apply --verbose --ignore-space-change --whitespace=fix) + get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) function(prusaslicer_add_cmake_project projectname) diff --git a/deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch b/deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch index e65ec0e65..f176ce287 100644 --- a/deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch +++ b/deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch @@ -1,17 +1,8 @@ -From 0c64e33bc2e4e7c011f5a64f5d9c7571a434cc86 Mon Sep 17 00:00:00 2001 -From: tamasmeszaros -Date: Sat, 16 Nov 2019 13:43:17 +0100 -Subject: [PATCH] Respect BUILD_SHARED_LIBS - ---- - CMakeLists.txt | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0fe939d..01dfea1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -183,10 +183,12 @@ if(MINGW) +Common subdirectories: ../zlib-1.2.11/amiga and ./amiga +diff -u ../zlib-1.2.11/CMakeLists.txt ./CMakeLists.txt +--- ../zlib-1.2.11/CMakeLists.txt 2017-01-15 09:29:40.000000000 +0100 ++++ ./CMakeLists.txt 2021-03-24 15:24:48.190291072 +0100 +@@ -183,10 +183,12 @@ set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) endif(MINGW) @@ -28,7 +19,7 @@ index 0fe939d..01dfea1 100644 if(NOT CYGWIN) # This property causes shared libraries on Linux to have the full version -@@ -201,7 +203,7 @@ endif() +@@ -201,7 +203,7 @@ if(UNIX) # On unix-like platforms the library is almost always called libz @@ -37,7 +28,7 @@ index 0fe939d..01dfea1 100644 if(NOT APPLE) set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") endif() -@@ -211,7 +213,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32) +@@ -211,7 +213,7 @@ endif() if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) @@ -46,6 +37,15 @@ index 0fe939d..01dfea1 100644 RUNTIME DESTINATION "${INSTALL_BIN_DIR}" ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) --- -2.16.2.windows.1 - +Common subdirectories: ../zlib-1.2.11/contrib and ./contrib +Common subdirectories: ../zlib-1.2.11/doc and ./doc +Common subdirectories: ../zlib-1.2.11/examples and ./examples +Common subdirectories: ../zlib-1.2.11/msdos and ./msdos +Common subdirectories: ../zlib-1.2.11/nintendods and ./nintendods +Common subdirectories: ../zlib-1.2.11/old and ./old +Common subdirectories: ../zlib-1.2.11/os400 and ./os400 +Common subdirectories: ../zlib-1.2.11/qnx and ./qnx +Common subdirectories: ../zlib-1.2.11/test and ./test +Common subdirectories: ../zlib-1.2.11/watcom and ./watcom +Common subdirectories: ../zlib-1.2.11/win32 and ./win32 +Only in ./: ZLIB.patch diff --git a/deps/ZLIB/ZLIB.cmake b/deps/ZLIB/ZLIB.cmake index 06f944081..916f3318b 100644 --- a/deps/ZLIB/ZLIB.cmake +++ b/deps/ZLIB/ZLIB.cmake @@ -3,8 +3,7 @@ prusaslicer_add_cmake_project(ZLIB # GIT_TAG v1.2.11 URL https://github.com/madler/zlib/archive/refs/tags/v1.2.11.zip URL_HASH SHA256=f5cc4ab910db99b2bdbba39ebbdc225ffc2aa04b4057bc2817f1b94b6978cfc3 - PATCH_COMMAND #${GIT_EXECUTABLE} checkout -f -- . && git clean -df && - ${GIT_EXECUTABLE} apply --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-Respect-BUILD_SHARED_LIBS.patch + PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-Respect-BUILD_SHARED_LIBS.patch CMAKE_ARGS -DSKIP_INSTALL_FILES=ON # Prevent installation of man pages et al. -DCMAKE_POSITION_INDEPENDENT_CODE=ON