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

SCons: Colorize warnings/errors during generation

This commit is contained in:
Thaddeus Crews
2024-04-26 12:35:07 -05:00
parent 6118592c6d
commit e0e8ce1fc0
20 changed files with 415 additions and 335 deletions

View File

@@ -10,7 +10,7 @@ from emscripten_helpers import (
create_template_zip,
get_template_zip_path,
)
from methods import get_compiler_version
from methods import print_warning, print_error, get_compiler_version
from SCons.Util import WhereIs
from typing import TYPE_CHECKING
@@ -85,16 +85,16 @@ def configure(env: "SConsEnvironment"):
# Validate arch.
supported_arches = ["wasm32"]
if env["arch"] not in supported_arches:
print(
print_error(
'Unsupported CPU architecture "%s" for Web. Supported architectures are: %s.'
% (env["arch"], ", ".join(supported_arches))
)
sys.exit()
sys.exit(255)
try:
env["initial_memory"] = int(env["initial_memory"])
except Exception:
print("Initial memory must be a valid integer")
print_error("Initial memory must be a valid integer")
sys.exit(255)
## Build type
@@ -109,7 +109,7 @@ def configure(env: "SConsEnvironment"):
env.Append(LINKFLAGS=["-s", "ASSERTIONS=1"])
if env.editor_build and env["initial_memory"] < 64:
print('Note: Forcing "initial_memory=64" as it is required for the web editor.')
print("Note: Forcing `initial_memory=64` as it is required for the web editor.")
env["initial_memory"] = 64
env.Append(LINKFLAGS=["-s", "INITIAL_MEMORY=%sMB" % env["initial_memory"]])
@@ -227,7 +227,7 @@ def configure(env: "SConsEnvironment"):
env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"])
env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"])
elif env["proxy_to_pthread"]:
print('"threads=no" support requires "proxy_to_pthread=no", disabling proxy to pthread.')
print_warning('"threads=no" support requires "proxy_to_pthread=no", disabling proxy to pthread.')
env["proxy_to_pthread"] = False
if env["lto"] != "none":
@@ -240,11 +240,11 @@ def configure(env: "SConsEnvironment"):
if env["dlink_enabled"]:
if env["proxy_to_pthread"]:
print("GDExtension support requires proxy_to_pthread=no, disabling proxy to pthread.")
print_warning("GDExtension support requires proxy_to_pthread=no, disabling proxy to pthread.")
env["proxy_to_pthread"] = False
if cc_semver < (3, 1, 14):
print("GDExtension support requires emscripten >= 3.1.14, detected: %s.%s.%s" % cc_semver)
print_error("GDExtension support requires emscripten >= 3.1.14, detected: %s.%s.%s" % cc_semver)
sys.exit(255)
env.Append(CCFLAGS=["-s", "SIDE_MODULE=2"])