Skip to content

Make bundled codec build parallelism configurable - #202

Merged
danoli3 merged 2 commits into
masterfrom
fix/bundled-codec-parallel-jobs
Oct 25, 2026
Merged

danoli3 merged 2 commits into
masterfrom
fix/bundled-codec-parallel-jobs

Conversation

@danoli3

@danoli3 danoli3 commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Bundled HEIF/AVIF and JPEG XL dependency builds currently hard-code --parallel 2, so raising the top-level build's parallel limit cannot increase the workers used inside a dependency. Select nested-build parallelism automatically at build time instead.

The default uses the standard CMAKE_BUILD_PARALLEL_LEVEL environment variable when set, otherwise CMake's ProcessorCount() detects the available logical CPUs (with a one-job fallback). FREEIMAGE_CODEC_BUILD_JOBS defaults to empty/automatic; an explicit positive integer overrides the environment for nested codec builds only. Environment changes take effect without reconfiguration.

Independent dependencies retain their existing ExternalProject dependencies. The README explains the top-level and per-dependency settings and removes the fixed four-job example. Bundled-codec CI detects each runner's CPU count and uses the standard environment variable for the main build and its dependencies. These limits apply per build, rather than forming one shared job pool.

Validation:

  • Rebuilt bundled HEIF with automatic detection: all 10 available logical CPUs were selected; all 12 tests passed on macOS.
  • Built smoke projects with Ninja, Unix Makefiles, and Ninja Multi-Config using CPU detection, runtime environment changes (3 then 5 jobs without reconfiguring), and an explicit per-codec override.
  • Verified all eight bundled dependency commands invoke the helper, including Debug multi-configuration builds.
  • Confirmed invalid cache/environment settings are rejected and nested build failures propagate.

Fixes #201.

@haobinnan

Copy link
Copy Markdown
Contributor

I don't recommend limiting parallel builds to --parallel 4, as this would restrict build performance on systems with more CPU cores. I suggest omitting the job count so that CMake can automatically use all available CPU threads.

@danoli3
danoli3 marked this pull request as ready for review October 25, 2026 04:13
@danoli3

danoli3 commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Fixed with CPU detection or CMAKE_BUILD_PARALLEL_LEVEL

@danoli3
danoli3 merged commit a92f3c6 into master Oct 25, 2026
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Parallel Builds for HEIF-Related Libraries in CMake

2 participants