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

Store theme SVGs uncompressed in repo, install as SVGZs

Align some file names to simplify buildsystem code
parent 8ae1ad4f
......@@ -12,7 +12,7 @@ set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.90.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
include(KDEInstallDirs)
include(KDECMakeSettings)
......@@ -23,6 +23,7 @@ include(ECMInstallIcons)
include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
include(InternalMacros)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Qml Quick QuickWidgets)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
......
# SPDX-FileCopyrightText: 2021-2022 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
-9n
-c
${svg_file} > ${svgz_file}
DEPENDS ${svg_file}
COMMENT "Gzipping ${_fileName}"
)
endif()
add_custom_target("${target_prefix}${_fileName}z" ALL DEPENDS ${svgz_file})
endfunction()
install( FILES default.desktop egyptian_breakout_preview.png egyptianbreakout.svgz alienbreakout.svgz alienbreakout.desktop alien_preview.png web20.svgz web20.desktop web20_preview.png crystal.desktop crystal.svgz crystal_preview.png simple.svgz simple.desktop simple_preview.png IceWorld.svgz IceWorld.desktop IceWorld_preview.png DESTINATION ${KDE_INSTALL_DATADIR}/kbreakout/themes )
# SPDX-FileCopyrightText: 2022 Friedrich W. H. Kossebau <kossebau@kde.org>
#
# SPDX-License-Identifier: BSD-3-Clause
function(install_theme name)
cmake_parse_arguments(ARG "" "ID" "" ${ARGN})
if (NOT ARG_ID)
set(ARG_ID "${name}")
endif()
set(svgz "${CMAKE_CURRENT_BINARY_DIR}/${name}.svgz")
generate_svgz(${name}.svg ${svgz} "theme-")
install(
FILES
${ARG_ID}.desktop
${name}_preview.png
${svgz}
DESTINATION ${KDE_INSTALL_DATADIR}/kbreakout/themes
)
endfunction()
install_theme(egyptianbreakout ID default)
install_theme(alienbreakout)
install_theme(web20)
install_theme(crystal)
install_theme(simple)
install_theme(IceWorld)
......@@ -91,4 +91,4 @@ Author=Sean Wilson
AuthorEmail=suseux@gmail.com
Type=SVG
FileName=alienbreakout.svgz
Preview=alien_preview.png
Preview=alienbreakout_preview.png
......@@ -94,4 +94,4 @@ Author=Sean Wilson
AuthorEmail=suseux@gmail.com
Type=SVG
FileName=egyptianbreakout.svgz
Preview=egyptian_breakout_preview.png
Preview=egyptianbreakout_preview.png
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