Build the FastLED static library. Args: build_mode: Build mode (debug, fast_debug, quick, release) force: Force rebuild all objects verbose: Enable verbose output parallel: Number of parallel jobs (None = CPU count) unity_chunks: Number of unity buil
(
build_mode: str = "quick",
force: bool = False,
verbose: bool = False,
parallel: int | None = None,
unity_chunks: int = 0,
)
| 527 | |
| 528 | |
| 529 | def build_library( |
| 530 | build_mode: str = "quick", |
| 531 | force: bool = False, |
| 532 | verbose: bool = False, |
| 533 | parallel: int | None = None, |
| 534 | unity_chunks: int = 0, |
| 535 | ) -> int: |
| 536 | """ |
| 537 | Build the FastLED static library. |
| 538 | |
| 539 | Args: |
| 540 | build_mode: Build mode (debug, fast_debug, quick, release) |
| 541 | force: Force rebuild all objects |
| 542 | verbose: Enable verbose output |
| 543 | parallel: Number of parallel jobs (None = CPU count) |
| 544 | unity_chunks: Number of unity build chunks (0 = disabled, >0 = enabled) |
| 545 | |
| 546 | Returns: |
| 547 | Exit code (0 = success) |
| 548 | """ |
| 549 | try: |
| 550 | import time |
| 551 | |
| 552 | start_time = time.time() |
| 553 | |
| 554 | unity_mode = unity_chunks > 0 |
| 555 | if unity_mode: |
| 556 | print( |
| 557 | f"Building FastLED library (mode: {build_mode}, UNITY: {unity_chunks} chunks)..." |
| 558 | ) |
| 559 | else: |
| 560 | print(f"Building FastLED library (mode: {build_mode})...") |
| 561 | |
| 562 | # Step 1: Create build directories (including LTO cache and unity) |
| 563 | BUILD_DIR.mkdir(parents=True, exist_ok=True) |
| 564 | LTO_CACHE_DIR.mkdir(parents=True, exist_ok=True) |
| 565 | if unity_mode: |
| 566 | UNITY_DIR.mkdir(parents=True, exist_ok=True) |
| 567 | |
| 568 | # Step 2: Ensure PCH is built |
| 569 | pch_result = ensure_pch_built(build_mode, verbose) |
| 570 | if pch_result != 0: |
| 571 | return pch_result |
| 572 | |
| 573 | # Step 2b: Generate unity build files (if enabled) |
| 574 | if unity_mode: |
| 575 | unity_result = ensure_unity_files_generated(unity_chunks, verbose) |
| 576 | if unity_result != 0: |
| 577 | return unity_result |
| 578 | |
| 579 | # Step 3: Get tool commands |
| 580 | emcc = get_emcc() |
| 581 | emar = get_emar() |
| 582 | wasm_ld = get_wasm_ld() |
| 583 | |
| 584 | if verbose: |
| 585 | print(f"Using emscripten: {emcc}") |
| 586 | print(f"Using archiver: {emar}") |
no test coverage detected