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

Function _ensure_native_launcher

ci/meson/native_launchers.py:82–113  ·  view source on GitHub ↗

Ensure ctc-clang/ctc-clang++ native launchers are compiled. The native launcher is a compiled C++ binary that replaces the Python clang-tool-chain wrapper with near-zero startup overhead (~34ms vs ~1200ms). It auto-detects the platform, finds the clang installation, and adds all

(project_root: Path)

Source from the content-addressed store, hash-verified

80
81
82def _ensure_native_launcher(project_root: Path) -> tuple[Optional[str], Optional[str]]:
83 """
84 Ensure ctc-clang/ctc-clang++ native launchers are compiled.
85
86 The native launcher is a compiled C++ binary that replaces the Python
87 clang-tool-chain wrapper with near-zero startup overhead (~34ms vs ~1200ms).
88 It auto-detects the platform, finds the clang installation, and adds all
89 necessary flags (--target, --sysroot, -stdlib, includes, etc.) automatically.
90
91 Returns:
92 Tuple of (ctc_clang_path, ctc_clangpp_path), or (None, None) on failure.
93 """
94 output_dir = _native_launcher_output_dir(project_root)
95 exe_suffix = ".exe" if sys.platform == "win32" else ""
96 ctc_clang = output_dir / f"ctc-clang{exe_suffix}"
97 ctc_clangpp = output_dir / f"ctc-clang++{exe_suffix}"
98
99 if ctc_clang.exists() and ctc_clangpp.exists():
100 return str(ctc_clang), str(ctc_clangpp)
101
102 try:
103 from clang_tool_chain.commands.compile_native import compile_native
104
105 output_dir.mkdir(parents=True, exist_ok=True)
106 rc = compile_native(str(output_dir))
107 if rc == 0 and ctc_clang.exists() and ctc_clangpp.exists():
108 return str(ctc_clang), str(ctc_clangpp)
109 except KeyboardInterrupt as ki:
110 handle_keyboard_interrupt(ki)
111 except Exception:
112 pass
113 return None, None
114
115
116def _ensure_emcc_native_launcher(project_root: Path) -> EmccNativeLaunchers:

Callers 1

Calls 2

Tested by

no test coverage detected