Skip to content

feat(build,vcpkg): Define FFMPEG as VCPKG feature, disabled by default - #3184

Open
tsunamistate wants to merge 1 commit into
TheSuperHackers:mainfrom
tsunamistate:ffmpeg-feature
Open

feat(build,vcpkg): Define FFMPEG as VCPKG feature, disabled by default#3184
tsunamistate wants to merge 1 commit into
TheSuperHackers:mainfrom
tsunamistate:ffmpeg-feature

Conversation

@tsunamistate

@tsunamistate tsunamistate commented Aug 20, 2026

Copy link
Copy Markdown

Closes #3175

  • Defined FFMPEG as a VCPKG feature, disabled by default
  • Removed RTS_BUILD_OPTION_FFMPEG from config-build.cmake, defining it in the top-level CMakeLists.txt before the project block

Testing:

  1. Clear build folder
  2. Configure the win32-vcpkg preset - cmake --preset win32-vcpkg. Note that FFMPEG is NOT built during vcpkg install.
  3. Build the project - cmake --build --preset win32-vcpkg
  4. Configure the win32-vcpkg preset with FFMPEG support - cmake --preset win32-vcpkg -DRTS_BUILD_OPTION_FFMPEG=ON
  5. Build the project with FFMPEG support - cmake --build --preset win32-vcpkg. FFMPEG is built during the vcpkg install, FFMPEG DLLs are copied to the build folder
  6. Optionally, move or remove BINKW32.DLL from the build folder of FFMPEG support build and launch the game to test if cutscenes still work

No LLMs were used during the creation of this PR

RTFM used:

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Make FFmpeg an optional vcpkg feature (default off)

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Make FFmpeg an opt-in vcpkg manifest feature to avoid default builds.
• Add a CMake option that toggles the vcpkg feature during configure.
• Move FFmpeg build option definition to top-level CMake before project().
Diagram

graph TD
  A["Developer/CI"] --> B["CMake configure"] --> C["CMakeLists.txt option"] --> D["VCPKG_MANIFEST_FEATURES"] --> E["vcpkg.json features"] --> F["vcpkg install"] --> G["FFmpeg port"]

  subgraph Legend
    direction LR
    _usr["Actor/Invoker"] ~~~ _cfg["Config file"] ~~~ _dep[("Dependency")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Set VCPKG_MANIFEST_FEATURES only in CMakePresets/CI
  • ➕ Avoids adding a project-level CMake option just for vcpkg integration
  • ➕ Keeps feature selection closer to environment/preset definitions
  • ➖ Less discoverable for developers configuring manually
  • ➖ Harder to document a single toggle that works across generators/IDEs
2. Use separate manifests (vcpkg.json vs vcpkg-ffmpeg.json)
  • ➕ Very explicit dependency sets; no conditional feature wiring
  • ➕ Can simplify mental model for packagers
  • ➖ More files to maintain; risk of drift between manifests
  • ➖ Requires extra tooling/preset logic to pick the right manifest

Recommendation: The PR’s approach (optional vcpkg feature + a CMake toggle that appends to VCPKG_MANIFEST_FEATURES) is the best default here: it keeps FFmpeg off by default to speed installs, while providing a discoverable, single-switch opt-in path that works in IDE-driven CMake flows.

Files changed (3) +19 / -9

Other (3) +19 / -9
CMakeLists.txtAdd RTS_BUILD_OPTION_FFMPEG and enable vcpkg feature when ON +6/-0

Add RTS_BUILD_OPTION_FFMPEG and enable vcpkg feature when ON

• Defines RTS_BUILD_OPTION_FFMPEG before the project() block and, when enabled, appends "ffmpeg" to VCPKG_MANIFEST_FEATURES so vcpkg installs FFmpeg only on demand.

CMakeLists.txt

config-build.cmakeRemove duplicate RTS_BUILD_OPTION_FFMPEG option definition +0/-1

Remove duplicate RTS_BUILD_OPTION_FFMPEG option definition

• Drops RTS_BUILD_OPTION_FFMPEG from config-build.cmake now that it is defined at the top-level CMakeLists.txt to ensure it is available before project() and vcpkg feature selection.

cmake/config-build.cmake

vcpkg.jsonMake FFmpeg an opt-in vcpkg feature instead of a default dependency +13/-8

Make FFmpeg an opt-in vcpkg feature instead of a default dependency

• Removes ffmpeg from the base dependency list and introduces a new manifest feature "ffmpeg" that depends on the ffmpeg port, keeping default installs smaller unless the feature is enabled.

vcpkg.json

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@Skyaero42
Skyaero42 requested a review from bobtista August 21, 2026 06:19
@bobtista

Copy link
Copy Markdown

This looks good to me - we should merge 2542 first, then rebase this - if this merges first, FFMPEG enabled cold builds may still be broken on the dead MSYS2 download.

We should probably set RTS_BUILD_OPTION_FFMPEG=ON in one GeneralsMD win32-vcpkg CI job, and let's keep it off by default in CMakePresets.

In your PR description for the manual testing instructions, I would use:

cmake --preset win32-vcpkg -DRTS_BUILD_OPTION_FFMPEG=ON
cmake --build --preset win32-vcpkg

@tsunamistate

Copy link
Copy Markdown
Author

Updated test instructions to use the command line

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.

Only build ffmpeg when FFmpeg support is enabled

2 participants