MCPcopy Create free account
hub / github.com/FastLED/FastLED / compile_meson

Function compile_meson

ci/meson/compile.py:107–692  ·  view source on GitHub ↗

Compile using Meson. Args: build_dir: Meson build directory target: Specific target to build (None = all) quiet: Suppress banner and progress output (used during target fallback retries) verbose: Enable verbose output with section banners build_mode:

(
    build_dir: Path,
    target: Optional[str] = None,
    quiet: bool = False,
    verbose: bool = False,
    build_mode: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

105
106
107def compile_meson(
108 build_dir: Path,
109 target: Optional[str] = None,
110 quiet: bool = False,
111 verbose: bool = False,
112 build_mode: Optional[str] = None,
113) -> CompileResult:
114 """
115 Compile using Meson.
116
117 Args:
118 build_dir: Meson build directory
119 target: Specific target to build (None = all)
120 quiet: Suppress banner and progress output (used during target fallback retries)
121 verbose: Enable verbose output with section banners
122 build_mode: Build mode string for display (e.g., "quick", "debug", "release").
123 If None, derived from build directory name.
124
125 Returns:
126 CompileResult with success flag and error_output (empty on success).
127 """
128 cmd = [get_meson_executable(), "compile", "-C", str(build_dir)]
129
130 # Derive build mode from build directory name if not provided
131 if build_mode is None:
132 if "meson-quick" in str(build_dir):
133 build_mode = "quick"
134 elif "meson-debug" in str(build_dir):
135 build_mode = "debug"
136 elif "meson-release" in str(build_dir):
137 build_mode = "release"
138 else:
139 build_mode = "unknown"
140
141 # NINJA SKIP OPTIMIZATION: If target is up-to-date, skip the full ninja
142 # startup (~2-3s) and return immediately.
143 #
144 # Conditions checked (~20-50ms total):
145 # 1. build.ninja mtime unchanged → no meson reconfiguration
146 # 2. libfastled.a mtime unchanged → no src/ code changes (proxy)
147 # 3. tests/ max source file mtime ≤ saved → no test source modifications
148 # 4. Output DLL/exe mtime unchanged → not rebuilt externally or deleted
149 #
150 # Only applied to specific targets (not all-build).
151 # Overhead: ~20-50ms (os.scandir over tests/ source files). Savings: ~2-3s.
152 if target and check_ninja_skip(build_dir, target):
153 if not quiet:
154 _ts_print(f"[BUILD] ✓ Target up-to-date (ninja skipped)")
155 return CompileResult(
156 success=True,
157 error_output="",
158 suppressed_errors=[],
159 error_log_file=None,
160 )
161
162 # Check for stale PCH before invoking Ninja. Compilers on Windows emit
163 # absolute backslash paths in depfiles which Ninja may fail to track
164 # correctly, leaving the PCH stale even though headers changed.

Callers 2

run_sequential_compileFunction · 0.90
_resolve_test_commandFunction · 0.90

Calls 15

write_lineMethod · 0.95
write_footerMethod · 0.95
closeMethod · 0.95
get_meson_executableFunction · 0.90
check_ninja_skipFunction · 0.90
print_bannerFunction · 0.90
StreamTeeClass · 0.90
TimestampFormatterClass · 0.90
dump_thread_stacksFunction · 0.90

Tested by

no test coverage detected