1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

SCons: Move platform logo/run icon to export folder

Follow-up to #75932.
Since these icons are only used by the export plugin, it makes sense to
move them and generate the headers there.

The whole `detect.is_active()` logic seems to be a leftover from before
times, as far back as 1.0-stable it already wasn't used for anything.

So I'm removing it and moving the export icon generation to
`platform_methods`, where it makes more sense.
This commit is contained in:
Rémi Verschelde
2023-06-19 11:28:22 +02:00
parent dbe8712d4e
commit 90446fe9f3
29 changed files with 48 additions and 78 deletions

View File

@@ -110,3 +110,33 @@ def detect_arch():
print("Unsupported CPU architecture: " + host_machine)
print("Falling back to x86_64.")
return "x86_64"
def generate_export_icons(platform_path, platform_name):
"""
Generate headers for logo and run icon for the export plugin.
"""
export_path = platform_path + "/export"
svg_names = []
if os.path.isfile(export_path + "/logo.svg"):
svg_names.append("logo")
if os.path.isfile(export_path + "/run_icon.svg"):
svg_names.append("run_icon")
for name in svg_names:
svgf = open(export_path + "/" + name + ".svg", "rb")
b = svgf.read(1)
svg_str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
svg_str += " static const char *_" + platform_name + "_" + name + '_svg = "'
while len(b) == 1:
svg_str += "\\" + hex(ord(b))[1:]
b = svgf.read(1)
svg_str += '";\n'
svgf.close()
# NOTE: It is safe to generate this file here, since this is still executed serially.
wf = export_path + "/" + name + "_svg.gen.h"
with open(wf, "w") as svgw:
svgw.write(svg_str)