diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-13 16:47:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-13 17:14:03 +0400 |
commit | 4c9a3a53bd3154954bc2bcf73684b87a79332a71 (patch) | |
tree | ca297c79f831f46117e1638640a187e98ddbd01c /build_files/cmake/macros.cmake | |
parent | 08981f3a91a687efa8d28d308d6033e5a9e68b1f (diff) |
UI Icons: store icons in git as uncompressed pixmaps (D196)
this allows for updating icons without committing a new PNG each time
(which is inefficient with git). The data files are converted into a
PNG at builds time and used just as they were before.
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 0bf31f7e678..e6ca3dadce5 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -831,6 +831,46 @@ macro(data_to_c_simple unset(_file_to_path) endmacro() +# macro for converting pixmap directory to a png and then a c file +macro(data_to_c_simple_icons + path_from + list_to_add + ) + + # Conversion steps + # path_from -> _file_from -> _file_to + # foo/*.dat -> foo.png -> foo.png.c + + get_filename_component(_path_from_abs ${path_from} ABSOLUTE) + # remove ../'s + get_filename_component(_file_from ${CMAKE_CURRENT_BINARY_DIR}/${path_from}.png REALPATH) + get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${path_from}.png.c REALPATH) + + list(APPEND ${list_to_add} ${_file_to}) + + get_filename_component(_file_to_path ${_file_to} PATH) + + # ideally we wouldn't glob, but storing all names for all pixmaps is a bit heavy + file(GLOB _icon_files "${path_from}/*.dat") + + add_custom_command( + OUTPUT ${_file_from} ${_file_to} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path} + #COMMAND python3 ${CMAKE_SOURCE_DIR}/source/blender/datatoc/datatoc_icon.py ${_path_from_abs} ${_file_from} + COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc_icon ${_path_from_abs} ${_file_from} + COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to} + DEPENDS ${_icon_files} datatoc) + + set_source_files_properties(${_file_from} ${_file_to} PROPERTIES GENERATED TRUE) + + unset(_path_from_abs) + unset(_file_from) + unset(_file_to) + unset(_file_to_path) + unset(_icon_files) + +endmacro() + # XXX Not used for now... macro(svg_to_png file_from |