auto apply discord patch

This commit is contained in:
ThePotato97 2026-01-03 19:22:08 +00:00
parent a26bc592d7
commit 0153525802
2 changed files with 15 additions and 25 deletions

View file

@ -30,31 +30,6 @@ jobs:
$packages = "openssl:x64-windows-static", "nlohmann-json:x64-windows-static", "webview2:x64-windows-static", "curl:x64-windows-static"
vcpkg install $packages
- name: Apply Discord RPC Patch
shell: bash
run: |
# Apply the patch to the submodule
# The patch file is expected to be in deps/discord-rpc.patch
if [ -f "deps/discord-rpc.patch" ]; then
echo "Applying discord-rpc patch..."
cd deps/discord-rpc
git apply ../discord-rpc.patch
else
echo "Patch file deps/discord-rpc.patch not found!"
exit 1
fi
- name: Extract libmpv
run: |
$rarPath = "deps/libmpv/x86_64/libmpv-2.dll.rar"
$outPath = "deps/libmpv/x86_64/libmpv-2.dll"
if (Test-Path $rarPath) {
Write-Host "Extracting $rarPath..."
& "7z" x $rarPath -o"deps/libmpv/x86_64/" -y
} else {
Write-Warning "$rarPath not found."
}
- name: Configure CMake
run: |
cmake -S . -B out -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static

View file

@ -108,6 +108,21 @@ if(EXISTS "${MPV_RAR}" AND NOT EXISTS "${MPV_DLL}")
endif()
endif()
# Automate discord-rpc patching
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/deps/discord-rpc/include/discord_rpc.h" RPC_HEADER_CONTENT)
if(NOT RPC_HEADER_CONTENT MATCHES "statusDisplayType")
message(STATUS "Patching discord-rpc...")
find_package(Git REQUIRED)
execute_process(
COMMAND ${GIT_EXECUTABLE} apply --directory=deps/discord-rpc "${CMAKE_CURRENT_SOURCE_DIR}/deps/discord-rpc.patch"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE PATCH_RESULT
)
if(NOT PATCH_RESULT EQUAL 0)
message(FATAL_ERROR "Failed to apply discord-rpc.patch. Please apply manually or check git state.")
endif()
endif()
option(BUILD_EXAMPLES "Build example apps" OFF)
add_subdirectory(deps/discord-rpc)
set(DISCORD_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/discord-rpc/include")