Skip to content

Commit 768d2f3

Browse files
committed
Implement verbose toggle from godot repo
1 parent 0ddef6e commit 768d2f3

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,22 +134,22 @@ jobs:
134134
135135
- name: Generate godot-cpp sources only
136136
run: |
137-
scons platform=${{ matrix.platform }} build_library=no ${{ matrix.flags }}
137+
scons platform=${{ matrix.platform }} verbose=yes build_library=no ${{ matrix.flags }}
138138
scons -c
139139
140140
- name: Build godot-cpp (debug)
141141
run: |
142-
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }}
142+
scons platform=${{ matrix.platform }} verbose=yes target=template_debug ${{ matrix.flags }}
143143
144144
- name: Build test without rebuilding godot-cpp (debug)
145145
run: |
146146
cd test
147-
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} build_library=no
147+
scons platform=${{ matrix.platform }} verbose=yes target=template_debug ${{ matrix.flags }} build_library=no
148148
149149
- name: Build test and godot-cpp (release)
150150
run: |
151151
cd test
152-
scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }}
152+
scons platform=${{ matrix.platform }} verbose=yes target=template_release ${{ matrix.flags }}
153153
154154
- name: Download latest Godot artifacts
155155
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9

tools/godotcpp.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from SCons.Variables import EnumVariable, PathVariable, BoolVariable
44
from SCons.Tool import Tool
5+
from SCons.Action import Action
56
from SCons.Builder import Builder
67
from SCons.Errors import UserError
78

@@ -198,6 +199,14 @@ def options(opts, env):
198199
)
199200
)
200201

202+
opts.Add(
203+
BoolVariable(
204+
key="verbose",
205+
help="Enable verbose output for the compilation",
206+
default=False,
207+
)
208+
)
209+
201210
# Add platform options
202211
for pl in platforms:
203212
tool = Tool(pl, toolpath=["tools"])
@@ -315,8 +324,31 @@ def generate(env):
315324
env.Tool("compilation_db")
316325
env.Alias("compiledb", env.CompilationDatabase(normalize_path(env["compiledb_file"], env)))
317326

327+
# Formatting
328+
if not env["verbose"] and sys.stdout.isatty():
329+
BLUE = "\033[0;94m"
330+
BOLD_BLUE = "\033[1;94m"
331+
RESET = "\033[0m"
332+
333+
env.Append(CCCOMSTR=f"{BLUE}Compiling {BOLD_BLUE}$SOURCE{BLUE} ...{RESET}")
334+
env.Append(CXXCOMSTR="$CCCOMSTR")
335+
env.Append(SHCCCOMSTR=f"{BLUE}Compiling Shared {BOLD_BLUE}$SOURCE{BLUE} ...{RESET}")
336+
env.Append(SHCXXCOMSTR="$SHCCCOMSTR")
337+
env.Append(LINKCOMSTR=f"{BLUE}Linking Static Library {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
338+
env.Append(ARCOMSTR="$LINKCOMSTR")
339+
env.Append(RANLIBCOMSTR=f"{BLUE}RanLib Library {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
340+
env.Append(SHLINKCOMSTR=f"{BLUE}Linking Shared Library {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
341+
env.Append(JARCOMSTR=f"{BLUE}Creating Java Archive {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
342+
env.Append(JAVACCOMSTR="$CCCOMSTR")
343+
env.Append(RCCOMSTR=f"{BLUE}Creating Compiled Resource {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
344+
env.Append(GENCOMSTR=f"{BLUE}Generating {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
345+
318346
# Builders
319-
env.Append(BUILDERS={"GodotCPPBindings": Builder(action=scons_generate_bindings, emitter=scons_emit_files)})
347+
env.Append(
348+
BUILDERS={
349+
"GodotCPPBindings": Builder(action=Action(scons_generate_bindings, "$GENCOMSTR"), emitter=scons_emit_files)
350+
}
351+
)
320352
env.AddMethod(_godot_cpp, "GodotCPP")
321353

322354

tools/windows.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def options(opts):
1010
opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False))
1111
opts.Add(BoolVariable("use_clang_cl", "Use the clang driver instead of MSVC - only effective on Windows", False))
1212
opts.Add(BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True))
13+
opts.Add(BoolVariable("silence_msvc", "Silence MSVC's stdout. Decreases output log bloat by roughly half.", True)),
1314

1415

1516
def exists(env):
@@ -43,6 +44,19 @@ def generate(env):
4344
else:
4445
env.Append(CCFLAGS=["/MD"])
4546

47+
env["MAXLINELENGTH"] = 8192
48+
49+
if env["silence_msvc"]:
50+
env.Prepend(CCFLAGS=[">", "NUL"])
51+
env.Prepend(LINKFLAGS=[">", "NUL"])
52+
53+
old_esc_func = env["TEMPFILEARGESCFUNC"]
54+
55+
def trim_nul(arg):
56+
return "" if arg in [">", "NUL"] else old_esc_func(arg)
57+
58+
env["TEMPFILEARGESCFUNC"] = trim_nul
59+
4660
elif sys.platform == "win32" or sys.platform == "msys":
4761
env["use_mingw"] = True
4862
mingw.generate(env)

0 commit comments

Comments
 (0)