@@ -5,12 +5,10 @@ EnsureSConsVersion(4, 0)
5
5
EnsurePythonVersion (3 , 8 )
6
6
7
7
# System
8
- import atexit
9
8
import glob
10
9
import os
11
10
import pickle
12
11
import sys
13
- import time
14
12
from collections import OrderedDict
15
13
from importlib .util import module_from_spec , spec_from_file_location
16
14
from types import ModuleType
@@ -52,13 +50,14 @@ _helper_module("platform_methods", "platform_methods.py")
52
50
_helper_module ("version" , "version.py" )
53
51
_helper_module ("core.core_builders" , "core/core_builders.py" )
54
52
_helper_module ("main.main_builders" , "main/main_builders.py" )
53
+ _helper_module ("misc.utility.color" , "misc/utility/color.py" )
55
54
56
55
# Local
57
56
import gles3_builders
58
57
import glsl_builders
59
58
import methods
60
59
import scu_builders
61
- from methods import Ansi , print_error , print_info , print_warning
60
+ from misc . utility . color import STDERR_COLOR , print_error , print_info , print_warning
62
61
from platform_methods import architecture_aliases , architectures , compatibility_platform_aliases
63
62
64
63
if ARGUMENTS .get ("target" , "editor" ) == "editor" :
@@ -74,8 +73,6 @@ platform_doc_class_path = {}
74
73
platform_exporters = []
75
74
platform_apis = []
76
75
77
- time_at_start = time .time ()
78
-
79
76
for x in sorted (glob .glob ("platform/*" )):
80
77
if not os .path .isdir (x ) or not os .path .exists (x + "/detect.py" ):
81
78
continue
@@ -198,7 +195,7 @@ opts.Add(BoolVariable("threads", "Enable threading support", True))
198
195
opts .Add (BoolVariable ("deprecated" , "Enable compatibility code for deprecated and removed features" , True ))
199
196
opts .Add (EnumVariable ("precision" , "Set the floating-point precision level" , "single" , ("single" , "double" )))
200
197
opts .Add (BoolVariable ("minizip" , "Enable ZIP archive support using minizip" , True ))
201
- opts .Add (BoolVariable ("brotli" , "Enable Brotli for decompresson and WOFF2 fonts support" , True ))
198
+ opts .Add (BoolVariable ("brotli" , "Enable Brotli for decompression and WOFF2 fonts support" , True ))
202
199
opts .Add (BoolVariable ("xaudio2" , "Enable the XAudio2 audio driver on supported platforms" , False ))
203
200
opts .Add (BoolVariable ("vulkan" , "Enable the vulkan rendering driver" , True ))
204
201
opts .Add (BoolVariable ("opengl3" , "Enable the OpenGL/GLES3 rendering driver" , True ))
@@ -702,6 +699,14 @@ if env["arch"] == "x86_32":
702
699
else :
703
700
env .Append (CCFLAGS = ["-msse2" ])
704
701
702
+ # Explicitly specify colored output.
703
+ if methods .using_gcc (env ):
704
+ env .AppendUnique (CCFLAGS = ["-fdiagnostics-color" if STDERR_COLOR else "-fno-diagnostics-color" ])
705
+ elif methods .using_clang (env ) or methods .using_emcc (env ):
706
+ env .AppendUnique (CCFLAGS = ["-fcolor-diagnostics" if STDERR_COLOR else "-fno-color-diagnostics" ])
707
+ if sys .platform == "win32" :
708
+ env .AppendUnique (CCFLAGS = ["-fansi-escape-codes" ])
709
+
705
710
# Set optimize and debug_symbols flags.
706
711
# "custom" means do nothing and let users set their own optimization flags.
707
712
# Needs to happen after configure to have `env.msvc` defined.
@@ -961,7 +966,7 @@ methods.sort_module_list(env)
961
966
962
967
if env .editor_build :
963
968
# Add editor-specific dependencies to the dependency graph.
964
- env .module_add_dependencies ("editor" , ["freetype" , "svg" ])
969
+ env .module_add_dependencies ("editor" , ["freetype" , "regex" , " svg" ])
965
970
966
971
# And check if they are met.
967
972
if not env .module_check_dependencies ("editor" ):
@@ -1086,30 +1091,5 @@ methods.show_progress(env)
1086
1091
# TODO: replace this with `env.Dump(format="json")`
1087
1092
# once we start requiring SCons 4.0 as min version.
1088
1093
methods .dump (env )
1089
-
1090
-
1091
- def print_elapsed_time ():
1092
- elapsed_time_sec = round (time .time () - time_at_start , 2 )
1093
- time_centiseconds = round ((elapsed_time_sec % 1 ) * 100 )
1094
- print (
1095
- "{}[Time elapsed: {}.{:02}]{}" .format (
1096
- Ansi .GRAY ,
1097
- time .strftime ("%H:%M:%S" , time .gmtime (elapsed_time_sec )),
1098
- time_centiseconds ,
1099
- Ansi .RESET ,
1100
- )
1101
- )
1102
-
1103
-
1104
- atexit .register (print_elapsed_time )
1105
-
1106
-
1107
- def purge_flaky_files ():
1108
- paths_to_keep = [env ["ninja_file" ]]
1109
- for build_failure in GetBuildFailures ():
1110
- path = build_failure .node .path
1111
- if os .path .isfile (path ) and path not in paths_to_keep :
1112
- os .remove (path )
1113
-
1114
-
1115
- atexit .register (purge_flaky_files )
1094
+ methods .prepare_purge (env )
1095
+ methods .prepare_timer ()
0 commit comments