Cleanup: clarify names, use a list for SVG icons & unset variables
This commit is contained in:
@@ -155,7 +155,7 @@ if(WITH_BLENDER)
|
||||
if(NOT WITH_HEADLESS)
|
||||
# Blender UI only.
|
||||
|
||||
set(SVG_SRC
|
||||
set(SVG_FILENAMES_NOEXT
|
||||
action
|
||||
action_tweak
|
||||
add
|
||||
@@ -862,14 +862,23 @@ if(WITH_BLENDER)
|
||||
zoom_previous
|
||||
zoom_selected
|
||||
)
|
||||
set(SVGHCONTENTS )
|
||||
set(SVGCCCONTENTS )
|
||||
foreach(svg ${SVG_SRC})
|
||||
set(SVG_CONTENTS_H)
|
||||
set(SVG_CONTENTS_C)
|
||||
foreach(svg ${SVG_FILENAMES_NOEXT})
|
||||
data_to_c_simple(../../../../release/datafiles/icons_svg/${svg}.svg SRC)
|
||||
string(TOUPPER ${svg} svg_name_upper)
|
||||
set(SVGHCONTENTS "${SVGHCONTENTS}extern const char datatoc_${svg}_svg[];\n")
|
||||
set(SVGCCCONTENTS "${SVGCCCONTENTS}case ICON_${svg_name_upper}: return datatoc_${svg}_svg;\n")
|
||||
list(APPEND SVG_CONTENTS_H
|
||||
"extern const char datatoc_${svg}_svg[]\;\n"
|
||||
)
|
||||
list(APPEND SVG_CONTENTS_C
|
||||
"case ICON_${svg_name_upper}: return datatoc_${svg}_svg\;\n"
|
||||
)
|
||||
endforeach()
|
||||
unset(svg_name_upper)
|
||||
|
||||
list(JOIN SVG_CONTENTS_C "" SVG_CONTENTS_C)
|
||||
list(JOIN SVG_CONTENTS_H "" SVG_CONTENTS_H)
|
||||
|
||||
configure_file(
|
||||
"svg_icons.h.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/svg_icons.h"
|
||||
@@ -882,6 +891,7 @@ if(WITH_BLENDER)
|
||||
ESCAPE_QUOTES
|
||||
@ONLY
|
||||
)
|
||||
|
||||
list(APPEND SRC ${CMAKE_CURRENT_BINARY_DIR}/svg_icons.h)
|
||||
list(APPEND SRC ${CMAKE_CURRENT_BINARY_DIR}/svg_icons.cc)
|
||||
# Blend files.
|
||||
@@ -892,6 +902,10 @@ if(WITH_BLENDER)
|
||||
# Images.
|
||||
data_to_c_simple(../../../../release/datafiles/splash.png SRC)
|
||||
|
||||
unset(SVG_CONTENTS_H)
|
||||
unset(SVG_CONTENTS_C)
|
||||
unset(SVG_FILENAMES_NOEXT)
|
||||
|
||||
endif()
|
||||
|
||||
data_to_c_simple(../../../../release/datafiles/startup.blend SRC)
|
||||
|
||||
@@ -5,8 +5,8 @@ const char *blf_get_icon_svg(int icon)
|
||||
{
|
||||
switch (icon)
|
||||
{
|
||||
@SVGCCCONTENTS@
|
||||
@SVG_CONTENTS_C@
|
||||
default:
|
||||
return datatoc_none_svg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ extern "C" {
|
||||
|
||||
const char *blf_get_icon_svg(int icon);
|
||||
|
||||
@SVGHCONTENTS@
|
||||
@SVG_CONTENTS_H@
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user