Store theme files as SVG in repo, compress to SVGZ only on installation
Allows any changes to SVG files to be committed as normal text diffs.
This commit is contained in:
parent
842bed332d
commit
f4177b7fa3
7 changed files with 13285 additions and 5 deletions
|
@ -13,7 +13,7 @@ set(KIGO_VERSION "${KIGO_BASE_VERSION}.${RELEASE_SERVICE_COMPACT_VERSION}")
|
|||
project(kigo VERSION ${KIGO_VERSION})
|
||||
|
||||
set(QT_MIN_VERSION "6.5.0")
|
||||
set(KF_MIN_VERSION "5.240.0")
|
||||
set(KF_MIN_VERSION "5.245.0")
|
||||
|
||||
find_package(ECM ${KF_MIN_VERSION} REQUIRED CONFIG)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
|
||||
|
@ -29,6 +29,8 @@ include(ECMSetupVersion)
|
|||
include(FeatureSummary)
|
||||
include(ECMDeprecationSettings)
|
||||
|
||||
include(InternalMacros)
|
||||
|
||||
find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS
|
||||
Svg
|
||||
Widgets
|
||||
|
|
64
cmake/InternalMacros.cmake
Normal file
64
cmake/InternalMacros.cmake
Normal file
|
@ -0,0 +1,64 @@
|
|||
# SPDX-FileCopyrightText: 2021, 2023 Friedrich W. H. Kossebau <kossebau@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
find_package(7Zip)
|
||||
set_package_properties(7Zip PROPERTIES
|
||||
PURPOSE "For installing SVG files as SVGZ"
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set_package_properties(7Zip PROPERTIES
|
||||
TYPE REQUIRED
|
||||
)
|
||||
else()
|
||||
set_package_properties(7Zip PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
if(NOT TARGET 7Zip::7Zip)
|
||||
find_package(gzip)
|
||||
set_package_properties(gzip PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "For installing SVG files as SVGZ (less efficient fallback for 7Zip)"
|
||||
)
|
||||
endif()
|
||||
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(TARGET 7Zip::7Zip)
|
||||
add_custom_command(
|
||||
OUTPUT ${svgz_file}
|
||||
COMMAND 7Zip::7Zip
|
||||
ARGS
|
||||
a
|
||||
-bd # silence logging
|
||||
-mx9 # compress best
|
||||
-tgzip
|
||||
${svgz_file} ${svg_file}
|
||||
DEPENDS ${svg_file}
|
||||
COMMENT "Gzipping ${_fileName}"
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT ${svgz_file}
|
||||
COMMAND gzip::gzip
|
||||
ARGS
|
||||
-9 # compress best
|
||||
-n # no original name and timestamp stored, for reproducibility
|
||||
-c # write to stdout
|
||||
${svg_file} > ${svgz_file}
|
||||
DEPENDS ${svg_file}
|
||||
COMMENT "Gzipping ${_fileName}"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_target("${target_prefix}${_fileName}z" ALL DEPENDS ${svgz_file})
|
||||
endfunction()
|
|
@ -1,4 +1,25 @@
|
|||
install(FILES
|
||||
default.desktop kigo_default.svgz kigo_default.png
|
||||
plain.desktop kigo_plain.svgz kigo_plain.png
|
||||
DESTINATION ${KDE_INSTALL_DATADIR}/kigo/themes)
|
||||
# SPDX-FileCopyrightText: 2023 Friedrich W. H. Kossebau <kossebau@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
function(install_theme name)
|
||||
cmake_parse_arguments(ARG "" "SVG;PREVIEW" "" ${ARGN})
|
||||
if (NOT ARG_SVG)
|
||||
set(ARG_SVG "${name}.svg")
|
||||
endif()
|
||||
if (NOT ARG_PREVIEW)
|
||||
set(ARG_PREVIEW "${name}_preview.png")
|
||||
endif()
|
||||
set(svgz "${CMAKE_CURRENT_BINARY_DIR}/${ARG_SVG}z")
|
||||
generate_svgz(${ARG_SVG} ${svgz} "theme-")
|
||||
install(
|
||||
FILES
|
||||
${name}.desktop
|
||||
${ARG_PREVIEW}
|
||||
${svgz}
|
||||
DESTINATION ${KDE_INSTALL_DATADIR}/kigo/themes
|
||||
)
|
||||
endfunction()
|
||||
|
||||
install_theme(default SVG kigo_default.svg PREVIEW kigo_default.png)
|
||||
install_theme(plain SVG kigo_plain.svg PREVIEW kigo_plain.png)
|
||||
|
|
8947
data/themes/kigo_default.svg
Normal file
8947
data/themes/kigo_default.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 633 KiB |
Binary file not shown.
4246
data/themes/kigo_plain.svg
Normal file
4246
data/themes/kigo_plain.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 370 KiB |
Binary file not shown.
Loading…
Add table
Reference in a new issue