Compare commits

...

2 Commits

Author SHA1 Message Date
Thaddeus Crews 2261a8d2da
Merge eb9f037bd3 into 0145e900f3 2024-01-20 05:14:17 +08:00
Thaddeus Crews eb9f037bd3
Implement `verbose` toggle from godot repo 2024-01-18 14:39:05 -06:00
2 changed files with 37 additions and 5 deletions

View File

@ -134,22 +134,22 @@ jobs:
- name: Generate godot-cpp sources only - name: Generate godot-cpp sources only
run: | run: |
scons platform=${{ matrix.platform }} build_library=no ${{ matrix.flags }} scons platform=${{ matrix.platform }} verbose=yes build_library=no ${{ matrix.flags }}
scons -c scons -c
- name: Build godot-cpp (debug) - name: Build godot-cpp (debug)
run: | run: |
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} scons platform=${{ matrix.platform }} verbose=yes target=template_debug ${{ matrix.flags }}
- name: Build test without rebuilding godot-cpp (debug) - name: Build test without rebuilding godot-cpp (debug)
run: | run: |
cd test cd test
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} build_library=no scons platform=${{ matrix.platform }} verbose=yes target=template_debug ${{ matrix.flags }} build_library=no
- name: Build test and godot-cpp (release) - name: Build test and godot-cpp (release)
run: | run: |
cd test cd test
scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }} scons platform=${{ matrix.platform }} verbose=yes target=template_release ${{ matrix.flags }}
- name: Download latest Godot artifacts - name: Download latest Godot artifacts
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9 uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9

View File

@ -2,6 +2,7 @@ import os, sys, platform
from SCons.Variables import EnumVariable, PathVariable, BoolVariable from SCons.Variables import EnumVariable, PathVariable, BoolVariable
from SCons.Tool import Tool from SCons.Tool import Tool
from SCons.Action import Action
from SCons.Builder import Builder from SCons.Builder import Builder
from SCons.Errors import UserError from SCons.Errors import UserError
@ -198,6 +199,14 @@ def options(opts, env):
) )
) )
opts.Add(
BoolVariable(
key="verbose",
help="Enable verbose output for the compilation",
default=False,
)
)
# Add platform options # Add platform options
for pl in platforms: for pl in platforms:
tool = Tool(pl, toolpath=["tools"]) tool = Tool(pl, toolpath=["tools"])
@ -315,8 +324,31 @@ def generate(env):
env.Tool("compilation_db") env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase(normalize_path(env["compiledb_file"], env))) env.Alias("compiledb", env.CompilationDatabase(normalize_path(env["compiledb_file"], env)))
# Formatting
if not env["verbose"] and sys.stdout.isatty():
BLUE = "\033[0;94m"
BOLD_BLUE = "\033[1;94m"
RESET = "\033[0m"
env.Append(CCCOMSTR=f"{BLUE}Compiling {BOLD_BLUE}$SOURCE{BLUE} ...{RESET}")
env.Append(CXXCOMSTR="$CCCOMSTR")
env.Append(SHCCCOMSTR=f"{BLUE}Compiling Shared {BOLD_BLUE}$SOURCE{BLUE} ...{RESET}")
env.Append(SHCXXCOMSTR="$SHCCCOMSTR")
env.Append(LINKCOMSTR=f"{BLUE}Linking Static Library {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
env.Append(ARCOMSTR="$LINKCOMSTR")
env.Append(RANLIBCOMSTR=f"{BLUE}RanLib Library {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
env.Append(SHLINKCOMSTR=f"{BLUE}Linking Shared Library {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
env.Append(JARCOMSTR=f"{BLUE}Creating Java Archive {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
env.Append(JAVACCOMSTR="$CCCOMSTR")
env.Append(RCCOMSTR=f"{BLUE}Creating Compiled Resource {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
env.Append(GENCOMSTR=f"{BLUE}Generating {BOLD_BLUE}$TARGET{BLUE} ...{RESET}")
# Builders # Builders
env.Append(BUILDERS={"GodotCPPBindings": Builder(action=scons_generate_bindings, emitter=scons_emit_files)}) env.Append(
BUILDERS={
"GodotCPPBindings": Builder(action=Action(scons_generate_bindings, "$GENCOMSTR"), emitter=scons_emit_files)
}
)
env.AddMethod(_godot_cpp, "GodotCPP") env.AddMethod(_godot_cpp, "GodotCPP")