diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index de225c4813a..ed668ab67d5 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -26,6 +26,11 @@ on: default: false type: boolean description: "Build extras" + ffmpeg: + required: false + default: false + type: boolean + description: "Build with FFmpeg support" jobs: build: @@ -133,7 +138,7 @@ jobs: -Source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" "VCPKG_INSTALL_OPTIONS=--x-abi-tools-use-exact-versions" >> $env:GITHUB_ENV - - name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset + - name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}${{ inputs.ffmpeg && '+ffmpeg' || '' }} Preset shell: pwsh run: | $buildFlags = @( @@ -146,6 +151,7 @@ jobs: $buildFlags += "-DRTS_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}" $buildFlags += "-DRTS_BUILD_CORE_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}" $buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}" + $buildFlags += "-DRTS_BUILD_OPTION_FFMPEG=${{ inputs.ffmpeg && 'ON' || 'OFF' }}" Write-Host "Build flags: $($buildFlags -join ' | ')" cmake --preset ${{ inputs.preset }} $buildFlags diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90966e065ba..7c2e4bf42ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,6 +149,7 @@ jobs: - preset: "win32-vcpkg" tools: true extras: true + ffmpeg: true - preset: "win32-vcpkg-profile" tools: true extras: true @@ -162,6 +163,7 @@ jobs: preset: ${{ matrix.preset }} tools: ${{ matrix.tools }} extras: ${{ matrix.extras }} + ffmpeg: ${{ matrix.ffmpeg || false}} secrets: inherit replaycheck-generalsmd: diff --git a/CMakeLists.txt b/CMakeLists.txt index 39062e3fbe6..9ee9c7de0c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,10 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR) message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt") endif() +# Define VCPKG feature before the project block +# since they need to be initialized before the toolchain is +include(cmake/config-vcpkg.cmake) + # Top level project, doesn't really affect anything. project(genzh LANGUAGES C CXX) diff --git a/cmake/config-build.cmake b/cmake/config-build.cmake index 7973f5a1f03..d0201bed604 100644 --- a/cmake/config-build.cmake +++ b/cmake/config-build.cmake @@ -8,7 +8,6 @@ option(RTS_BUILD_OPTION_PROFILE_TRACY "Build code with Tracy profiling enabled." option(RTS_BUILD_OPTION_DEBUG "Build code with the \"Debug\" configuration." OFF) option(RTS_BUILD_OPTION_ASAN "Build code with Address Sanitizer." OFF) option(RTS_BUILD_OPTION_VC6_FULL_DEBUG "Build VC6 with full debug info." OFF) -option(RTS_BUILD_OPTION_FFMPEG "Enable FFmpeg support" OFF) if(NOT RTS_BUILD_ZEROHOUR AND NOT RTS_BUILD_GENERALS) set(RTS_BUILD_ZEROHOUR TRUE) diff --git a/cmake/config-vcpkg.cmake b/cmake/config-vcpkg.cmake new file mode 100644 index 00000000000..81fa8f0b4ce --- /dev/null +++ b/cmake/config-vcpkg.cmake @@ -0,0 +1,6 @@ +# Contains options for VCPKG features + +option(RTS_BUILD_OPTION_FFMPEG "Enable FFmpeg support" OFF) +if(RTS_BUILD_OPTION_FFMPEG) + list(APPEND VCPKG_MANIFEST_FEATURES "ffmpeg") +endif() diff --git a/vcpkg.json b/vcpkg.json index 6242036392f..22db4fd2b7a 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,9 +1,14 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", - "builtin-baseline": "9e593bb18ea69cc5095e012465dcd675a822ed0d", - "dependencies": [ - "zlib", - "ffmpeg", - "stb" - ] - } \ No newline at end of file + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "builtin-baseline": "9e593bb18ea69cc5095e012465dcd675a822ed0d", + "dependencies": [ + "zlib", + "stb" + ], + "features": { + "ffmpeg": { + "description": "Use FFmpeg instead of Bink for video rendering", + "dependencies": [ "ffmpeg" ] + } + } +}