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

Function main

ci/wasm_compile_pch.py:409–482  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407
408
409def main() -> int:
410 parser = argparse.ArgumentParser(
411 description="Compile WASM precompiled header for faster builds"
412 )
413 parser.add_argument(
414 "--mode",
415 default="quick",
416 choices=["debug", "fast_debug", "quick", "release"],
417 help="Build mode (default: quick)",
418 )
419 parser.add_argument(
420 "--force",
421 action="store_true",
422 help="Force PCH rebuild even if up to date",
423 )
424 parser.add_argument(
425 "--clean",
426 action="store_true",
427 help="Remove PCH artifacts and exit",
428 )
429 parser.add_argument(
430 "-v",
431 "--verbose",
432 action="store_true",
433 help="Verbose output",
434 )
435
436 args = parser.parse_args()
437
438 try:
439 # Handle clean command
440 if args.clean:
441 return clean_pch()
442
443 # Verify PCH header exists
444 if not PCH_HEADER.exists():
445 print(f"Error: PCH header not found: {PCH_HEADER}", file=sys.stderr)
446 return 1
447
448 # Get tool command
449 emcc = get_emcc()
450 if args.verbose:
451 print(f"Using emscripten: {emcc}")
452
453 # Load build flags from TOML
454 flags = get_lib_compile_flags_dict(args.mode)
455 if args.verbose:
456 print(
457 f"Loaded {len(flags['defines'])} defines, {len(flags['compiler_flags'])} compiler flags"
458 )
459
460 # Check if rebuild is needed
461 rebuild_needed, reason = needs_rebuild(emcc, flags, args.force)
462
463 if not rebuild_needed:
464 print(f"✓ PCH is up to date ({reason})")
465 return 0
466

Callers 1

Calls 8

get_emccFunction · 0.90
clean_pchFunction · 0.85
compile_pchFunction · 0.85
parse_argsMethod · 0.80
needs_rebuildFunction · 0.70
printFunction · 0.50

Tested by

no test coverage detected