Commit bde18182 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Store carddeck files as SVG in repo, compress to SVGZ only on installation

Current svgz files had been accidentally created with no compression,
so size of checkout is even smaller than before, but any changes to SVG
files can be committed as normal text diffs.
parent 884b1313
......@@ -47,6 +47,8 @@ include(ECMMarkNonGuiExecutable)
include(ECMGenerateExportHeader)
include(ECMQtDeclareLoggingCategory)
include(InternalMacros)
set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
set(HIGHSCORE_DIRECTORY "" CACHE STRING "Where to install system-wide highscores e.g. /var/games")
......
# SPDX-FileCopyrightText: 2021 Friedrich W. H. Kossebau <kossebau@kde.org>
#
# SPDX-License-Identifier: BSD-3-Clause
if(WIN32)
find_package(7z)
set_package_properties(7z PROPERTIES
TYPE REQUIRED
PURPOSE "For installing SVG files as SVGZ"
)
else()
find_package(gzip)
set_package_properties(gzip PROPERTIES
TYPE REQUIRED
PURPOSE "For installing SVG files as SVGZ"
)
endif()
function(generate_svgz svg_file svgz_file target_prefix)
if (NOT IS_ABSOLUTE ${svg_file})
set(svg_file "${CMAKE_CURRENT_SOURCE_DIR}/${svg_file}")
endif()
if (NOT EXISTS ${svg_file})
message(FATAL_ERROR "No such file found: ${svg_file}")
endif()
get_filename_component(_fileName "${svg_file}" NAME)
if(WIN32)
add_custom_command(
OUTPUT ${svgz_file}
COMMAND 7z::7z
ARGS
a
-tgzip
${svgz_file} ${svg_file}
DEPENDS ${svg_file}
COMMENT "Gzipping ${_fileName}"
)
else()
add_custom_command(
OUTPUT ${svgz_file}
COMMAND ${gzip_EXECUTABLE}
ARGS
-9
-c
${svg_file} > ${svgz_file}
DEPENDS ${svg_file}
COMMENT "Gzipping ${_fileName}"
)
endif()
add_custom_target("${target_prefix}${_fileName}z" ALL DEPENDS ${svgz_file})
endfunction()
# SPDX-FileCopyrightText: 2021 Friedrich W. H. Kossebau <kossebau@kde.org>
#
# SPDX-License-Identifier: BSD-3-Clause
# will be used in subdirs' CMakeLists.txt
set( carddecks_base_dir ${CMAKE_CURRENT_SOURCE_DIR} )
# when adding new deck subdirectory it should be sufficient to just
# copy CMakeLists.txt from any existing deckdir to the new one.
add_subdirectory( svg-ancient-egyptians )
add_subdirectory( svg-dondorf )
add_subdirectory( svg-future )
add_subdirectory( svg-gm-paris )
add_subdirectory( svg-jolly-royal )
add_subdirectory( svg-konqi-modern )
add_subdirectory( svg-nicu-ornamental )
add_subdirectory( svg-nicu-white )
add_subdirectory( svg-oxygen )
add_subdirectory( svg-oxygen-air )
add_subdirectory( svg-oxygen-white )
add_subdirectory( svg-penguins )
add_subdirectory( svg-standard )
add_subdirectory( svg-tigullio-international )
add_subdirectory( svg-xskat-french )
add_subdirectory( svg-xskat-german )
function(install_carddeck id)
set(options AUTHORS COPYING COPYRIGHT)
set(oneValueArgs PREVIEW SVG)
set(multiValueArgs)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/${id}")
file(MAKE_DIRECTORY "${output_dir}")
set(svgz "${output_dir}/${ARG_SVG}z")
generate_svgz("${id}/${ARG_SVG}" ${svgz} "carddeck-${id}-")
set(copyright_files)
if (ARG_COPYRIGHT)
list(APPEND copyright_files "${id}/COPYRIGHT")
endif()
if (ARG_COPYING)
list(APPEND copyright_files "${id}/COPYING")
endif()
if (ARG_AUTHORS)
list(APPEND copyright_files "${id}/AUTHORS")
endif()
install(
FILES
${copyright_files}
${id}/index.desktop
${id}/${ARG_PREVIEW}
${svgz}
DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${id}
)
endfunction()
install_carddeck(svg-ancient-egyptians PREVIEW 11.png SVG Ancient_Egyptians.svg)
install_carddeck(svg-dondorf PREVIEW 11.png SVG dondorf.svg)
install_carddeck(svg-future PREVIEW 11.png SVG future.svg)
install_carddeck(svg-gm-paris PREVIEW 11.png SVG paris.svg)
install_carddeck(svg-jolly-royal PREVIEW 11.png SVG jolly-royal.svg)
install_carddeck(svg-konqi-modern PREVIEW 11.png SVG konqi.svg)
install_carddeck(svg-nicu-ornamental PREVIEW 11.png SVG ornamental.svg AUTHORS COPYING)
install_carddeck(svg-nicu-white PREVIEW 11.png SVG white.svg AUTHORS COPYING)
install_carddeck(svg-oxygen PREVIEW 11.png SVG oxygen.svg)
install_carddeck(svg-oxygen-air PREVIEW 11.png SVG oxygen-air.svg)
install_carddeck(svg-oxygen-white PREVIEW 11.png SVG oxygen-white.svg)
install_carddeck(svg-penguins PREVIEW 11.png SVG penguins.svg COPYRIGHT)
install_carddeck(svg-standard PREVIEW 11.png SVG standard.svg)
install_carddeck(svg-tigullio-international PREVIEW queen-of-hearts.png SVG tigullio-international.svg)
install_carddeck(svg-xskat-french PREVIEW 11.png SVG french.svg COPYRIGHT)
install_carddeck(svg-xskat-german PREVIEW 11.png SVG german.svg COPYRIGHT)
file( RELATIVE_PATH current_dir ${carddecks_base_dir} ${CMAKE_CURRENT_SOURCE_DIR} )
install( FILES 11.png index.desktop Ancient_Egyptians.svgz DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
file( RELATIVE_PATH current_dir ${carddecks_base_dir} ${CMAKE_CURRENT_SOURCE_DIR} )
install( FILES 11.png index.desktop dondorf.svgz DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
file( RELATIVE_PATH current_dir ${carddecks_base_dir} ${CMAKE_CURRENT_SOURCE_DIR} )
install( FILES 11.png index.desktop future.svgz DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
file( RELATIVE_PATH current_dir ${carddecks_base_dir} ${CMAKE_CURRENT_SOURCE_DIR} )
install( FILES 11.png index.desktop paris.svgz DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
This diff is collapsed.
file( RELATIVE_PATH current_dir ${carddecks_base_dir} ${CMAKE_CURRENT_SOURCE_DIR} )
install( FILES 11.png index.desktop jolly-royal.svgz DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
file( RELATIVE_PATH current_dir ${carddecks_base_dir} ${CMAKE_CURRENT_SOURCE_DIR} )
install( FILES 11.png index.desktop konqi.svgz DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
file( RELATIVE_PATH current_dir ${carddecks_base_dir} ${CMAKE_CURRENT_SOURCE_DIR} )
install( FILES 11.png index.desktop ornamental.svgz DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
install( FILES COPYING AUTHORS DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
file( RELATIVE_PATH current_dir ${carddecks_base_dir} ${CMAKE_CURRENT_SOURCE_DIR} )
install( FILES 11.png index.desktop white.svgz DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
install( FILES COPYING AUTHORS DESTINATION ${KDE_INSTALL_DATADIR}/carddecks/${current_dir} )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment