nixpkgs/pkgs/servers/sunshine/ffmpeg.diff
2023-06-17 09:20:17 -05:00

76 lines
2.8 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ccca6fc..8789a4a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -349,6 +349,8 @@ else()
set(WAYLAND_FOUND OFF)
endif()
+ find_package(FFMPEG REQUIRED)
+
if(X11_FOUND)
add_compile_definitions(SUNSHINE_BUILD_X11)
include_directories(SYSTEM ${X11_INCLUDE_DIR})
@@ -547,43 +549,7 @@ set_source_files_properties(third-party/nanors/rs.c
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY=${SUNSHINE_TRAY})
-# Pre-compiled binaries
-if(WIN32)
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-windows-x86_64")
- set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid mfx)
-elseif(APPLE)
- if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-macos-aarch64")
- else()
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-macos-x86_64")
- endif()
-else()
set(FFMPEG_PLATFORM_LIBRARIES va va-drm va-x11 vdpau X11)
- if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-linux-aarch64")
- else()
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-linux-x86_64")
- list(APPEND FFMPEG_PLATFORM_LIBRARIES mfx)
- set(CPACK_DEB_PLATFORM_PACKAGE_DEPENDS "libmfx1,")
- set(CPACK_RPM_PLATFORM_PACKAGE_REQUIRES "intel-mediasdk >= 22.3.0,")
- endif()
-endif()
-set(FFMPEG_INCLUDE_DIRS
- ${FFMPEG_PREPARED_BINARIES}/include)
-if(EXISTS ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a)
- set(HDR10_PLUS_LIBRARY
- ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a)
-endif()
-set(FFMPEG_LIBRARIES
- ${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libx264.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libx265.a
- ${HDR10_PLUS_LIBRARY}
- ${FFMPEG_PLATFORM_LIBRARIES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
@@ -593,7 +559,6 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/third-party/moonlight-common-c/enet/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/nanors
${CMAKE_CURRENT_SOURCE_DIR}/third-party/nanors/deps/obl
- ${FFMPEG_INCLUDE_DIRS}
${PLATFORM_INCLUDE_DIRS}
)
@@ -627,7 +592,9 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
${CMAKE_THREAD_LIBS_INIT}
enet
opus
+ cbs
${FFMPEG_LIBRARIES}
+ ${FFMPEG_PLATFORM_LIBRARIES}
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
${CURL_LIBRARIES}