Build the environment dict for ``meson setup``. Uses raw compiler binaries when resolvable (avoids ~3.6s Python wrapper overhead) but falls back to the wrappers if clang_tool_chain isn't available.
(compiler: CompilerDetection)
| 225 | |
| 226 | |
| 227 | def build_setup_env(compiler: CompilerDetection) -> dict[str, str]: |
| 228 | """Build the environment dict for ``meson setup``. |
| 229 | |
| 230 | Uses raw compiler binaries when resolvable (avoids ~3.6s Python wrapper |
| 231 | overhead) but falls back to the wrappers if clang_tool_chain isn't |
| 232 | available. |
| 233 | """ |
| 234 | env = os.environ.copy() |
| 235 | if compiler.cache_binary: |
| 236 | env.setdefault("ZCCACHE_STRICT_PATHS", "absolute") |
| 237 | |
| 238 | fast_compiler = _resolve_fast_compiler_binary() |
| 239 | if fast_compiler: |
| 240 | try: |
| 241 | from clang_tool_chain.platform.paths import find_tool_binary |
| 242 | |
| 243 | fast_c = str(find_tool_binary("clang")) |
| 244 | fast_ar = str(find_tool_binary("llvm-ar")) |
| 245 | env["CC"] = fast_c |
| 246 | env["CXX"] = fast_compiler |
| 247 | env["AR"] = fast_ar |
| 248 | except KeyboardInterrupt as ki: |
| 249 | handle_keyboard_interrupt(ki) |
| 250 | except Exception: |
| 251 | env["CC"] = compiler.clang_wrapper |
| 252 | env["CXX"] = compiler.clangxx_wrapper |
| 253 | env["AR"] = compiler.llvm_ar_wrapper |
| 254 | else: |
| 255 | env["CC"] = compiler.clang_wrapper |
| 256 | env["CXX"] = compiler.clangxx_wrapper |
| 257 | env["AR"] = compiler.llvm_ar_wrapper |
| 258 | |
| 259 | return env |
| 260 | |
| 261 | |
| 262 | def handle_skip_meson_setup( |
no test coverage detected