Thaddeus Crews 2024-01-30 08:28:31 -07:00 committed by GitHub
commit 0c4aa1c9e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 5 deletions

View File

@ -134,22 +134,22 @@ jobs:
- name: Generate godot-cpp sources only
run: |
scons platform=${{ matrix.platform }} build_library=no ${{ matrix.flags }}
scons platform=${{ matrix.platform }} verbose=yes build_library=no ${{ matrix.flags }}
scons -c
- name: Build godot-cpp (debug)
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)
run: |
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)
run: |
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
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.Tool import Tool
from SCons.Action import Action
from SCons.Builder import Builder
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
for pl in platforms:
tool = Tool(pl, toolpath=["tools"])
@ -315,8 +324,31 @@ def generate(env):
env.Tool("compilation_db")
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
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")