CMakeLists.txt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. project(linux-capture)
  2. option(ENABLE_PIPEWIRE "Enable PipeWire support" ON)
  3. if(NOT ENABLE_PIPEWIRE)
  4. message(STATUS "OBS: - PipeWire support disabled")
  5. endif()
  6. find_package(X11 REQUIRED)
  7. if(NOT TARGET X11::Xcomposite)
  8. message(
  9. FATAL_ERROR "OBS: DISABLED linux-capture - Xcomposite library not found")
  10. endif()
  11. find_package(XCB COMPONENTS XCB XFIXES RANDR SHM XINERAMA)
  12. add_library(linux-capture MODULE)
  13. add_library(OBS::capture ALIAS linux-capture)
  14. target_sources(
  15. linux-capture
  16. PRIVATE linux-capture.c
  17. xcursor.c
  18. xcursor.h
  19. xcursor-xcb.c
  20. xcursor-xcb.h
  21. xhelpers.c
  22. xhelpers.h
  23. xshm-input.c
  24. xcomposite-main.cpp
  25. xcompcap-main.cpp
  26. xcompcap-main.hpp
  27. xcompcap-helper.cpp
  28. xcompcap-helper.hpp)
  29. target_link_libraries(
  30. linux-capture
  31. PRIVATE OBS::libobs
  32. OBS::obsglad
  33. X11::X11
  34. X11::Xfixes
  35. X11::Xcomposite
  36. XCB::XCB
  37. XCB::XFIXES
  38. XCB::RANDR
  39. XCB::SHM
  40. XCB::XINERAMA)
  41. set_target_properties(linux-capture PROPERTIES FOLDER "plugins")
  42. if(ENABLE_PIPEWIRE)
  43. find_package(PipeWire 0.3.32 QUIET)
  44. find_package(Gio QUIET)
  45. find_package(Libdrm QUIET)
  46. if(NOT TARGET PipeWire::PipeWire)
  47. message(
  48. FATAL_ERROR
  49. "OBS: - PipeWire library not found! Please install PipeWire or set ENABLE_PIPEWIRE=OFF"
  50. )
  51. elseif(NOT TARGET GIO::GIO)
  52. message(
  53. FATAL_ERROR
  54. "OBS: - Gio library not found! Please install GLib2 (or Gio) or set ENABLE_PIPEWIRE=OFF"
  55. )
  56. elseif(NOT TARGET Libdrm::Libdrm)
  57. message(
  58. FATAL_ERROR
  59. "OBS: - libdrm headers not found! Please install libdrm or set ENABLE_PIPEWIRE=OFF"
  60. )
  61. endif()
  62. target_sources(linux-capture PRIVATE pipewire.c pipewire.h pipewire-capture.c
  63. pipewire-capture.h portal.c portal.h)
  64. target_link_libraries(linux-capture PRIVATE PipeWire::PipeWire GIO::GIO
  65. Libdrm::Libdrm)
  66. target_compile_definitions(linux-capture PRIVATE ENABLE_PIPEWIRE)
  67. endif()
  68. setup_plugin_target(linux-capture)