dependencies.cmake 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # cmake-format: off
  2. if(OS_WINDOWS OR OS_MACOS)
  3. set(ffmpeg_version 6)
  4. else()
  5. set(ffmpeg_version 4.4)
  6. endif()
  7. find_package(
  8. FFmpeg ${ffmpeg_version}
  9. REQUIRED avcodec
  10. avfilter
  11. avdevice
  12. avutil
  13. swscale
  14. avformat
  15. swresample)
  16. # cmake-format: on
  17. if(NOT TARGET OBS::media-playback)
  18. add_subdirectory("${CMAKE_SOURCE_DIR}/deps/media-playback" "${CMAKE_BINARY_DIR}/deps/media-playback")
  19. endif()
  20. if(NOT TARGET OBS::opts-parser)
  21. add_subdirectory("${CMAKE_SOURCE_DIR}/deps/opts-parser" "${CMAKE_BINARY_DIR}/deps/opts-parser")
  22. endif()
  23. if(OS_WINDOWS)
  24. find_package(AMF 1.4.29 REQUIRED)
  25. add_subdirectory(obs-amf-test)
  26. elseif(
  27. OS_LINUX
  28. OR OS_FREEBSD
  29. OR OS_OPENBSD)
  30. find_package(Libva REQUIRED)
  31. find_package(Libpci REQUIRED)
  32. endif()
  33. if(OS_WINDOWS OR (OS_LINUX AND ENABLE_NATIVE_NVENC))
  34. add_library(obs-nvenc-version INTERFACE)
  35. add_library(OBS::obs-nvenc-version ALIAS obs-nvenc-version)
  36. target_sources(obs-nvenc-version INTERFACE obs-nvenc-ver.h)
  37. target_include_directories(obs-nvenc-version INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
  38. find_package(FFnvcodec 12.0.0.0...<12.2.0.0 REQUIRED)
  39. if(OS_LINUX AND NOT TARGET OBS::glad)
  40. add_subdirectory("${CMAKE_SOURCE_DIR}/deps/glad" "${CMAKE_BINARY_DIR}/deps/glad")
  41. endif()
  42. add_library(obs-nvenc-native INTERFACE)
  43. add_library(OBS::obs-nvenc-native ALIAS obs-nvenc-native)
  44. target_sources(obs-nvenc-native INTERFACE obs-nvenc-helpers.c obs-nvenc.c obs-nvenc.h)
  45. target_compile_definitions(obs-nvenc-native INTERFACE $<$<PLATFORM_ID:Linux>:NVCODEC_AVAILABLE>)
  46. target_include_directories(obs-nvenc-native INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
  47. target_link_libraries(obs-nvenc-native INTERFACE FFnvcodec::FFnvcodec OBS::obs-nvenc-version
  48. $<$<PLATFORM_ID:Linux>:OBS::glad>)
  49. if(OS_WINDOWS)
  50. add_subdirectory(obs-nvenc-test)
  51. endif()
  52. endif()
  53. if(ENABLE_NEW_MPEGTS_OUTPUT)
  54. find_package(Librist QUIET)
  55. find_package(Libsrt QUIET)
  56. foreach(_output_lib IN ITEMS Librist Libsrt)
  57. if(NOT TARGET ${_output_lib}::${_output_lib})
  58. list(APPEND _error_messages "MPEGTS output library ${_output_lib} not found.")
  59. endif()
  60. endforeach()
  61. if(_error_messages)
  62. list(JOIN _error_messages "\n" _error_string)
  63. message(
  64. FATAL_ERROR
  65. "${_error_string}\n Disable this error by setting ENABLE_NEW_MPEGTS_OUTPUT to OFF or providing the build system with required SRT and Rist libraries."
  66. )
  67. endif()
  68. endif()