SCons: Refactor color output implementation

This commit is contained in:
Thaddeus Crews 2025-01-07 15:55:17 -06:00
parent d2ada64a03
commit a29294fddc
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
11 changed files with 211 additions and 304 deletions

View file

@ -1,14 +1,8 @@
#!/usr/bin/env python
import atexit
import time
from typing import TYPE_CHECKING
# ruff: noqa: F821
import methods
if TYPE_CHECKING:
from misc.utility.scons_hints import *
# For the reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
@ -17,8 +11,6 @@ if TYPE_CHECKING:
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags
time_at_start = time.time()
env = SConscript("./godot-cpp/SConstruct")
env.__class__.disable_warnings = methods.disable_warnings
@ -33,9 +25,6 @@ opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", Fa
opts.Update(env)
if not env["verbose"]:
methods.no_verbose(env)
if env["platform"] == "windows" and not env["use_mingw"]:
env.AppendUnique(CCFLAGS=["/utf-8"]) # Force to use Unicode encoding.
@ -767,18 +756,4 @@ else:
Default(library)
def print_elapsed_time():
elapsed_time_sec = round(time.time() - time_at_start, 2)
time_centiseconds = round((elapsed_time_sec % 1) * 100)
print(
"{}[Time elapsed: {}.{:02}]{}".format(
methods.Ansi.GRAY,
time.strftime("%H:%M:%S", time.gmtime(elapsed_time_sec)),
time_centiseconds,
methods.Ansi.RESET,
)
)
atexit.register(print_elapsed_time)
methods.prepare_timer()