godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.96k stars 19.49k forks source link

Web builds are no longer built with `-Os` by default #94087

Closed akien-mga closed 1 week ago

akien-mga commented 1 week ago

Tested versions

System information

Fedora Linux 40 (KDE Plasma) - Wayland - Vulkan (Forward+) - dedicated AMD Radeon RX 7600M XT (RADV NAVI33) - AMD Ryzen 7 7840HS w/ Radeon 780M Graphics (16 Threads)

Issue description

When building for Web with scons p=web target=template_release verbose=yes, you should see it use -Os as optimization, which is set as custom value for env["optimize"] in platform/web/detect.py.

But I broke it with one of my PRs in 4.3 (likely #91791) so now this override is no longer respected and instead this code in SConstruct forces it to speed (which is the default on other platforms for release templates).

if env.dev_build:
    opt_level = "none"
elif env.debug_features:
    opt_level = "speed_trace"
else:  # Release
    opt_level = "speed"

env["optimize"] = ARGUMENTS.get("optimize", opt_level)

ARGUMENTS only includes command line arguments, not overrides taken from detect.py.

One potential solution would be to add a auto mode for optimize, and only do this magic if it's auto.

Steps to reproduce

Minimal reproduction project (MRP)

n/a

dsnopek commented 1 week ago

This is somewhat related to issue https://github.com/godotengine/godot/issues/93476, but not entirely