diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2017-07-28 22:05:28 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2017-07-28 22:05:28 +0000 |
| commit | 3eb67b103fe69a3b42ec16d085a2cb3a58a596b7 (patch) | |
| tree | 986b33696b0a7f229589b85bd13e6fdb2cbd022a /CMakeScripts | |
| parent | fix typo, update CI (diff) | |
| parent | Show a control point for the center of a spiral (diff) | |
| download | inkscape-3eb67b103fe69a3b42ec16d085a2cb3a58a596b7.tar.gz inkscape-3eb67b103fe69a3b42ec16d085a2cb3a58a596b7.zip | |
Merge gitlab.com:inkscape/inkscape
Diffstat (limited to 'CMakeScripts')
| -rw-r--r-- | CMakeScripts/Dist.cmake | 140 | ||||
| -rw-r--r-- | CMakeScripts/InstallMSYS2.cmake | 16 | ||||
| -rw-r--r-- | CMakeScripts/inkscape-version.cmake | 11 |
3 files changed, 156 insertions, 11 deletions
diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake new file mode 100644 index 000000000..9b40d36c8 --- /dev/null +++ b/CMakeScripts/Dist.cmake @@ -0,0 +1,140 @@ +# dist targets for various platforms + +set(INKSCAPE_DIST_PREFIX "${PROJECT_NAME}-${INKSCAPE_VERSION}") + +# get INKSCAPE_REVISION of the source +set(INKSCAPE_SOURCE_DIR ${CMAKE_SOURCE_DIR}) +include(CMakeScripts/inkscape-version.cmake) + + + +# ----------------------------------------------------------------------------- +# 'dist' - generate source release tarball +# ----------------------------------------------------------------------------- + +add_custom_target(dist + COMMAND sed -i "s/unknown/${INKSCAPE_REVISION}/" CMakeScripts/inkscape-version.cmake + && tar cfz ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.tar.gz ${CMAKE_SOURCE_DIR}/doc --exclude=".*" --exclude-vcs-ignores + || git checkout ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake + 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(INKSCAPE_REVISION_DATE AND INKSCAPE_REVISION_HASH) + set(INKSCAPE_DIST_PREFIX ${INKSCAPE_DIST_PREFIX}_${INKSCAPE_REVISION_DATE}_${INKSCAPE_REVISION_HASH}) + endif() + 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 ${CMAKE_COMMAND} -E remove "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.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 ${CMAKE_COMMAND} -E remove "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" + 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) + + # ----------------------------------------------------------------------------- + # 'dist-win-exe' - generate .exe installer (NSIS) for Windows + # ----------------------------------------------------------------------------- + find_program (makensis makensis PATHS "C:/Program Files/NSIS" + "C:/Program Files (x86)/NSIS") + if(NOT makensis) + set(makensis echo "Could not find 'makensis'. Please add it to your search path." && exit 1 &&) + endif() + + # default target with good but slow compression + add_custom_target(dist-win-exe + COMMAND ${makensis} /D"INKSCAPE_DIST_DIR=${CMAKE_INSTALL_PREFIX}" + /D"OutFile=${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.exe" + "${CMAKE_SOURCE_DIR}/packaging/win32/inkscape.nsi") + + # fast target with low compression for testing + add_custom_target(dist-win-exe-fast + COMMAND ${makensis} /X"SetCompressor /FINAL /SOLID bzip2" + /D"INKSCAPE_DIST_DIR=${CMAKE_INSTALL_PREFIX}" + /D"OutFile=${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.exe" + "${CMAKE_SOURCE_DIR}/packaging/win32/inkscape.nsi") + + add_dependencies(dist-win-exe install/strip) + add_dependencies(dist-win-exe-fast install/strip) + + # ----------------------------------------------------------------------------- + # 'dist-win-msi' - generate .exe installer (NSIS) for Windows + # ----------------------------------------------------------------------------- + file(GLOB wix_dirs "C:/Program Files/WiX Toolset*/bin") + file(GLOB wix_dirs_x86 "C:/Program Files (x86)/WiX Toolset*/bin") + find_program (candle candle PATHS ${wix_dirs} ${wix_dirs_x86}) + find_program (light light PATHS ${wix_dirs} ${wix_dirs_x86}) + if(NOT candle) + set(candle echo "Could not find 'candle' (part of WiX Toolset). Please add it to your search path." && exit 1 &&) + endif() + if(NOT light) + set(light echo "Could not find 'light' (part of WiX Toolset). Please add it to your search path." && exit 1 &&) + endif() + + # default target with fair but slow compression + add_custom_target(dist-win-msi + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/packaging/wix ${CMAKE_BINARY_DIR}/wix + COMMAND cd wix + COMMAND ${CMAKE_COMMAND} -E env INKSCAPE_DIST_PATH=${CMAKE_INSTALL_PREFIX} + python ${CMAKE_SOURCE_DIR}/packaging/wix/files.py + COMMAND ${CMAKE_COMMAND} -E env INKSCAPE_DIST_PATH=${CMAKE_INSTALL_PREFIX} + python ${CMAKE_SOURCE_DIR}/packaging/wix/version.py + COMMAND ${candle} inkscape.wxs -ext WiXUtilExtension + COMMAND ${candle} files.wxs + COMMAND ${light} -ext WixUIExtension -ext WiXUtilExtension inkscape.wixobj files.wixobj + -o ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.msi + || echo "WiX exited with non-zero exit code (which is a known issue and usually does not prevent creation of an installer). If you can, please fix it, though!") + + # moderately fast target with no compression for testing + add_custom_target(dist-win-msi-fast + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/packaging/wix ${CMAKE_BINARY_DIR}/wix + COMMAND cd wix + COMMAND sed -i 's/CompressionLevel="high"/CompressionLevel="none"/' inkscape.wxs + COMMAND ${CMAKE_COMMAND} -E env INKSCAPE_DIST_PATH=${CMAKE_INSTALL_PREFIX} + python ${CMAKE_SOURCE_DIR}/packaging/wix/files.py + COMMAND ${CMAKE_COMMAND} -E env INKSCAPE_DIST_PATH=${CMAKE_INSTALL_PREFIX} + python ${CMAKE_SOURCE_DIR}/packaging/wix/version.py + COMMAND ${candle} inkscape.wxs -ext WiXUtilExtension + COMMAND ${candle} files.wxs + COMMAND ${light} -ext WixUIExtension -ext WiXUtilExtension inkscape.wixobj files.wixobj + -o ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.msi + || echo "WiX exited with non-zero exit code (which is a known issue and usually does not prevent creation of an installer). If you can, please fix it, though!") + + add_dependencies(dist-win-msi install/strip) + add_dependencies(dist-win-msi-fast install/strip) + + # ----------------------------------------------------------------------------- + # 'dist-win-all' - generate all 'dist' targets for Windows + # ----------------------------------------------------------------------------- + add_custom_target(dist-win-all DEPENDS dist-win-7z dist-win-exe dist-win-msi) +endif() diff --git a/CMakeScripts/InstallMSYS2.cmake b/CMakeScripts/InstallMSYS2.cmake index 3bad4b839..5ad3b9d3e 100644 --- a/CMakeScripts/InstallMSYS2.cmake +++ b/CMakeScripts/InstallMSYS2.cmake @@ -143,12 +143,16 @@ if(WIN32) DESTINATION share/icons)
# translations for libraries (we usually shouldn't need many)
- install(DIRECTORY ${MINGW_PATH}/share/locale
- DESTINATION share
- FILES_MATCHING
- PATTERN "*glib20.mo"
- PATTERN "*gtk30.mo"
- PATTERN "*gtkspell3.mo")
+ file(GLOB inkscape_translations RELATIVE ${CMAKE_SOURCE_DIR}/po/ ${CMAKE_SOURCE_DIR}/po/*.po)
+ foreach(translation ${inkscape_translations})
+ get_filename_component(translation ${translation} NAME_WE)
+ install(DIRECTORY ${MINGW_PATH}/share/locale/${translation}
+ DESTINATION share/locale
+ FILES_MATCHING
+ PATTERN "*glib20.mo"
+ PATTERN "*gtk30.mo"
+ PATTERN "*gtkspell3.mo")
+ endforeach()
install(DIRECTORY ${MINGW_PATH}/share/poppler
DESTINATION share)
diff --git a/CMakeScripts/inkscape-version.cmake b/CMakeScripts/inkscape-version.cmake index 7d6533a72..163490764 100644 --- a/CMakeScripts/inkscape-version.cmake +++ b/CMakeScripts/inkscape-version.cmake @@ -1,8 +1,9 @@ # This is called by cmake as an extermal process from # ./src/CMakeLists.txt and creates inkscape-version.cpp # -# It's also included directly in ./CMakeLists.txt to -# determine INKSCAPE_REVISION for the 'dist' target +# It's also included directly in ./CMakeScripts/Dist.cmake to +# determine INKSCAPE_REVISION, INKSCAPE_REVISION_HASH and INKSCAPE_REVISION_DATE +# for the 'dist' targets # # These variables are defined by the caller, matching the CMake equivilents. # - ${INKSCAPE_SOURCE_DIR} @@ -13,13 +14,13 @@ set(INKSCAPE_REVISION "unknown") if(EXISTS ${INKSCAPE_SOURCE_DIR}/.git) execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${INKSCAPE_SOURCE_DIR} - OUTPUT_VARIABLE INKSCAPE_REV_HASH + OUTPUT_VARIABLE INKSCAPE_REVISION_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND git log -n 1 --pretty=%cd --date=short WORKING_DIRECTORY ${INKSCAPE_SOURCE_DIR} - OUTPUT_VARIABLE INKSCAPE_REV_DATE + OUTPUT_VARIABLE INKSCAPE_REVISION_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) - set(INKSCAPE_REVISION "${INKSCAPE_REV_HASH}, ${INKSCAPE_REV_DATE}") + set(INKSCAPE_REVISION "${INKSCAPE_REVISION_HASH}, ${INKSCAPE_REVISION_DATE}") execute_process(COMMAND git status -s ${INKSCAPE_SOURCE_DIR}/src |
