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

Function write_meson_native_file

ci/meson/meson_setup_execute.py:152–224  ·  view source on GitHub ↗

Generate/update the Meson native file with tool paths + platform info. The compiler entries point at the BARE ctc-clang/ctc-clang++ binaries. zccache wrapping is applied later as a post-patch on ``build.ninja`` via ``inject_zccache_wrapping`` so the meson configure-phase probes (e.g.

(
    *,
    native_file_path: Path,
    compiler: CompilerDetection,
)

Source from the content-addressed store, hash-verified

150
151
152def write_meson_native_file(
153 *,
154 native_file_path: Path,
155 compiler: CompilerDetection,
156) -> None:
157 """Generate/update the Meson native file with tool paths + platform info.
158
159 The compiler entries point at the BARE ctc-clang/ctc-clang++ binaries.
160 zccache wrapping is applied later as a post-patch on ``build.ninja`` via
161 ``inject_zccache_wrapping`` so the meson configure-phase probes (e.g.
162 ``-xc++ -E -v -``) run against the bare compiler and complete in <1s
163 instead of timing out under zccache. See issue #2714.
164 """
165 try:
166 fast = _resolve_fast_native_entries()
167 if fast.cc is not None:
168 c_compiler = fast.cc
169 cpp_compiler = fast.cxx
170 ar_tool = fast.ar
171 else:
172 c_compiler = f"['{compiler.clang_wrapper}']"
173 cpp_compiler = f"['{compiler.clangxx_wrapper}']"
174 ar_tool = f"['{compiler.llvm_ar_wrapper}']"
175
176 is_windows = sys.platform.startswith("win") or os.name == "nt"
177 is_darwin = sys.platform == "darwin"
178
179 machine = platform.machine().lower()
180 if machine in ("x86_64", "amd64"):
181 cpu_family = "x86_64"
182 cpu = "x86_64"
183 elif machine in ("arm64", "aarch64"):
184 cpu_family = "aarch64"
185 cpu = "aarch64"
186 else:
187 cpu_family = "x86_64"
188 cpu = "x86_64"
189
190 if is_windows:
191 host_system = "windows"
192 elif is_darwin:
193 host_system = "darwin"
194 else:
195 host_system = "linux"
196
197 native_file_content = f"""# ============================================================================
198# Meson Native Build Configuration for FastLED (Auto-generated)
199# ============================================================================
200# This file is auto-generated by meson_runner.py to configure tool paths.
201# It persists across build regenerations when ninja detects meson.build changes.
202#
203# IMPORTANT: LLD linker is forced via -fuse-ld=lld in meson.build link_args.
204# This ensures consistent linker behavior across Windows, Linux, and macOS.
205
206[binaries]
207c = {c_compiler}
208cpp = {cpp_compiler}
209ar = {ar_tool}

Callers 1

setup_meson_buildFunction · 0.90

Calls 2

write_if_differentFunction · 0.90

Tested by

no test coverage detected