1
0
Эх сурвалжийг харах

CPack: Add parallel zstd compression

Russell Greene 3 жил өмнө
parent
commit
525faec4e9

+ 6 - 0
Help/release/dev/cpack-zstd-parallel.rst

@@ -0,0 +1,6 @@
+cpack-zstd-parallel
+-------------------
+
+* CPack now supports the :variable:`CPACK_THREADS` option for ``zstd``
+  compression when compiled with libarchive 3.6 or higher.  It is
+  supported by official CMake binaries available on ``cmake.org``.

+ 6 - 0
Modules/CPack.cmake

@@ -316,6 +316,12 @@ installers.  The most commonly-used variables are:
       with a ``liblzma`` that supports parallel compression.
       Older versions did not.
 
+  ``zstd``
+    .. versionadded:: 3.24
+
+    Supported if CMake is built with libarchive 3.6 or higher.
+    Official CMake binaries available on ``cmake.org`` support it.
+
   Other compression methods ignore this value and use only one thread.
 
 Variables for Source Package Generators

+ 9 - 0
Source/cmArchiveWrite.cxx

@@ -188,6 +188,15 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c,
                                cm_archive_error_string(this->Archive));
         return;
       }
+
+#if ARCHIVE_VERSION_NUMBER >= 3006000
+      if (archive_write_set_filter_option(this->Archive, "zstd", "threads",
+                                          sNumThreads.c_str()) != ARCHIVE_OK) {
+        this->Error = cmStrCat("archive_compressor_zstd_options: ",
+                               cm_archive_error_string(this->Archive));
+        return;
+      }
+#endif
       break;
   }