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

Install theme SVGs as SVGZs

parent 0368aa86
......@@ -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)
......@@ -24,6 +24,7 @@ include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
include(ECMInstallIcons)
include(FeatureSummary)
include(InternalMacros)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Test Widgets Svg Network)
if (QT_MAJOR_VERSION STREQUAL "6")
......
Copyright (c) <year> <owner>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 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()
# SPDX-FileCopyrightText: 2022 Friedrich W. H. Kossebau <kossebau@kde.org>
#
# SPDX-License-Identifier: BSD-3-Clause
install( FILES oxygen.svg oxygen.desktop oxygen_preview.png egyptian.svg default.desktop egyptian_preview.png default_block_move.ogg default_block_fall.ogg DESTINATION ${KDE_INSTALL_DATADIR}/kblocks/themes )
set(KBLOCKS_INSTALL_THEMESDIR "${KDE_INSTALL_DATADIR}/kblocks/themes")
function(install_theme name)
cmake_parse_arguments(ARG "" "ID" "OTHER" ${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}
${ARG_OTHER}
DESTINATION ${KBLOCKS_INSTALL_THEMESDIR}
)
endfunction()
install_theme(egyptian ID default
OTHER
default_block_move.ogg
default_block_fall.ogg
)
install_theme(oxygen)
......@@ -102,7 +102,7 @@ VersionFormat=1
Author=Sean Wilson
AuthorEmail=suseux@gmail.com
Type=SVG
FileName=egyptian.svg
FileName=egyptian.svgz
Preview=egyptian_preview.png
Sound_Block_Move=default_block_move.ogg
Sound_Block_Fall=default_block_fall.ogg
......
......@@ -112,7 +112,7 @@ VersionFormat=1
Author=Johann-Ollivier Lapeyre
AuthorEmail=johann.ollivierlapeyre@gmail.com
Type=SVG
FileName=oxygen.svg
FileName=oxygen.svgz
Preview=oxygen_preview.png
Sound_Block_Move=default_block_move.ogg
Sound_Block_Fall=default_block_fall.ogg
......
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