summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/CMakeLists.txt42
-rwxr-xr-xclient/create-buttons.sh.cmake11
2 files changed, 37 insertions, 16 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 903baf5..7e9d720 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -24,10 +24,42 @@ tde_import(twin)
### buttons.h ##################################################################
-configure_file( create-buttons.sh.cmake create-buttons.sh @ONLY )
+file(
+ GLOB buttons_SOURCES
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/images/*.svg
+)
+list( SORT buttons_SOURCES )
+
+unset( buttons_IMAGES )
+file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/images )
+foreach( _image IN LISTS buttons_SOURCES )
+ get_filename_component( _image_base ${_image} NAME_WE )
+ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/images/${_image_base}.png
+ COMMAND ${RSVG_COMMAND}
+ --width=32 --height=32 --format=png
+ --output=${CMAKE_CURRENT_BINARY_DIR}/images/${_image_base}.png
+ ${CMAKE_CURRENT_SOURCE_DIR}/images/${_image}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/images/${_image}
+ )
+ list( APPEND buttons_IMAGES "images/${_image_base}.png" )
+endforeach()
+
+add_custom_target( buttons-prepare-images
+ COMMENT "Prepare images for embed into buttons"
+ DEPENDS ${buttons_IMAGES}
+)
-add_custom_target( buttons.h
- COMMAND ${CMAKE_COMMAND} -E env ${CMAKE_CURRENT_BINARY_DIR}/create-buttons.sh
+add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/buttons.h
+ COMMAND ${UIC_EXECUTABLE} -obuttons.h.in -embed buttons ${buttons_IMAGES}
+ COMMAND sed "s/factory/bfactory/" < buttons.h.in > buttons.h
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Embed images for buttons"
+ DEPENDS buttons-prepare-images
+)
+add_custom_target( buttons-embed-images
+ COMMENT "Generate embed images for buttons"
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/buttons.h
)
@@ -46,9 +78,9 @@ tde_add_kpart( twin_polyester AUTOMOC
tdecorations-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
-)
-add_dependencies( twin_polyester-module buttons.h )
+ DEPENDENCIES buttons-embed-images
+)
### other data #################################################################
diff --git a/client/create-buttons.sh.cmake b/client/create-buttons.sh.cmake
deleted file mode 100755
index 36cb38c..0000000
--- a/client/create-buttons.sh.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-mkdir -p @CMAKE_CURRENT_BINARY_DIR@/images
-for f in `ls @CMAKE_CURRENT_SOURCE_DIR@/images/*.svg`
-do
- @RSVG_COMMAND@ --width=32 --height=32 --output=images/`basename $f .svg`.png --format=png $f
-done
-
-tquic -o buttons.h -embed buttons images/circle.png images/circle2.png images/close.png images/help.png images/keep_above.png images/keep_above_lit.png images/keep_below.png images/keep_below_lit.png images/maximize.png images/minimize.png images/restore.png images/splat.png images/unsplat.png images/window_background.png images/window_foreground.png
-
-sed -i -e "s/factory/bfactory/" buttons.h