Skip to content

Commit dcf0d77

Browse files
authored
build(vcpkg): Define FFmpeg as VCPKG feature, disabled by default (#3184)
1 parent 3d7b15f commit dcf0d77

6 files changed

Lines changed: 32 additions & 10 deletions

File tree

.github/workflows/build-toolchain.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ on:
2626
default: false
2727
type: boolean
2828
description: "Build extras"
29+
ffmpeg:
30+
required: false
31+
default: false
32+
type: boolean
33+
description: "Build with FFmpeg support"
2934

3035
jobs:
3136
build:
@@ -133,7 +138,7 @@ jobs:
133138
-Source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
134139
"VCPKG_INSTALL_OPTIONS=--x-abi-tools-use-exact-versions" >> $env:GITHUB_ENV
135140
136-
- name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
141+
- name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}${{ inputs.ffmpeg && '+ffmpeg' || '' }} Preset
137142
shell: pwsh
138143
run: |
139144
$buildFlags = @(
@@ -146,6 +151,7 @@ jobs:
146151
$buildFlags += "-DRTS_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
147152
$buildFlags += "-DRTS_BUILD_CORE_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
148153
$buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
154+
$buildFlags += "-DRTS_BUILD_OPTION_FFMPEG=${{ inputs.ffmpeg && 'ON' || 'OFF' }}"
149155
150156
Write-Host "Build flags: $($buildFlags -join ' | ')"
151157
cmake --preset ${{ inputs.preset }} $buildFlags

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ jobs:
149149
- preset: "win32-vcpkg"
150150
tools: true
151151
extras: true
152+
ffmpeg: true
152153
- preset: "win32-vcpkg-profile"
153154
tools: true
154155
extras: true
@@ -162,6 +163,7 @@ jobs:
162163
preset: ${{ matrix.preset }}
163164
tools: ${{ matrix.tools }}
164165
extras: ${{ matrix.extras }}
166+
ffmpeg: ${{ matrix.ffmpeg || false}}
165167
secrets: inherit
166168

167169
replaycheck-generalsmd:

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
3030
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
3131
endif()
3232

33+
# Define VCPKG feature before the project block
34+
# since they need to be initialized before the toolchain is
35+
include(cmake/config-vcpkg.cmake)
36+
3337
# Top level project, doesn't really affect anything.
3438
project(genzh LANGUAGES C CXX)
3539

cmake/config-build.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ option(RTS_BUILD_OPTION_PROFILE_TRACY "Build code with Tracy profiling enabled."
88
option(RTS_BUILD_OPTION_DEBUG "Build code with the \"Debug\" configuration." OFF)
99
option(RTS_BUILD_OPTION_ASAN "Build code with Address Sanitizer." OFF)
1010
option(RTS_BUILD_OPTION_VC6_FULL_DEBUG "Build VC6 with full debug info." OFF)
11-
option(RTS_BUILD_OPTION_FFMPEG "Enable FFmpeg support" OFF)
1211

1312
if(NOT RTS_BUILD_ZEROHOUR AND NOT RTS_BUILD_GENERALS)
1413
set(RTS_BUILD_ZEROHOUR TRUE)

cmake/config-vcpkg.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Contains options for VCPKG features
2+
3+
option(RTS_BUILD_OPTION_FFMPEG "Enable FFmpeg support" OFF)
4+
if(RTS_BUILD_OPTION_FFMPEG)
5+
list(APPEND VCPKG_MANIFEST_FEATURES "ffmpeg")
6+
endif()

vcpkg.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
3-
"builtin-baseline": "9e593bb18ea69cc5095e012465dcd675a822ed0d",
4-
"dependencies": [
5-
"zlib",
6-
"ffmpeg",
7-
"stb"
8-
]
9-
}
2+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
3+
"builtin-baseline": "9e593bb18ea69cc5095e012465dcd675a822ed0d",
4+
"dependencies": [
5+
"zlib",
6+
"stb"
7+
],
8+
"features": {
9+
"ffmpeg": {
10+
"description": "Use FFmpeg instead of Bink for video rendering",
11+
"dependencies": [ "ffmpeg" ]
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)