From 1a8cb62b8ce5077c99054c1f5a3236e12694e1c7 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 21 Jul 2017 05:26:40 +0200 Subject: cmake: Add 'dist' target to create Windows binary archive - 'dist-win-7z' allows to create a binary distribution archive compressed with 7z format - 'dist-win-7z-fast' has slightly worse compression but is considerably faster --- CMakeScripts/Dist.cmake | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'CMakeScripts') diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake index 21d233d87..061e187af 100644 --- a/CMakeScripts/Dist.cmake +++ b/CMakeScripts/Dist.cmake @@ -22,3 +22,41 @@ add_custom_target(dist COMMAND git checkout ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake # duplicate to make sure we actually revert in case of error WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" VERBATIM) + + + +# ----------------------------------------------------------------------------- +# 'dist-win' - Windows Targets +# ----------------------------------------------------------------------------- +if(WIN32) + if(HAVE_MINGW64) + set(bitness "x64") + else() + set(bitness "x86") + endif() + set(INKSCAPE_DIST_PREFIX ${INKSCAPE_DIST_PREFIX}-${bitness}) + + # ----------------------------------------------------------------------------- + # 'dist-win-7z' - generate binary 7z archive for Windows + # ----------------------------------------------------------------------------- + + find_program(7z 7z PATHS "C:\\Program Files\\7-Zip" + "C:\\Program Files (x86)\\7-Zip") + if(NOT 7z) + set(7z echo "Could not find '7z'. Please add it to your search path." && exit 1 &&) + endif() + + # default target with very good but slow compression (needs approx. 10 GB RAM) + add_custom_target(dist-win-7z + COMMAND ${7z} a -mx9 -md512m -mfb256 + "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" + "${CMAKE_INSTALL_PREFIX}") + + # fast target with moderate compression + add_custom_target(dist-win-7z-fast + COMMAND ${7z} a + "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" + "${CMAKE_INSTALL_PREFIX}") + + add_dependencies(dist-win-7z install/strip) + add_dependencies(dist-win-7z-fast install/strip) -- cgit v1.2.3