|
2 | 2 |
|
3 | 3 | from SCons.Variables import EnumVariable, PathVariable, BoolVariable
|
4 | 4 | from SCons.Tool import Tool
|
| 5 | +from SCons.Action import Action |
5 | 6 | from SCons.Builder import Builder
|
6 | 7 | from SCons.Errors import UserError
|
7 | 8 |
|
@@ -198,6 +199,14 @@ def options(opts, env):
|
198 | 199 | )
|
199 | 200 | )
|
200 | 201 |
|
| 202 | + opts.Add( |
| 203 | + BoolVariable( |
| 204 | + key="verbose", |
| 205 | + help="Enable verbose output for the compilation", |
| 206 | + default=False, |
| 207 | + ) |
| 208 | + ) |
| 209 | + |
201 | 210 | # Add platform options
|
202 | 211 | for pl in platforms:
|
203 | 212 | tool = Tool(pl, toolpath=["tools"])
|
@@ -315,8 +324,31 @@ def generate(env):
|
315 | 324 | env.Tool("compilation_db")
|
316 | 325 | env.Alias("compiledb", env.CompilationDatabase(normalize_path(env["compiledb_file"], env)))
|
317 | 326 |
|
| 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 | + |
318 | 346 | # 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 | + ) |
320 | 352 | env.AddMethod(_godot_cpp, "GodotCPP")
|
321 | 353 |
|
322 | 354 |
|
|
0 commit comments