Compile FastLED examples using Meson. Args: build_dir: Meson build directory examples: List of example names to compile (None = all) verbose: Enable verbose compilation output parallel: Enable parallel compilation (default: True) build_mode: Build mo
(
build_dir: Path,
examples: list[str] | None = None,
verbose: bool = False,
parallel: bool = True,
build_mode: str = "quick",
log_failures: Path | None = None,
)
| 108 | |
| 109 | |
| 110 | def compile_examples( |
| 111 | build_dir: Path, |
| 112 | examples: list[str] | None = None, |
| 113 | verbose: bool = False, |
| 114 | parallel: bool = True, |
| 115 | build_mode: str = "quick", |
| 116 | log_failures: Path | None = None, |
| 117 | ) -> bool: |
| 118 | """ |
| 119 | Compile FastLED examples using Meson. |
| 120 | |
| 121 | Args: |
| 122 | build_dir: Meson build directory |
| 123 | examples: List of example names to compile (None = all) |
| 124 | verbose: Enable verbose compilation output |
| 125 | parallel: Enable parallel compilation (default: True) |
| 126 | build_mode: Build mode ("quick", "debug", or "release") |
| 127 | |
| 128 | Returns: |
| 129 | True if compilation successful, False otherwise |
| 130 | """ |
| 131 | # Build command |
| 132 | cmd = [get_meson_executable(), "compile", "-C", str(build_dir)] |
| 133 | |
| 134 | if verbose: |
| 135 | cmd.append("-v") |
| 136 | |
| 137 | if not parallel: |
| 138 | # Sequential compilation (-j 1) |
| 139 | cmd.extend(["-j", "1"]) |
| 140 | |
| 141 | # Determine targets to build |
| 142 | # Note: process_group already shows "Compiling: <examples>" status |
| 143 | if examples is None: |
| 144 | # Build all examples via the alias target |
| 145 | cmd.append("examples-host") |
| 146 | target_desc = "all examples" |
| 147 | else: |
| 148 | # Build specific example targets |
| 149 | for example_name in examples: |
| 150 | cmd.append(f"example-{example_name}") |
| 151 | target_desc = ", ".join(examples) |
| 152 | |
| 153 | # Start heartbeat for CI environments during long compilations |
| 154 | heartbeat = CompilationHeartbeat(interval_seconds=30) |
| 155 | heartbeat.start(f"Compiling {target_desc} ({build_mode} mode)") |
| 156 | |
| 157 | try: |
| 158 | # Use RunningProcess for streaming output |
| 159 | proc = RunningProcess( |
| 160 | cmd, |
| 161 | timeout=600, # 10 minute timeout |
| 162 | auto_run=True, |
| 163 | check=False, # We'll check returncode manually |
| 164 | # DLLs are auto-deployed by clang-tool-chain 1.0.31+ to output directory |
| 165 | output_formatter=TimestampFormatter(), |
| 166 | ) |
| 167 |
no test coverage detected