Przeglądaj źródła

cmake: Add changes for CMake build framework 3.0

New code path only taken if OBS_CMAKE_VERSION is set to 3.0.0 or
greater, old functionality remains unchanged.
PatTheMav 2 lat temu
rodzic
commit
db895092ed
84 zmienionych plików z 1629 dodań i 682 usunięć
  1. 1 2
      CMakeLists.txt
  2. 6 5
      UI/CMakeLists.txt
  3. 1 1
      UI/cmake/feature-importers.cmake
  4. 1 1
      UI/cmake/feature-whatsnew.cmake
  5. 2 2
      UI/cmake/feature-youtube.cmake
  6. 4 6
      UI/cmake/os-windows.cmake
  7. 2 1
      UI/cmake/ui-qt.cmake
  8. BIN
      UI/cmake/windows/obs-studio.ico
  9. 20 0
      UI/cmake/windows/obs.manifest
  10. 26 0
      UI/cmake/windows/obs.rc.in
  11. 1 8
      UI/win-update/updater/CMakeLists.txt
  12. 0 4
      deps/CMakeLists.txt
  13. 8 14
      deps/ipc-util/CMakeLists.txt
  14. 20 27
      libobs-d3d11/CMakeLists.txt
  15. 50 0
      libobs-d3d11/cmake/legacy.cmake
  16. 24 0
      libobs-d3d11/cmake/windows/obs-module.rc.in
  17. 0 20
      libobs-d3d11/d3d11-config.h.in
  18. 2 2
      libobs-d3d11/d3d11-subsystem.cpp
  19. 15 13
      libobs-winrt/CMakeLists.txt
  20. 31 0
      libobs-winrt/cmake/legacy.cmake
  21. 5 7
      libobs/CMakeLists.txt
  22. 18 24
      libobs/cmake/os-freebsd.cmake
  23. 15 24
      libobs/cmake/os-linux.cmake
  24. 1 1
      libobs/cmake/os-windows.cmake
  25. 1 9
      libobs/obs-windows.c
  26. 0 3
      plugins/coreaudio-encoder/CMakeLists.txt
  27. 21 18
      plugins/obs-ffmpeg/CMakeLists.txt
  28. 8 7
      plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt
  29. 14 0
      plugins/obs-ffmpeg/obs-amf-test/cmake/legacy.cmake
  30. 8 6
      plugins/obs-ffmpeg/obs-nvenc-test/CMakeLists.txt
  31. 12 0
      plugins/obs-ffmpeg/obs-nvenc-test/cmake/legacy.cmake
  32. 4 0
      plugins/obs-ffmpeg/obs-nvenc-test/obs-nvenc-test.c
  33. 23 26
      plugins/obs-outputs/cmake/ftl.cmake
  34. 62 75
      plugins/obs-qsv11/CMakeLists.txt
  35. 125 0
      plugins/obs-qsv11/cmake/legacy.cmake
  36. 24 0
      plugins/obs-qsv11/cmake/windows/obs-module.rc.in
  37. 7 6
      plugins/obs-qsv11/obs-qsv-test/CMakeLists.txt
  38. 11 0
      plugins/obs-qsv11/obs-qsv-test/cmake/legacy.cmake
  39. 8 11
      plugins/obs-text/CMakeLists.txt
  40. 19 0
      plugins/obs-text/cmake/legacy.cmake
  41. 24 0
      plugins/obs-text/cmake/windows/obs-module.rc.in
  42. 58 33
      plugins/win-capture/CMakeLists.txt
  43. 3 0
      plugins/win-capture/cmake/32bit-build.cmake
  44. 63 0
      plugins/win-capture/cmake/legacy.cmake
  45. 5 0
      plugins/win-capture/duplicator-monitor-capture.c
  46. 13 21
      plugins/win-capture/get-graphics-offsets/CMakeLists.txt
  47. 5 0
      plugins/win-capture/get-graphics-offsets/cmake/32bit-build.cmake
  48. 5 0
      plugins/win-capture/get-graphics-offsets/cmake/32bit.cmake
  49. 33 0
      plugins/win-capture/get-graphics-offsets/cmake/legacy.cmake
  50. 4 0
      plugins/win-capture/get-graphics-offsets/d3d8-offsets.cpp
  51. 4 0
      plugins/win-capture/get-graphics-offsets/get-graphics-offsets.h
  52. 41 41
      plugins/win-capture/graphics-hook/CMakeLists.txt
  53. 9 0
      plugins/win-capture/graphics-hook/cmake/32bit-build.cmake
  54. 5 0
      plugins/win-capture/graphics-hook/cmake/32bit.cmake
  55. 58 0
      plugins/win-capture/graphics-hook/cmake/legacy.cmake
  56. 4 0
      plugins/win-capture/graphics-hook/d3d8-capture.cpp
  57. 5 0
      plugins/win-capture/graphics-hook/graphics-hook.c
  58. 4 0
      plugins/win-capture/graphics-hook/graphics-hook.h
  59. 15 12
      plugins/win-capture/inject-helper/CMakeLists.txt
  60. 5 0
      plugins/win-capture/inject-helper/cmake/32bit-build.cmake
  61. 5 0
      plugins/win-capture/inject-helper/cmake/32bit.cmake
  62. 21 0
      plugins/win-capture/inject-helper/cmake/legacy.cmake
  63. 5 0
      plugins/win-capture/inject-helper/inject-helper.c
  64. 4 0
      plugins/win-capture/inject-library.c
  65. 2 0
      plugins/win-capture/plugin-main.c
  66. 5 0
      plugins/win-capture/window-capture.c
  67. 25 192
      plugins/win-dshow/CMakeLists.txt
  68. 216 0
      plugins/win-dshow/cmake/legacy.cmake
  69. 56 0
      plugins/win-dshow/cmake/libdshowcapture.cmake
  70. 24 0
      plugins/win-dshow/cmake/windows/obs-module.rc.in
  71. 89 51
      plugins/win-dshow/virtualcam-module/CMakeLists.txt
  72. 49 0
      plugins/win-dshow/virtualcam-module/cmake/32bit-build.cmake
  73. 5 0
      plugins/win-dshow/virtualcam-module/cmake/32bit.cmake
  74. 60 0
      plugins/win-dshow/virtualcam-module/cmake/legacy.cmake
  75. 24 0
      plugins/win-dshow/virtualcam-module/cmake/windows/obs-module.rc.in
  76. 8 0
      plugins/win-dshow/virtualcam-module/cmake/windows/virtualcam-module32.def
  77. 8 0
      plugins/win-dshow/virtualcam-module/cmake/windows/virtualcam-module64.def
  78. 10 0
      plugins/win-dshow/virtualcam-module/virtualcam-filter.hpp
  79. 0 0
      plugins/win-dshow/virtualcam-module/virtualcam-guid.h.in
  80. 0 0
      plugins/win-dshow/virtualcam-module/virtualcam-install.bat.in
  81. 0 0
      plugins/win-dshow/virtualcam-module/virtualcam-uninstall.bat.in
  82. 8 9
      plugins/win-wasapi/CMakeLists.txt
  83. 18 0
      plugins/win-wasapi/cmake/legacy.cmake
  84. 24 0
      plugins/win-wasapi/cmake/windows/obs-module.rc.in

+ 1 - 2
CMakeLists.txt

@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 3.16...3.25)
 cmake_minimum_required(VERSION 3.16...3.25)
 
 
-if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
+if(CMAKE_HOST_SYSTEM_NAME MATCHES "(Darwin)" OR OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
   include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
   include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
 
 
   project(obs-studio VERSION ${OBS_VERSION_CANONICAL})
   project(obs-studio VERSION ${OBS_VERSION_CANONICAL})
@@ -14,7 +14,6 @@ if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
   include(defaults)
   include(defaults)
   include(helpers)
   include(helpers)
 
 
-  option(ENABLE_RELEASE_BUILD "Enable all options for a release build" OFF)
   option(ENABLE_UI "Enable building with UI (requires Qt)" ON)
   option(ENABLE_UI "Enable building with UI (requires Qt)" ON)
   option(ENABLE_SCRIPTING "Enable scripting support" ON)
   option(ENABLE_SCRIPTING "Enable scripting support" ON)
   option(ENABLE_HEVC "Enable HEVC encoders" ON)
   option(ENABLE_HEVC "Enable HEVC encoders" ON)

+ 6 - 5
UI/CMakeLists.txt

@@ -45,11 +45,10 @@ include(cmake/feature-importers.cmake)
 include(cmake/feature-browserpanels.cmake)
 include(cmake/feature-browserpanels.cmake)
 
 
 if(NOT OAUTH_BASE_URL)
 if(NOT OAUTH_BASE_URL)
-  set(OAUTH_BASE_URL
-      "https://auth.obsproject.com/"
-      CACHE STRING "Default OAuth base URL")
-
+  # cmake-format: off
+  set(OAUTH_BASE_URL "https://auth.obsproject.com/" CACHE STRING "Default OAuth base URL")
   mark_as_advanced(OAUTH_BASE_URL)
   mark_as_advanced(OAUTH_BASE_URL)
+  # cmake-format: on
 endif()
 endif()
 include(cmake/feature-twitch.cmake)
 include(cmake/feature-twitch.cmake)
 include(cmake/feature-restream.cmake)
 include(cmake/feature-restream.cmake)
@@ -109,4 +108,6 @@ foreach(graphics_library IN ITEMS opengl metal d3d11)
   endif()
   endif()
 endforeach()
 endforeach()
 
 
-set_target_properties_obs(obs-studio PROPERTIES FOLDER frontend OUTPUT_NAME obs)
+# cmake-format: off
+set_target_properties_obs(obs-studio PROPERTIES FOLDER frontend OUTPUT_NAME "$<IF:$<PLATFORM_ID:Windows>,obs64,obs>")
+# cmake-format: on

+ 1 - 1
UI/cmake/feature-importers.cmake

@@ -1,2 +1,2 @@
-target_sources(obs-studio PRIVATE importers/importers.cpp importers/importers.hpp importers/classic.cpp
+target_sources(obs-studio PRIVATE importers/classic.cpp importers/importers.cpp importers/importers.hpp
                                   importers/sl.cpp importers/studio.cpp importers/xsplit.cpp)
                                   importers/sl.cpp importers/studio.cpp importers/xsplit.cpp)

+ 1 - 1
UI/cmake/feature-whatsnew.cmake

@@ -8,7 +8,7 @@ if(ENABLE_WHATSNEW AND TARGET OBS::browser-panels)
     target_link_libraries(obs-studio PRIVATE MbedTLS::MbedTLS OBS::blake2)
     target_link_libraries(obs-studio PRIVATE MbedTLS::MbedTLS OBS::blake2)
 
 
     target_sources(
     target_sources(
-      obs-studio PRIVATE update/crypto-helpers.hpp update/crypto-helpers-mbedtls.cpp update/shared-update.cpp
+      obs-studio PRIVATE update/crypto-helpers-mbedtls.cpp update/crypto-helpers.hpp update/shared-update.cpp
                          update/shared-update.hpp update/update-helpers.cpp update/update-helpers.hpp)
                          update/shared-update.hpp update/update-helpers.cpp update/update-helpers.hpp)
   endif()
   endif()
 
 

+ 2 - 2
UI/cmake/feature-youtube.cmake

@@ -2,8 +2,8 @@ if(YOUTUBE_CLIENTID
    AND YOUTUBE_SECRET
    AND YOUTUBE_SECRET
    AND YOUTUBE_CLIENTID_HASH
    AND YOUTUBE_CLIENTID_HASH
    AND YOUTUBE_SECRET_HASH)
    AND YOUTUBE_SECRET_HASH)
-  target_sources(obs-studio PRIVATE auth-youtube.cpp auth-youtube.hpp youtube-api-wrappers.cpp youtube-api-wrappers.hpp
-                                    window-youtube-actions.cpp window-youtube-actions.hpp)
+  target_sources(obs-studio PRIVATE auth-youtube.cpp auth-youtube.hpp window-youtube-actions.cpp
+                                    window-youtube-actions.hpp youtube-api-wrappers.cpp youtube-api-wrappers.hpp)
 
 
   target_enable_feature(obs-studio "YouTube API connection" YOUTUBE_ENABLED)
   target_enable_feature(obs-studio "YouTube API connection" YOUTUBE_ENABLED)
 else()
 else()

+ 4 - 6
UI/cmake/os-windows.cmake

@@ -29,7 +29,7 @@ target_sources(
           update/win-update.hpp)
           update/win-update.hpp)
 
 
 target_link_libraries(obs-studio PRIVATE crypt32 OBS::blake2 OBS::w32-pthreads MbedTLS::MbedTLS Detours::Detours)
 target_link_libraries(obs-studio PRIVATE crypt32 OBS::blake2 OBS::w32-pthreads MbedTLS::MbedTLS Detours::Detours)
-target_compile_options(obs-studio PRIVATE PSAPI_VERSION=2)
+target_compile_definitions(obs-studio PRIVATE PSAPI_VERSION=2)
 target_link_options(obs-studio PRIVATE /IGNORE:4098 /IGNORE:4099)
 target_link_options(obs-studio PRIVATE /IGNORE:4098 /IGNORE:4099)
 
 
 add_library(obs-update-helpers INTERFACE)
 add_library(obs-update-helpers INTERFACE)
@@ -49,8 +49,6 @@ set_property(
 set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT obs-studio)
 set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT obs-studio)
 set_target_properties(
 set_target_properties(
   obs-studio
   obs-studio
-  PROPERTIES
-    WIN32_EXECUTABLE TRUE
-    VS_DEBUGGER_COMMAND
-    "${CMAKE_BINARY_DIR}/rundir/$<CONFIG>/$<$<BOOL:${OBS_WINDOWS_LEGACY_DIRS}>:bin/>$<TARGET_FILE_NAME:obs-studio>"
-    VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/rundir/$<CONFIG>$<$<BOOL:${OBS_WINDOWS_LEGACY_DIRS}>:/bin>")
+  PROPERTIES WIN32_EXECUTABLE TRUE
+             VS_DEBUGGER_COMMAND "${CMAKE_BINARY_DIR}/rundir/$<CONFIG>/bin/64bit/$<TARGET_FILE_NAME:obs-studio>"
+             VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/rundir/$<CONFIG>/bin/64bit")

+ 2 - 1
UI/cmake/ui-qt.cmake

@@ -14,7 +14,7 @@ set_property(
   PROPERTY AUTOUIC_SEARCH_PATHS forms forms/source-toolbar)
   PROPERTY AUTOUIC_SEARCH_PATHS forms forms/source-toolbar)
 
 
 set(_qt_sources
 set(_qt_sources
-    forms/obs.qrc
+    # cmake-format: sortable
     forms/AutoConfigFinishPage.ui
     forms/AutoConfigFinishPage.ui
     forms/AutoConfigStartPage.ui
     forms/AutoConfigStartPage.ui
     forms/AutoConfigStartPage.ui
     forms/AutoConfigStartPage.ui
@@ -22,6 +22,7 @@ set(_qt_sources
     forms/AutoConfigTestPage.ui
     forms/AutoConfigTestPage.ui
     forms/AutoConfigVideoPage.ui
     forms/AutoConfigVideoPage.ui
     forms/ColorSelect.ui
     forms/ColorSelect.ui
+    forms/obs.qrc
     forms/OBSAbout.ui
     forms/OBSAbout.ui
     forms/OBSAdvAudio.ui
     forms/OBSAdvAudio.ui
     forms/OBSBasic.ui
     forms/OBSBasic.ui

BIN
UI/cmake/windows/obs-studio.ico


+ 20 - 0
UI/cmake/windows/obs.manifest

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+    <description>OBS Studio</description>
+    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+        <security>
+            <requestedPrivileges>
+                <requestedExecutionLevel
+                    level="asInvoker"
+                    uiAccess="false"
+                />
+            </requestedPrivileges>
+        </security>
+    </trustInfo>
+    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+        <application>
+            <!-- Windows 10 and Windows 11 -->
+            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+        </application> 
+    </compatibility>
+</assembly>

+ 26 - 0
UI/cmake/windows/obs.rc.in

@@ -0,0 +1,26 @@
+IDI_ICON1 ICON DISCARDABLE "cmake/windows/obs-studio.ico"
+
+1 VERSIONINFO
+FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName", "OBS"
+      VALUE "FileDescription", "OBS Studio"
+      VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "InternalName", "obs"
+      VALUE "OriginalFilename", "obs"
+      VALUE "ProductName", "OBS Studio"
+      VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "Comments", "Free and open source software for video recording and live streaming"
+      VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04B0
+  END
+END

+ 1 - 8
UI/win-update/updater/CMakeLists.txt

@@ -2,13 +2,6 @@ cmake_minimum_required(VERSION 3.24...3.25)
 
 
 legacy_check()
 legacy_check()
 
 
-option(ENABLE_UPDATER "Build with Windows updater" ON)
-
-if(NOT ENABLE_UPDATER)
-  target_disable_feature(obs "Windows updater")
-  return()
-endif()
-
 find_package(zstd)
 find_package(zstd)
 
 
 if(NOT TARGET OBS::json11)
 if(NOT TARGET OBS::json11)
@@ -39,4 +32,4 @@ target_include_directories(updater PRIVATE "${CMAKE_SOURCE_DIR}/libobs" "${CMAKE
 target_link_libraries(updater PRIVATE OBS::blake2 OBS::json11 zstd::libzstd_static comctl32 shell32 winhttp)
 target_link_libraries(updater PRIVATE OBS::blake2 OBS::json11 zstd::libzstd_static comctl32 shell32 winhttp)
 target_link_options(updater PRIVATE /IGNORE:4098)
 target_link_options(updater PRIVATE /IGNORE:4098)
 
 
-set_target_properties_obs(updater PROPERTIES FOLDER frontend OUTPUT_NAME updater)
+set_target_properties(updater PROPERTIES FOLDER frontend OUTPUT_NAME updater)

+ 0 - 4
deps/CMakeLists.txt

@@ -1,7 +1,3 @@
-if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
-  return()
-endif()
-
 if(OS_WINDOWS)
 if(OS_WINDOWS)
   if(NOT MINGW)
   if(NOT MINGW)
     add_subdirectory(w32-pthreads)
     add_subdirectory(w32-pthreads)

+ 8 - 14
deps/ipc-util/CMakeLists.txt

@@ -1,20 +1,14 @@
-project(ipc-util)
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
-add_library(ipc-util STATIC)
+# cmake-format: off
+add_library(ipc-util STATIC EXCLUDE_FROM_ALL)
+# cmake-format: on
 add_library(OBS::ipc-util ALIAS ipc-util)
 add_library(OBS::ipc-util ALIAS ipc-util)
 
 
 target_sources(ipc-util PRIVATE ipc-util/pipe.h)
 target_sources(ipc-util PRIVATE ipc-util/pipe.h)
+target_include_directories(ipc-util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
 
 
-set_target_properties(ipc-util PROPERTIES FOLDER "deps" POSITION_INDEPENDENT_CODE ON)
+target_sources(ipc-util PRIVATE ipc-util/pipe-windows.c ipc-util/pipe-windows.h)
+target_compile_options(ipc-util PRIVATE $<IF:$<CONFIG:Debug>,/MTd,/MT> /Zl)
 
 
-target_include_directories(ipc-util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-
-if(OS_WINDOWS)
-  if(MSVC)
-    target_compile_options(ipc-util PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>" /Zl)
-  endif()
-
-  target_sources(ipc-util PRIVATE ipc-util/pipe-windows.c ipc-util/pipe-windows.h)
-else()
-  target_sources(ipc-util PRIVATE ipc-util/pipe-posix.c ipc-util/pipe-posic.h)
-endif()
+set_target_properties(ipc-util PROPERTIES FOLDER deps POSITION_INDEPENDENT_CODE ON)

+ 20 - 27
libobs-d3d11/CMakeLists.txt

@@ -1,11 +1,16 @@
-project(libobs-d3d11)
+cmake_minimum_required(VERSION 3.24...3.25)
+
+legacy_check()
 
 
 add_library(libobs-d3d11 MODULE)
 add_library(libobs-d3d11 MODULE)
 add_library(OBS::libobs-d3d11 ALIAS libobs-d3d11)
 add_library(OBS::libobs-d3d11 ALIAS libobs-d3d11)
 
 
 target_sources(
 target_sources(
   libobs-d3d11
   libobs-d3d11
-  PRIVATE d3d11-indexbuffer.cpp
+  PRIVATE # cmake-format: sortable
+          d3d11-duplicator.cpp
+          d3d11-indexbuffer.cpp
+          d3d11-rebuild.cpp
           d3d11-samplerstate.cpp
           d3d11-samplerstate.cpp
           d3d11-shader.cpp
           d3d11-shader.cpp
           d3d11-shaderprocessor.cpp
           d3d11-shaderprocessor.cpp
@@ -16,35 +21,23 @@ target_sources(
           d3d11-texture2d.cpp
           d3d11-texture2d.cpp
           d3d11-texture3d.cpp
           d3d11-texture3d.cpp
           d3d11-vertexbuffer.cpp
           d3d11-vertexbuffer.cpp
-          d3d11-duplicator.cpp
-          d3d11-rebuild.cpp
           d3d11-zstencilbuffer.cpp)
           d3d11-zstencilbuffer.cpp)
 
 
-set(MODULE_DESCRIPTION "OBS Library D3D11 wrapper")
-configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in libobs-d3d11.rc)
-
-target_include_directories(libobs-d3d11 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-
+configure_file(cmake/windows/obs-module.rc.in libobs-d3d11.rc)
 target_sources(libobs-d3d11 PRIVATE libobs-d3d11.rc)
 target_sources(libobs-d3d11 PRIVATE libobs-d3d11.rc)
-
-target_compile_features(libobs-d3d11 PRIVATE cxx_std_17)
-
-target_compile_definitions(libobs-d3d11 PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
-
-if(NOT DEFINED GPU_PRIORITY_VAL
-   OR "x${GPU_PRIORITY_VAL}x" STREQUAL "xx"
-   OR "${GPU_PRIORITY_VAL}" STREQUAL "0")
-  target_compile_definitions(libobs-d3d11 PRIVATE USE_GPU_PRIORITY=FALSE GPU_PRIORITY_VAL=0)
-else()
-  target_compile_definitions(libobs-d3d11 PRIVATE USE_GPU_PRIORITY=TRUE GPU_PRIORITY_VAL=${GPU_PRIORITY_VAL})
-endif()
+target_compile_options(libobs-d3d11 PRIVATE /wd4595)
+target_compile_definitions(
+  libobs-d3d11 PRIVATE "$<$<BOOL:${GPU_PRIORITY_VAL}>:USE_GPU_PRIORITY>"
+                       "$<IF:$<BOOL:${GPU_PRIORITY_VAL}>,GPU_PRIORITY_VAL=${GPU_PRIORITY_VAL},GPU_PRIORITY_VAL=0>")
 
 
 target_link_libraries(libobs-d3d11 PRIVATE OBS::libobs d3d9 d3d11 dxgi shcore)
 target_link_libraries(libobs-d3d11 PRIVATE OBS::libobs d3d9 d3d11 dxgi shcore)
 
 
-set_target_properties(
-  libobs-d3d11
-  PROPERTIES OUTPUT_NAME libobs-d3d11
-             FOLDER "core"
-             PREFIX "")
+target_enable_feature(libobs "Direct3D 11 renderer")
 
 
-setup_binary_target(libobs-d3d11)
+# cmake-format: off
+set_target_properties_obs(
+  libobs-d3d11
+  PROPERTIES FOLDER core
+             VERSION 0
+             SOVERSION ${OBS_VERSION_MAJOR})
+# cmake-format: on

+ 50 - 0
libobs-d3d11/cmake/legacy.cmake

@@ -0,0 +1,50 @@
+project(libobs-d3d11)
+
+add_library(libobs-d3d11 MODULE)
+add_library(OBS::libobs-d3d11 ALIAS libobs-d3d11)
+
+target_sources(
+  libobs-d3d11
+  PRIVATE d3d11-indexbuffer.cpp
+          d3d11-samplerstate.cpp
+          d3d11-shader.cpp
+          d3d11-shaderprocessor.cpp
+          d3d11-shaderprocessor.hpp
+          d3d11-stagesurf.cpp
+          d3d11-subsystem.cpp
+          d3d11-subsystem.hpp
+          d3d11-texture2d.cpp
+          d3d11-texture3d.cpp
+          d3d11-vertexbuffer.cpp
+          d3d11-duplicator.cpp
+          d3d11-rebuild.cpp
+          d3d11-zstencilbuffer.cpp)
+
+set(MODULE_DESCRIPTION "OBS Library D3D11 wrapper")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in libobs-d3d11.rc)
+
+target_include_directories(libobs-d3d11 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+
+target_sources(libobs-d3d11 PRIVATE libobs-d3d11.rc)
+
+target_compile_features(libobs-d3d11 PRIVATE cxx_std_17)
+
+target_compile_definitions(libobs-d3d11 PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
+
+if(NOT DEFINED GPU_PRIORITY_VAL
+   OR "x${GPU_PRIORITY_VAL}x" STREQUAL "xx"
+   OR "${GPU_PRIORITY_VAL}" STREQUAL "0")
+  target_compile_definitions(libobs-d3d11 PRIVATE GPU_PRIORITY_VAL=0)
+else()
+  target_compile_definitions(libobs-d3d11 PRIVATE USE_GPU_PRIORITY=TRUE GPU_PRIORITY_VAL=${GPU_PRIORITY_VAL})
+endif()
+
+target_link_libraries(libobs-d3d11 PRIVATE OBS::libobs d3d9 d3d11 dxgi shcore)
+
+set_target_properties(
+  libobs-d3d11
+  PROPERTIES OUTPUT_NAME libobs-d3d11
+             FOLDER "core"
+             PREFIX "")
+
+setup_binary_target(libobs-d3d11)

+ 24 - 0
libobs-d3d11/cmake/windows/obs-module.rc.in

@@ -0,0 +1,24 @@
+1 VERSIONINFO
+FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName", "${OBS_COMPANY_NAME}"
+      VALUE "FileDescription", "OBS Library D3D11 wrapper"
+      VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "ProductName", "${OBS_PRODUCT_NAME}"
+      VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "Comments", "${OBS_COMMENTS}"
+      VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
+      VALUE "InternalName", "libobs-d3d11"
+      VALUE "OriginalFilename", "libobs-d3d11"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04B0
+  END
+END

+ 0 - 20
libobs-d3d11/d3d11-config.h.in

@@ -1,20 +0,0 @@
-#pragma once
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef ON
-#define ON 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef OFF
-#define OFF 0
-#endif
-
-#define USE_GPU_PRIORITY @USE_GPU_PRIORITY@
-#define GPU_PRIORITY_VAL @GPU_PRIORITY_VAL@

+ 2 - 2
libobs-d3d11/d3d11-subsystem.cpp

@@ -473,7 +473,7 @@ static bool increase_maximum_frame_latency(ID3D11Device *device)
 	return true;
 	return true;
 }
 }
 
 
-#if USE_GPU_PRIORITY
+#ifdef USE_GPU_PRIORITY
 static bool set_priority(ID3D11Device *device, bool hags_enabled)
 static bool set_priority(ID3D11Device *device, bool hags_enabled)
 {
 {
 	ComQIPtr<IDXGIDevice> dxgiDevice(device);
 	ComQIPtr<IDXGIDevice> dxgiDevice(device);
@@ -688,7 +688,7 @@ void gs_device::InitDevice(uint32_t adapterIdx)
 	}
 	}
 
 
 	/* adjust gpu thread priority on non-intel GPUs */
 	/* adjust gpu thread priority on non-intel GPUs */
-#if USE_GPU_PRIORITY
+#ifdef USE_GPU_PRIORITY
 	if (desc.VendorId != 0x8086 && !set_priority(device, hags_enabled)) {
 	if (desc.VendorId != 0x8086 && !set_priority(device, hags_enabled)) {
 		blog(LOG_INFO, "D3D11 GPU priority setup "
 		blog(LOG_INFO, "D3D11 GPU priority setup "
 			       "failed (not admin?)");
 			       "failed (not admin?)");

+ 15 - 13
libobs-winrt/CMakeLists.txt

@@ -1,4 +1,12 @@
-project(libobs-winrt)
+cmake_minimum_required(VERSION 3.24...3.25)
+
+legacy_check()
+
+add_library(libobs-winrt-headers INTERFACE)
+add_library(OBS::winrt-headers ALIAS libobs-winrt-headers)
+
+target_sources(libobs-winrt-headers INTERFACE winrt-capture.h)
+target_include_directories(libobs-winrt-headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
 
 
 add_library(libobs-winrt MODULE)
 add_library(libobs-winrt MODULE)
 add_library(OBS::libobs-winrt ALIAS libobs-winrt)
 add_library(OBS::libobs-winrt ALIAS libobs-winrt)
@@ -8,24 +16,18 @@ target_sources(libobs-winrt PRIVATE winrt-capture.cpp winrt-capture.h winrt-disp
 target_precompile_headers(
 target_precompile_headers(
   libobs-winrt
   libobs-winrt
   PRIVATE
   PRIVATE
-  [["../libobs/util/windows/ComPtr.hpp"]]
-  <obs-module.h>
   <d3d11.h>
   <d3d11.h>
   <DispatcherQueue.h>
   <DispatcherQueue.h>
   <dwmapi.h>
   <dwmapi.h>
+  <obs-module.h>
+  <util/windows/ComPtr.hpp>
   <Windows.Graphics.Capture.Interop.h>
   <Windows.Graphics.Capture.Interop.h>
   <winrt/Windows.Foundation.Metadata.h>
   <winrt/Windows.Foundation.Metadata.h>
   <winrt/Windows.Graphics.Capture.h>
   <winrt/Windows.Graphics.Capture.h>
   <winrt/Windows.System.h>)
   <winrt/Windows.System.h>)
 
 
-target_link_libraries(libobs-winrt PRIVATE OBS::libobs Dwmapi windowsapp)
-
-target_compile_features(libobs-winrt PRIVATE cxx_std_17)
-
-set_target_properties(
-  libobs-winrt
-  PROPERTIES OUTPUT_NAME libobs-winrt
-             FOLDER "core"
-             PREFIX "")
+target_link_libraries(libobs-winrt PRIVATE OBS::libobs OBS::COMutils Dwmapi windowsapp)
 
 
-setup_binary_target(libobs-winrt)
+# cmake-format: off
+set_target_properties_obs(libobs-winrt PROPERTIES FOLDER core)
+# cmake-format: on

+ 31 - 0
libobs-winrt/cmake/legacy.cmake

@@ -0,0 +1,31 @@
+project(libobs-winrt)
+
+add_library(libobs-winrt MODULE)
+add_library(OBS::libobs-winrt ALIAS libobs-winrt)
+
+target_sources(libobs-winrt PRIVATE winrt-capture.cpp winrt-capture.h winrt-dispatch.cpp winrt-dispatch.h)
+
+target_precompile_headers(
+  libobs-winrt
+  PRIVATE
+  [["../libobs/util/windows/ComPtr.hpp"]]
+  <obs-module.h>
+  <d3d11.h>
+  <DispatcherQueue.h>
+  <dwmapi.h>
+  <Windows.Graphics.Capture.Interop.h>
+  <winrt/Windows.Foundation.Metadata.h>
+  <winrt/Windows.Graphics.Capture.h>
+  <winrt/Windows.System.h>)
+
+target_link_libraries(libobs-winrt PRIVATE OBS::libobs Dwmapi windowsapp)
+
+target_compile_features(libobs-winrt PRIVATE cxx_std_17)
+
+set_target_properties(
+  libobs-winrt
+  PROPERTIES OUTPUT_NAME libobs-winrt
+             FOLDER "core"
+             PREFIX "")
+
+setup_binary_target(libobs-winrt)

+ 5 - 7
libobs/CMakeLists.txt

@@ -222,12 +222,11 @@ target_sources(
           graphics/vec4.c
           graphics/vec4.c
           graphics/vec4.h)
           graphics/vec4.h)
 
 
-target_compile_features(libobs PUBLIC $<INSTALL_INTERFACE:cxx_std_17>)
-target_compile_options(libobs PUBLIC ${ARCH_SIMD_FLAGS})
+target_compile_features(libobs PUBLIC cxx_std_17)
 target_compile_definitions(
 target_compile_definitions(
   libobs
   libobs
   PRIVATE IS_LIBOBS
   PRIVATE IS_LIBOBS
-  PUBLIC ${ARCH_SIMD_DEFINES} $<BUILD_INTERFACE:$<$<BOOL:${ENABLE_HEVC}>:ENABLE_HEVC>>
+  PUBLIC $<BUILD_INTERFACE:$<$<BOOL:${ENABLE_HEVC}>:ENABLE_HEVC>>
          $<BUILD_INTERFACE:$<$<BOOL:${ENABLE_FFMPEG_MUX_DEBUG}>:SHOW_SUBPROCESSES>>)
          $<BUILD_INTERFACE:$<$<BOOL:${ENABLE_FFMPEG_MUX_DEBUG}>:SHOW_SUBPROCESSES>>)
 
 
 target_link_libraries(
 target_link_libraries(
@@ -326,15 +325,14 @@ if(ARCH_SIMD_FLAGS)
       util/simde/x86/sse2.h)
       util/simde/x86/sse2.h)
 endif()
 endif()
 
 
-set_property(
-  TARGET libobs
-  APPEND
-  PROPERTY OBS_PUBLIC_HEADERS ${public_headers})
+# cmake-format: off
+set_property(TARGET libobs APPEND PROPERTY OBS_PUBLIC_HEADERS ${public_headers})
 
 
 set_target_properties_obs(
 set_target_properties_obs(
   libobs
   libobs
   PROPERTIES FOLDER core
   PROPERTIES FOLDER core
              VERSION 0
              VERSION 0
              SOVERSION "${OBS_VERSION_MAJOR}")
              SOVERSION "${OBS_VERSION_MAJOR}")
+# cmake-format: on
 
 
 target_export(libobs)
 target_export(libobs)

+ 18 - 24
libobs/cmake/os-freebsd.cmake

@@ -1,20 +1,11 @@
 find_package(X11 REQUIRED)
 find_package(X11 REQUIRED)
 find_package(x11-xcb REQUIRED)
 find_package(x11-xcb REQUIRED)
-find_package(
-  xcb
-  OPTIONAL_COMPONENTS xcb-xinput
-  QUIET)
+# cmake-format: off
+find_package(xcb OPTIONAL_COMPONENTS xcb-xinput QUIET)
+# cmake-format: on
 find_package(gio)
 find_package(gio)
 find_package(Sysinfo REQUIRED)
 find_package(Sysinfo REQUIRED)
 
 
-target_link_libraries(libobs PRIVATE X11::x11-xcb xcb::xcb Sysinfo::Sysinfo)
-
-if(TARGET xcb::xcb-xinput)
-  target_link_libraries(libobs PRIVATE xcb::xcb-xinput)
-endif()
-
-target_compile_definitions(libobs PRIVATE $<$<OR:$<C_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:GNU>>:ENABLE_DARRAY_TYPE_TEST>)
-
 target_sources(
 target_sources(
   libobs
   libobs
   PRIVATE obs-nix.c
   PRIVATE obs-nix.c
@@ -25,6 +16,12 @@ target_sources(
           util/platform-nix.c
           util/platform-nix.c
           util/threading-posix.c
           util/threading-posix.c
           util/threading-posix.h)
           util/threading-posix.h)
+target_compile_definitions(libobs PRIVATE $<$<OR:$<C_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:GNU>>:ENABLE_DARRAY_TYPE_TEST>)
+
+target_link_libraries(libobs PRIVATE X11::x11-xcb xcb::xcb Sysinfo::Sysinfo)
+if(TARGET xcb::xcb-xinput)
+  target_link_libraries(libobs PRIVATE xcb::xcb-xinput)
+endif()
 
 
 if(ENABLE_PULSEAUDIO)
 if(ENABLE_PULSEAUDIO)
   find_package(PulseAudio REQUIRED)
   find_package(PulseAudio REQUIRED)
@@ -36,31 +33,28 @@ if(ENABLE_PULSEAUDIO)
             audio-monitoring/pulse/pulseaudio-wrapper.h)
             audio-monitoring/pulse/pulseaudio-wrapper.h)
 
 
   target_link_libraries(libobs PRIVATE PulseAudio::PulseAudio)
   target_link_libraries(libobs PRIVATE PulseAudio::PulseAudio)
-
-  set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_ENABLED "PulseAudio audio monitoring (Linux)")
+  target_enable_feature(libobs "PulseAudio audio monitoring (Linux)")
 else()
 else()
   target_sources(libobs PRIVATE audio-monitoring/null/null-audio-monitoring.c)
   target_sources(libobs PRIVATE audio-monitoring/null/null-audio-monitoring.c)
-  set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_DISABLED "PulseAudio audio monitoring (Linux)")
+  target_disable_feature(libobs "PulseAudio audio monitoring (Linux)")
 endif()
 endif()
 
 
 if(TARGET gio::gio)
 if(TARGET gio::gio)
-  target_link_libraries(libobs PRIVATE gio::gio)
-
   target_sources(libobs PRIVATE util/platform-nix-dbus.c util/platform-nix-portal.c)
   target_sources(libobs PRIVATE util/platform-nix-dbus.c util/platform-nix-portal.c)
+  target_link_libraries(libobs PRIVATE gio::gio)
 endif()
 endif()
 
 
 if(ENABLE_WAYLAND)
 if(ENABLE_WAYLAND)
-  find_package(
-    Wayland
-    COMPONENTS Client
-    REQUIRED)
+  # cmake-format: off
+  find_package(Wayland COMPONENTS Client REQUIRED)
+  # cmake-format: on
   find_package(xkbcommon REQUIRED)
   find_package(xkbcommon REQUIRED)
 
 
-  target_link_libraries(libobs PRIVATE Wayland::Client xkbcommon::xkbcommon)
   target_sources(libobs PRIVATE obs-nix-wayland.c)
   target_sources(libobs PRIVATE obs-nix-wayland.c)
-  set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_ENABLED "Wayland compositor support (Linux)")
+  target_link_libraries(libobs PRIVATE Wayland::Client xkbcommon::xkbcommon)
+  target_enable_feature(libobs "Wayland compositor support (Linux)")
 else()
 else()
-  set_property(GLOBAL APPEND PROPERTY OBS_FEATURES_DISABLED "Wayland compositor support (Linux)")
+  target_disable_feature(libobs "Wayland compositor support (Linux)")
 endif()
 endif()
 
 
 set_target_properties(libobs PROPERTIES OUTPUT_NAME obs)
 set_target_properties(libobs PROPERTIES OUTPUT_NAME obs)

+ 15 - 24
libobs/cmake/os-linux.cmake

@@ -1,24 +1,11 @@
-cmake_minimum_required(VERSION 3.22...3.25)
-
 find_package(LibUUID REQUIRED)
 find_package(LibUUID REQUIRED)
 find_package(X11 REQUIRED)
 find_package(X11 REQUIRED)
 find_package(x11-xcb REQUIRED)
 find_package(x11-xcb REQUIRED)
-find_package(
-  xcb
-  COMPONENTS xcb
-  OPTIONAL_COMPONENTS xcb-xinput
-  QUIET)
+# cmake-format: off
+find_package(xcb COMPONENTS xcb OPTIONAL_COMPONENTS xcb-xinput QUIET)
+# cmake-format: on
 find_package(gio)
 find_package(gio)
 
 
-target_link_libraries(libobs PRIVATE X11::x11-xcb xcb::xcb LibUUID::LibUUID ${CMAKE_DL_LIBS})
-
-if(TARGET xcb::xcb-xinput)
-  target_link_libraries(libobs PRIVATE xcb::xcb-xinput)
-endif()
-
-target_compile_definitions(libobs PRIVATE USE_XDG
-                                          $<$<OR:$<C_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:GNU>>:ENABLE_DARRAY_TYPE_TEST>)
-
 target_sources(
 target_sources(
   libobs
   libobs
   PRIVATE obs-nix.c
   PRIVATE obs-nix.c
@@ -30,6 +17,13 @@ target_sources(
           util/threading-posix.c
           util/threading-posix.c
           util/threading-posix.h)
           util/threading-posix.h)
 
 
+target_compile_definitions(libobs PRIVATE USE_XDG $<$<C_COMPILER_ID:GNU>:ENABLE_DARRAY_TYPE_TEST>)
+
+target_link_libraries(libobs PRIVATE X11::x11-xcb xcb::xcb LibUUID::LibUUID ${CMAKE_DL_LIBS})
+if(TARGET xcb::xcb-xinput)
+  target_link_libraries(libobs PRIVATE xcb::xcb-xinput)
+endif()
+
 if(ENABLE_PULSEAUDIO)
 if(ENABLE_PULSEAUDIO)
   find_package(PulseAudio REQUIRED)
   find_package(PulseAudio REQUIRED)
 
 
@@ -40,7 +34,6 @@ if(ENABLE_PULSEAUDIO)
             audio-monitoring/pulse/pulseaudio-wrapper.h)
             audio-monitoring/pulse/pulseaudio-wrapper.h)
 
 
   target_link_libraries(libobs PRIVATE PulseAudio::PulseAudio)
   target_link_libraries(libobs PRIVATE PulseAudio::PulseAudio)
-
   target_enable_feature(libobs "PulseAudio audio monitoring (Linux)")
   target_enable_feature(libobs "PulseAudio audio monitoring (Linux)")
 else()
 else()
   target_sources(libobs PRIVATE audio-monitoring/null/null-audio-monitoring.c)
   target_sources(libobs PRIVATE audio-monitoring/null/null-audio-monitoring.c)
@@ -48,20 +41,18 @@ else()
 endif()
 endif()
 
 
 if(TARGET gio::gio)
 if(TARGET gio::gio)
-  target_link_libraries(libobs PRIVATE gio::gio)
-
   target_sources(libobs PRIVATE util/platform-nix-dbus.c util/platform-nix-portal.c)
   target_sources(libobs PRIVATE util/platform-nix-dbus.c util/platform-nix-portal.c)
+  target_link_libraries(libobs PRIVATE gio::gio)
 endif()
 endif()
 
 
 if(ENABLE_WAYLAND)
 if(ENABLE_WAYLAND)
-  find_package(
-    Wayland
-    COMPONENTS Client
-    REQUIRED)
+  # cmake-format: off
+  find_package(Wayland COMPONENTS Client REQUIRED)
+  # cmake-format: on
   find_package(xkbcommon REQUIRED)
   find_package(xkbcommon REQUIRED)
 
 
-  target_link_libraries(libobs PRIVATE Wayland::Client xkbcommon::xkbcommon)
   target_sources(libobs PRIVATE obs-nix-wayland.c)
   target_sources(libobs PRIVATE obs-nix-wayland.c)
+  target_link_libraries(libobs PRIVATE Wayland::Client xkbcommon::xkbcommon)
   target_enable_feature(libobs "Wayland compositor support (Linux)")
   target_enable_feature(libobs "Wayland compositor support (Linux)")
 else()
 else()
   target_disable_feature(libobs "Wayland compositor support (Linux)")
   target_disable_feature(libobs "Wayland compositor support (Linux)")

+ 1 - 1
libobs/cmake/os-windows.cmake

@@ -57,4 +57,4 @@ target_link_libraries(
 
 
 target_link_options(libobs PRIVATE /IGNORE:4098 /SAFESEH:NO)
 target_link_options(libobs PRIVATE /IGNORE:4098 /SAFESEH:NO)
 
 
-set_target_properties(libobs PROPERTIES PREFIX "")
+set_target_properties(libobs PROPERTIES PREFIX "" OUTPUT_NAME "obs")

+ 1 - 9
libobs/obs-windows.c

@@ -34,15 +34,7 @@ const char *get_module_extension(void)
 	return ".dll";
 	return ".dll";
 }
 }
 
 
-#ifdef _WIN64
-#define BIT_STRING "64bit"
-#else
-#define BIT_STRING "32bit"
-#endif
-
-static const char *module_bin[] = {
-	"../../obs-plugins/" BIT_STRING,
-};
+static const char *module_bin[] = {"../../obs-plugins/64bit"};
 
 
 static const char *module_data[] = {"../../data/obs-plugins/%module%"};
 static const char *module_data[] = {"../../data/obs-plugins/%module%"};
 
 

+ 0 - 3
plugins/coreaudio-encoder/CMakeLists.txt

@@ -17,10 +17,7 @@ target_sources(coreaudio-encoder PRIVATE encoder.cpp)
 target_link_libraries(coreaudio-encoder PRIVATE OBS::libobs)
 target_link_libraries(coreaudio-encoder PRIVATE OBS::libobs)
 
 
 if(OS_WINDOWS)
 if(OS_WINDOWS)
-  target_compile_definitions(coreaudio-encoder PRIVATE UNICODE _UNICODE)
-
   configure_file(cmake/windows/obs-module.rc.in coreaudio-encoder.rc)
   configure_file(cmake/windows/obs-module.rc.in coreaudio-encoder.rc)
-
   target_sources(coreaudio-encoder PRIVATE coreaudio-encoder.rc windows-imports.h)
   target_sources(coreaudio-encoder PRIVATE coreaudio-encoder.rc windows-imports.h)
 elseif(OS_MACOS)
 elseif(OS_MACOS)
   # cmake-format: off
   # cmake-format: off

+ 21 - 18
plugins/obs-ffmpeg/CMakeLists.txt

@@ -30,19 +30,21 @@ add_subdirectory(ffmpeg-mux)
 
 
 target_sources(
 target_sources(
   obs-ffmpeg
   obs-ffmpeg
-  PRIVATE obs-ffmpeg.c
-          obs-ffmpeg-video-encoders.c
+  PRIVATE # cmake-format: sortable
+          $<$<BOOL:${ENABLE_FFMPEG_LOGGING}>:obs-ffmpeg-logging.c>
           obs-ffmpeg-audio-encoders.c
           obs-ffmpeg-audio-encoders.c
           obs-ffmpeg-av1.c
           obs-ffmpeg-av1.c
-          obs-ffmpeg-nvenc.c
-          obs-ffmpeg-output.c
+          obs-ffmpeg-compat.h
+          obs-ffmpeg-formats.h
+          obs-ffmpeg-hls-mux.c
           obs-ffmpeg-mux.c
           obs-ffmpeg-mux.c
           obs-ffmpeg-mux.h
           obs-ffmpeg-mux.h
-          obs-ffmpeg-hls-mux.c
+          obs-ffmpeg-nvenc.c
+          obs-ffmpeg-output.c
           obs-ffmpeg-source.c
           obs-ffmpeg-source.c
-          obs-ffmpeg-compat.h
-          obs-ffmpeg-formats.h
-          $<$<BOOL:${ENABLE_FFMPEG_LOGGING}>:obs-ffmpeg-logging.c>)
+          obs-ffmpeg-video-encoders.c
+          obs-ffmpeg.c)
+
 target_compile_definitions(obs-ffmpeg PRIVATE $<$<BOOL:${ENABLE_FFMPEG_LOGGING}>:ENABLE_FFMPEG_LOGGING>)
 target_compile_definitions(obs-ffmpeg PRIVATE $<$<BOOL:${ENABLE_FFMPEG_LOGGING}>:ENABLE_FFMPEG_LOGGING>)
 
 
 target_link_libraries(
 target_link_libraries(
@@ -85,21 +87,20 @@ if(OS_WINDOWS)
   find_package(AMF 1.4.29 REQUIRED)
   find_package(AMF 1.4.29 REQUIRED)
   find_package(FFnvcodec 12 REQUIRED)
   find_package(FFnvcodec 12 REQUIRED)
 
 
+  add_library(obs-nvenc-version INTERFACE)
+  add_library(OBS::obs-nvenc-version ALIAS obs-nvenc-version)
+  target_sources(obs-nvenc-version INTERFACE obs-nvenc-ver.h)
+  target_include_directories(obs-nvenc-version INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+
   add_subdirectory(obs-amf-test)
   add_subdirectory(obs-amf-test)
   add_subdirectory(obs-nvenc-test)
   add_subdirectory(obs-nvenc-test)
 
 
-  target_link_libraries(obs-ffmpeg PRIVATE OBS::w32-pthreads AMF::AMF FFnvcodec::FFnvcodec ws2_32)
+  target_link_libraries(obs-ffmpeg PRIVATE OBS::obs-nvenc-version OBS::w32-pthreads AMF::AMF FFnvcodec::FFnvcodec
+                                           ws2_32)
 
 
   configure_file(cmake/windows/obs-module.rc.in obs-ffmpeg.rc)
   configure_file(cmake/windows/obs-module.rc.in obs-ffmpeg.rc)
-  target_sources(
-    obs-ffmpeg
-    PRIVATE texture-amf.cpp
-            texture-amf-opts.hpp
-            obs-nvenc.c
-            obs-nvenc.h
-            obs-nvenc-helpers.c
-            obs-nvenc-ver.h
-            obs-ffmpeg.rc)
+  target_sources(obs-ffmpeg PRIVATE obs-nvenc-helpers.c obs-nvenc.c obs-nvenc.h obs-ffmpeg.rc texture-amf-opts.hpp
+                                    texture-amf.cpp)
 elseif(OS_LINUX OR OS_FREEBSD)
 elseif(OS_LINUX OR OS_FREEBSD)
   find_package(Libva REQUIRED)
   find_package(Libva REQUIRED)
   find_package(Libpci REQUIRED)
   find_package(Libpci REQUIRED)
@@ -108,4 +109,6 @@ elseif(OS_LINUX OR OS_FREEBSD)
   target_link_libraries(obs-ffmpeg PRIVATE Libva::va Libva::drm Libpci::pci)
   target_link_libraries(obs-ffmpeg PRIVATE Libva::va Libva::drm Libpci::pci)
 endif()
 endif()
 
 
+# cmake-format: off
 set_target_properties_obs(obs-ffmpeg PROPERTIES FOLDER plugins/obs-ffmpeg PREFIX "")
 set_target_properties_obs(obs-ffmpeg PROPERTIES FOLDER plugins/obs-ffmpeg PREFIX "")
+# cmake-format: on

+ 8 - 7
plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt

@@ -1,14 +1,15 @@
-project(obs-amf-test)
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
-add_executable(obs-amf-test)
+legacy_check()
 
 
 find_package(AMF 1.4.29 REQUIRED)
 find_package(AMF 1.4.29 REQUIRED)
 
 
-target_include_directories(obs-amf-test PRIVATE ${CMAKE_SOURCE_DIR}/libobs)
+add_executable(obs-amf-test)
+add_executable(OBS::amf-test ALIAS obs-amf-test)
 
 
 target_sources(obs-amf-test PRIVATE obs-amf-test.cpp)
 target_sources(obs-amf-test PRIVATE obs-amf-test.cpp)
-target_link_libraries(obs-amf-test d3d11 dxgi dxguid AMF::AMF)
-
-set_target_properties(obs-amf-test PROPERTIES FOLDER "plugins/obs-ffmpeg")
+target_link_libraries(obs-amf-test PRIVATE OBS::COMutils AMF::AMF d3d11 dxgi dxguid)
 
 
-setup_binary_target(obs-amf-test)
+# cmake-format: off
+set_target_properties_obs(obs-amf-test PROPERTIES FOLDER plugins/obs-ffmpeg)
+# cmake-format: on

+ 14 - 0
plugins/obs-ffmpeg/obs-amf-test/cmake/legacy.cmake

@@ -0,0 +1,14 @@
+project(obs-amf-test)
+
+add_executable(obs-amf-test)
+
+find_package(AMF 1.4.29 REQUIRED)
+
+target_include_directories(obs-amf-test PRIVATE ${CMAKE_SOURCE_DIR}/libobs)
+
+target_sources(obs-amf-test PRIVATE obs-amf-test.cpp)
+target_link_libraries(obs-amf-test d3d11 dxgi dxguid AMF::AMF)
+
+set_target_properties(obs-amf-test PROPERTIES FOLDER "plugins/obs-ffmpeg")
+
+setup_binary_target(obs-amf-test)

+ 8 - 6
plugins/obs-ffmpeg/obs-nvenc-test/CMakeLists.txt

@@ -1,12 +1,14 @@
-project(obs-nvenc-test)
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
-add_executable(obs-nvenc-test)
+legacy_check()
 
 
 find_package(FFnvcodec 12 REQUIRED)
 find_package(FFnvcodec 12 REQUIRED)
 
 
-target_sources(obs-nvenc-test PRIVATE obs-nvenc-test.c ../obs-nvenc-ver.h)
-target_link_libraries(obs-nvenc-test d3d11 dxgi dxguid FFnvcodec::FFnvcodec)
+add_executable(obs-nvenc-test)
 
 
-set_target_properties(obs-nvenc-test PROPERTIES FOLDER "plugins/obs-ffmpeg")
+target_sources(obs-nvenc-test PRIVATE obs-nvenc-test.c)
+target_link_libraries(obs-nvenc-test OBS::obs-nvenc-version FFnvcodec::FFnvcodec d3d11 dxgi dxguid)
 
 
-setup_binary_target(obs-nvenc-test)
+# cmake-format: off
+set_target_properties_obs(obs-nvenc-test PROPERTIES FOLDER plugins/obs-ffmpeg)
+# cmake-format: on

+ 12 - 0
plugins/obs-ffmpeg/obs-nvenc-test/cmake/legacy.cmake

@@ -0,0 +1,12 @@
+project(obs-nvenc-test)
+
+add_executable(obs-nvenc-test)
+
+find_package(FFnvcodec 12 REQUIRED)
+
+target_sources(obs-nvenc-test PRIVATE obs-nvenc-test.c ../obs-nvenc-ver.h)
+target_link_libraries(obs-nvenc-test d3d11 dxgi dxguid FFnvcodec::FFnvcodec)
+
+set_target_properties(obs-nvenc-test PROPERTIES FOLDER "plugins/obs-ffmpeg")
+
+setup_binary_target(obs-nvenc-test)

+ 4 - 0
plugins/obs-ffmpeg/obs-nvenc-test/obs-nvenc-test.c

@@ -3,7 +3,11 @@
 #include <stdio.h>
 #include <stdio.h>
 
 
 #include <ffnvcodec/nvEncodeAPI.h>
 #include <ffnvcodec/nvEncodeAPI.h>
+#ifdef OBS_LEGACY
 #include "../obs-nvenc-ver.h"
 #include "../obs-nvenc-ver.h"
+#else
+#include <obs-nvenc-ver.h>
+#endif
 
 
 #include <dxgi.h>
 #include <dxgi.h>
 #include <d3d11.h>
 #include <d3d11.h>

+ 23 - 26
plugins/obs-outputs/cmake/ftl.cmake

@@ -10,20 +10,21 @@ target_link_libraries(ftl-sdk INTERFACE jansson::jansson CURL::libcurl)
 
 
 target_sources(
 target_sources(
   ftl-sdk
   ftl-sdk
-  INTERFACE ftl-stream.c
+  INTERFACE # cmake-format: sortable
+            ftl-sdk/libftl/ftl-sdk.c
             ftl-sdk/libftl/ftl.h
             ftl-sdk/libftl/ftl.h
+            ftl-sdk/libftl/ftl_helpers.c
             ftl-sdk/libftl/ftl_private.h
             ftl-sdk/libftl/ftl_private.h
+            ftl-sdk/libftl/gettimeofday/gettimeofday.c
+            ftl-sdk/libftl/handshake.c
             ftl-sdk/libftl/hmac/hmac.c
             ftl-sdk/libftl/hmac/hmac.c
             ftl-sdk/libftl/hmac/hmac.h
             ftl-sdk/libftl/hmac/hmac.h
             ftl-sdk/libftl/hmac/sha2.c
             ftl-sdk/libftl/hmac/sha2.c
             ftl-sdk/libftl/hmac/sha2.h
             ftl-sdk/libftl/hmac/sha2.h
-            ftl-sdk/libftl/ftl-sdk.c
-            ftl-sdk/libftl/handshake.c
             ftl-sdk/libftl/ingest.c
             ftl-sdk/libftl/ingest.c
-            ftl-sdk/libftl/ftl_helpers.c
+            ftl-sdk/libftl/logging.c
             ftl-sdk/libftl/media.c
             ftl-sdk/libftl/media.c
-            ftl-sdk/libftl/gettimeofday/gettimeofday.c
-            ftl-sdk/libftl/logging.c)
+            ftl-stream.c)
 
 
 target_include_directories(ftl-sdk INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl")
 target_include_directories(ftl-sdk INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/libftl")
 
 
@@ -45,29 +46,25 @@ target_link_libraries(obs-outputs PRIVATE ftl-sdk)
 target_enable_feature(obs-outputs "FTL protocol support")
 target_enable_feature(obs-outputs "FTL protocol support")
 
 
 get_target_property(target_sources ftl-sdk INTERFACE_SOURCES)
 get_target_property(target_sources ftl-sdk INTERFACE_SOURCES)
-list(
-  APPEND
-  silence_ftl
-  -Wno-unused-parameter
-  -Wno-unused-variable
-  -Wno-sign-compare
-  -Wno-pointer-sign
-  -Wno-int-conversion)
-
-if(CMAKE_C_COMPILER_ID STREQUAL AppleClang OR CMAKE_C_COMPILER_ID STREQUAL Clang)
-  list(APPEND silence_ftl -Wno-incompatible-function-pointer-types -Wno-implicit-int-conversion -Wno-shorten-64-to-32
-       -Wno-macro-redefined)
-elseif(CMAKE_C_COMPILER_ID STREQUAL GNU)
-  list(APPEND silence_ftl -Wno-error=extra -Wno-error=incompatible-pointer-types -Wno-error=int-conversion
-       -Wno-error=builtin-macro-redefined)
-endif()
 
 
-if((NOT CMAKE_C_COMPILER_ID STREQUAL GNU) OR CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
-  list(APPEND silence_ftl -Wno-error=enum-conversion)
+if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+  set(silence_ftl -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=sign-compare
+                  -Wno-error=pointer-sign -Wno-error=int-conversion)
+
+  if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?Clang")
+    list(APPEND silence_ftl -Wno-error=incompatible-function-pointer-types -Wno-error=implicit-int-conversion
+         -Wno-shorten-64-to-32 -Wno-macro-redefined)
+  elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+    list(APPEND silence_ftl -Wno-error=extra -Wno-error=incompatible-pointer-types -Wno-error=int-conversion
+         -Wno-error=builtin-macro-redefined)
+  endif()
+
+  if((NOT CMAKE_C_COMPILER_ID STREQUAL "GNU") OR CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
+    list(APPEND silence_ftl -Wno-error=enum-conversion)
+  endif()
+  set_source_files_properties(${target_sources} PROPERTIES COMPILE_OPTIONS "${silence_ftl}")
 endif()
 endif()
 
 
-set_source_files_properties(${target_sources} PROPERTIES COMPILE_OPTIONS "${silence_ftl}")
-
 set(target_headers ${target_sources})
 set(target_headers ${target_sources})
 list(FILTER target_sources INCLUDE REGEX ".+ftl-sdk/.+\\.(m|c[cp]?p?|swift)")
 list(FILTER target_sources INCLUDE REGEX ".+ftl-sdk/.+\\.(m|c[cp]?p?|swift)")
 list(FILTER target_headers INCLUDE REGEX ".+ftl-sdk/.+\\.h(pp)?")
 list(FILTER target_headers INCLUDE REGEX ".+ftl-sdk/.+\\.h(pp)?")

+ 62 - 75
plugins/obs-qsv11/CMakeLists.txt

@@ -1,47 +1,20 @@
-option(ENABLE_QSV11 "Build Intel QSV11 Hardware Encoder." TRUE)
+cmake_minimum_required(VERSION 3.24...3.25)
+
+legacy_check()
 
 
+option(ENABLE_QSV11 "Build Intel QSV11 Hardware Encoder." TRUE)
 if(NOT ENABLE_QSV11)
 if(NOT ENABLE_QSV11)
-  obs_status(DISABLED "obs-qsv11")
+  target_disable_feature(obs-qsv11 "Intel QSV11 Hardware Encoder")
+  target_disable(obs-qsv11)
   return()
   return()
 endif()
 endif()
 
 
-project(obs-qsv11)
-
-add_library(obs-qsv11 MODULE)
-add_library(OBS::qsv11 ALIAS obs-qsv11)
-
 add_library(libmfx INTERFACE)
 add_library(libmfx INTERFACE)
 add_library(OBS::libmfx ALIAS libmfx)
 add_library(OBS::libmfx ALIAS libmfx)
 
 
 target_sources(
 target_sources(
   libmfx
   libmfx
-  INTERFACE libmfx/src/main.cpp
-            libmfx/src/mfx_critical_section.cpp
-            libmfx/src/mfx_dispatcher.cpp
-            libmfx/src/mfx_dispatcher_log.cpp
-            libmfx/src/mfx_driver_store_loader.cpp
-            libmfx/src/mfx_dxva2_device.cpp
-            libmfx/src/mfx_function_table.cpp
-            libmfx/src/mfx_library_iterator.cpp
-            libmfx/src/mfx_load_dll.cpp
-            libmfx/src/mfx_load_plugin.cpp
-            libmfx/src/mfx_plugin_hive.cpp
-            libmfx/src/mfx_win_reg_key.cpp
-            libmfx/include/msdk/include/mfxadapter.h
-            libmfx/include/msdk/include/mfxastructures.h
-            libmfx/include/msdk/include/mfxaudio.h
-            libmfx/include/msdk/include/mfxaudio++.h
-            libmfx/include/msdk/include/mfxcommon.h
-            libmfx/include/msdk/include/mfxdefs.h
-            libmfx/include/msdk/include/mfxjpeg.h
-            libmfx/include/msdk/include/mfxmvc.h
-            libmfx/include/msdk/include/mfxplugin.h
-            libmfx/include/msdk/include/mfxplugin++.h
-            libmfx/include/msdk/include/mfxsession.h
-            libmfx/include/msdk/include/mfxstructures.h
-            libmfx/include/msdk/include/mfxvideo.h
-            libmfx/include/msdk/include/mfxvideo++.h
-            libmfx/include/msdk/include/mfxvstructures.h
+  INTERFACE # cmake-format: sortable
             libmfx/include/mfx_critical_section.h
             libmfx/include/mfx_critical_section.h
             libmfx/include/mfx_dispatcher.h
             libmfx/include/mfx_dispatcher.h
             libmfx/include/mfx_dispatcher_defs.h
             libmfx/include/mfx_dispatcher_defs.h
@@ -55,30 +28,66 @@ target_sources(
             libmfx/include/mfx_plugin_hive.h
             libmfx/include/mfx_plugin_hive.h
             libmfx/include/mfx_vector.h
             libmfx/include/mfx_vector.h
             libmfx/include/mfx_win_reg_key.h
             libmfx/include/mfx_win_reg_key.h
-            libmfx/include/mfxaudio_exposed_functions_list.h)
+            libmfx/include/mfxaudio_exposed_functions_list.h
+            libmfx/include/msdk/include/mfxadapter.h
+            libmfx/include/msdk/include/mfxastructures.h
+            libmfx/include/msdk/include/mfxaudio++.h
+            libmfx/include/msdk/include/mfxaudio.h
+            libmfx/include/msdk/include/mfxcommon.h
+            libmfx/include/msdk/include/mfxdefs.h
+            libmfx/include/msdk/include/mfxjpeg.h
+            libmfx/include/msdk/include/mfxmvc.h
+            libmfx/include/msdk/include/mfxplugin++.h
+            libmfx/include/msdk/include/mfxplugin.h
+            libmfx/include/msdk/include/mfxsession.h
+            libmfx/include/msdk/include/mfxstructures.h
+            libmfx/include/msdk/include/mfxvideo++.h
+            libmfx/include/msdk/include/mfxvideo.h
+            libmfx/include/msdk/include/mfxvstructures.h
+            libmfx/src/main.cpp
+            libmfx/src/mfx_critical_section.cpp
+            libmfx/src/mfx_dispatcher.cpp
+            libmfx/src/mfx_dispatcher_log.cpp
+            libmfx/src/mfx_driver_store_loader.cpp
+            libmfx/src/mfx_dxva2_device.cpp
+            libmfx/src/mfx_function_table.cpp
+            libmfx/src/mfx_library_iterator.cpp
+            libmfx/src/mfx_load_dll.cpp
+            libmfx/src/mfx_load_plugin.cpp
+            libmfx/src/mfx_plugin_hive.cpp
+            libmfx/src/mfx_win_reg_key.cpp)
 
 
-target_include_directories(libmfx INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include/msdk/include
-                                            ${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include)
+target_include_directories(libmfx INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include/msdk/include"
+                                            "${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include")
+
+add_library(obs-qsv11 MODULE)
+add_library(OBS::qsv11 ALIAS obs-qsv11)
 
 
 target_sources(
 target_sources(
   obs-qsv11
   obs-qsv11
-  PRIVATE obs-qsv11.c
-          obs-qsv11-plugin-main.c
-          common_directx9.cpp
-          common_directx9.h
+  PRIVATE # cmake-format: sortable
+          bits/linux_defs.h
+          bits/windows_defs.h
           common_directx11.cpp
           common_directx11.cpp
           common_directx11.h
           common_directx11.h
+          common_directx9.cpp
+          common_directx9.h
           common_utils.cpp
           common_utils.cpp
           common_utils.h
           common_utils.h
           common_utils_windows.cpp
           common_utils_windows.cpp
           device_directx9.cpp
           device_directx9.cpp
           device_directx9.h
           device_directx9.h
+          obs-qsv11-plugin-main.c
+          obs-qsv11.c
           QSV_Encoder.cpp
           QSV_Encoder.cpp
           QSV_Encoder.h
           QSV_Encoder.h
           QSV_Encoder_Internal.cpp
           QSV_Encoder_Internal.cpp
-          QSV_Encoder_Internal.h
-          bits/linux_defs.h
-          bits/windows_defs.h)
+          QSV_Encoder_Internal.h)
+
+configure_file(cmake/windows/obs-module.rc.in obs-qsv11.rc)
+target_sources(obs-qsv11 PRIVATE obs-qsv11.rc)
+
+target_compile_definitions(obs-qsv11 PRIVATE DX11_D3D)
 
 
 target_link_libraries(
 target_link_libraries(
   obs-qsv11
   obs-qsv11
@@ -90,36 +99,14 @@ target_link_libraries(
           dxgi
           dxgi
           dxguid)
           dxguid)
 
 
-target_compile_definitions(obs-qsv11 PRIVATE DX11_D3D)
-
-if(OS_WINDOWS)
-  add_subdirectory(obs-qsv-test)
-
-  set(MODULE_DESCRIPTION "OBS QSV encoder")
-  configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-qsv11.rc)
-
-  target_sources(obs-qsv11 PRIVATE obs-qsv11.rc)
-
-  target_compile_definitions(obs-qsv11 PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
-endif()
-
-set_target_properties(obs-qsv11 PROPERTIES FOLDER "plugins/obs-qsv11")
-
-file(GLOB _OBS_QSV11_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
-file(GLOB _OBS_QSV11_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
-
-source_group("obs-qsv11\\Source Files" FILES ${_OBS_QSV11_SOURCE_FILES})
-source_group("obs-qsv11\\Header Files" FILES ${_OBS_QSV11_HEADER_FILES})
-
-get_target_property(_LIBMFX_SOURCES OBS::libmfx INTERFACE_SOURCES)
+add_subdirectory(obs-qsv-test)
 
 
-foreach(_LIBMFX_SOURCE ${_LIBMFX_SOURCES})
-  get_filename_component(_EXT ${_LIBMFX_SOURCE} EXT)
-  if(${_EXT} STREQUAL "hpp" OR ${_EXT} STREQUAL "h")
-    source_group("libmfx\\Header Files" FILES ${_LIBMFX_SOURCE})
-  elseif(${_EXT} STREQUAL "cpp" OR ${_EXT} STREQUAL "c")
-    source_group("libmfx\\Source Files" FILES ${_LIBMFX_SOURCE})
-  endif()
-endforeach()
+# cmake-format: off
+set_target_properties_obs(obs-qsv11 PROPERTIES FOLDER plugins/obs-qsv11 PREFIX "")
+# cmake-format: on
 
 
-setup_plugin_target(obs-qsv11)
+get_target_property(target_sources libmfx SOURCES)
+list(FILTER target_sources INCLUDE REGEX ".*\\.(m|c[cp]?p?|swift)")
+list(FILTER target_headers INCLUDE REGEX ".*\\.h(pp)?")
+source_group("libmfx\\Source Files" FILES ${target_sources})
+source_group("libmfx\\Header Files" FILES ${target_headers})

+ 125 - 0
plugins/obs-qsv11/cmake/legacy.cmake

@@ -0,0 +1,125 @@
+option(ENABLE_QSV11 "Build Intel QSV11 Hardware Encoder." TRUE)
+
+if(NOT ENABLE_QSV11)
+  obs_status(DISABLED "obs-qsv11")
+  return()
+endif()
+
+project(obs-qsv11)
+
+add_library(obs-qsv11 MODULE)
+add_library(OBS::qsv11 ALIAS obs-qsv11)
+
+add_library(libmfx INTERFACE)
+add_library(OBS::libmfx ALIAS libmfx)
+
+target_sources(
+  libmfx
+  INTERFACE libmfx/src/main.cpp
+            libmfx/src/mfx_critical_section.cpp
+            libmfx/src/mfx_dispatcher.cpp
+            libmfx/src/mfx_dispatcher_log.cpp
+            libmfx/src/mfx_driver_store_loader.cpp
+            libmfx/src/mfx_dxva2_device.cpp
+            libmfx/src/mfx_function_table.cpp
+            libmfx/src/mfx_library_iterator.cpp
+            libmfx/src/mfx_load_dll.cpp
+            libmfx/src/mfx_load_plugin.cpp
+            libmfx/src/mfx_plugin_hive.cpp
+            libmfx/src/mfx_win_reg_key.cpp
+            libmfx/include/msdk/include/mfxadapter.h
+            libmfx/include/msdk/include/mfxastructures.h
+            libmfx/include/msdk/include/mfxaudio.h
+            libmfx/include/msdk/include/mfxaudio++.h
+            libmfx/include/msdk/include/mfxcommon.h
+            libmfx/include/msdk/include/mfxdefs.h
+            libmfx/include/msdk/include/mfxjpeg.h
+            libmfx/include/msdk/include/mfxmvc.h
+            libmfx/include/msdk/include/mfxplugin.h
+            libmfx/include/msdk/include/mfxplugin++.h
+            libmfx/include/msdk/include/mfxsession.h
+            libmfx/include/msdk/include/mfxstructures.h
+            libmfx/include/msdk/include/mfxvideo.h
+            libmfx/include/msdk/include/mfxvideo++.h
+            libmfx/include/msdk/include/mfxvstructures.h
+            libmfx/include/mfx_critical_section.h
+            libmfx/include/mfx_dispatcher.h
+            libmfx/include/mfx_dispatcher_defs.h
+            libmfx/include/mfx_dispatcher_log.h
+            libmfx/include/mfx_driver_store_loader.h
+            libmfx/include/mfx_dxva2_device.h
+            libmfx/include/mfx_exposed_functions_list.h
+            libmfx/include/mfx_library_iterator.h
+            libmfx/include/mfx_load_dll.h
+            libmfx/include/mfx_load_plugin.h
+            libmfx/include/mfx_plugin_hive.h
+            libmfx/include/mfx_vector.h
+            libmfx/include/mfx_win_reg_key.h
+            libmfx/include/mfxaudio_exposed_functions_list.h)
+
+target_include_directories(libmfx INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include/msdk/include
+                                            ${CMAKE_CURRENT_SOURCE_DIR}/libmfx/include)
+
+target_sources(
+  obs-qsv11
+  PRIVATE obs-qsv11.c
+          obs-qsv11-plugin-main.c
+          common_directx9.cpp
+          common_directx9.h
+          common_directx11.cpp
+          common_directx11.h
+          common_utils.cpp
+          common_utils.h
+          common_utils_windows.cpp
+          device_directx9.cpp
+          device_directx9.h
+          QSV_Encoder.cpp
+          QSV_Encoder.h
+          QSV_Encoder_Internal.cpp
+          QSV_Encoder_Internal.h
+          bits/linux_defs.h
+          bits/windows_defs.h)
+
+target_link_libraries(
+  obs-qsv11
+  PRIVATE OBS::libobs
+          OBS::libmfx
+          d3d9
+          d3d11
+          dxva2
+          dxgi
+          dxguid)
+
+target_compile_definitions(obs-qsv11 PRIVATE DX11_D3D)
+
+if(OS_WINDOWS)
+  add_subdirectory(obs-qsv-test)
+
+  set(MODULE_DESCRIPTION "OBS QSV encoder")
+  configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-qsv11.rc)
+
+  target_sources(obs-qsv11 PRIVATE obs-qsv11.rc)
+
+  target_compile_definitions(obs-qsv11 PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
+endif()
+
+set_target_properties(obs-qsv11 PROPERTIES FOLDER "plugins/obs-qsv11")
+
+file(GLOB _OBS_QSV11_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
+file(GLOB _OBS_QSV11_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
+
+source_group("obs-qsv11\\Source Files" FILES ${_OBS_QSV11_SOURCE_FILES})
+source_group("obs-qsv11\\Header Files" FILES ${_OBS_QSV11_HEADER_FILES})
+
+get_target_property(_LIBMFX_SOURCES OBS::libmfx INTERFACE_SOURCES)
+
+foreach(_LIBMFX_SOURCE ${_LIBMFX_SOURCES})
+  get_filename_component(_EXT ${_LIBMFX_SOURCE} EXT)
+  if(${_EXT} STREQUAL "hpp" OR ${_EXT} STREQUAL "h")
+    source_group("libmfx\\Header Files" FILES ${_LIBMFX_SOURCE})
+  elseif(${_EXT} STREQUAL "cpp" OR ${_EXT} STREQUAL "c")
+    source_group("libmfx\\Source Files" FILES ${_LIBMFX_SOURCE})
+  endif()
+endforeach()
+
+setup_plugin_target(obs-qsv11)

+ 24 - 0
plugins/obs-qsv11/cmake/windows/obs-module.rc.in

@@ -0,0 +1,24 @@
+1 VERSIONINFO
+FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName", "${OBS_COMPANY_NAME}"
+      VALUE "FileDescription", "OBS QSV encoder"
+      VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "ProductName", "${OBS_PRODUCT_NAME}"
+      VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "Comments", "${OBS_COMMENTS}"
+      VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
+      VALUE "InternalName", "obs-qsv11"
+      VALUE "OriginalFilename", "obs-qsv11"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04B0
+  END
+END

+ 7 - 6
plugins/obs-qsv11/obs-qsv-test/CMakeLists.txt

@@ -1,11 +1,12 @@
-project(obs-qsv-test)
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
-include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/libobs)
+legacy_check()
 
 
 add_executable(obs-qsv-test)
 add_executable(obs-qsv-test)
-target_sources(obs-qsv-test PRIVATE obs-qsv-test.cpp)
-target_link_libraries(obs-qsv-test d3d11 dxgi dxguid OBS::libmfx)
 
 
-set_target_properties(obs-qsv-test PROPERTIES FOLDER "plugins/obs-qsv11")
+target_sources(obs-qsv-test PRIVATE obs-qsv-test.cpp)
+target_link_libraries(obs-qsv-test d3d11 dxgi dxguid OBS::libmfx OBS::COMutils)
 
 
-setup_binary_target(obs-qsv-test)
+# cmake-format: off
+set_target_properties_obs(obs-qsv-test PROPERTIES FOLDER plugins/obs-qsv11 PREFIX "")
+# cmake-format: on

+ 11 - 0
plugins/obs-qsv11/obs-qsv-test/cmake/legacy.cmake

@@ -0,0 +1,11 @@
+project(obs-qsv-test)
+
+include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/libobs)
+
+add_executable(obs-qsv-test)
+target_sources(obs-qsv-test PRIVATE obs-qsv-test.cpp)
+target_link_libraries(obs-qsv-test d3d11 dxgi dxguid OBS::libmfx)
+
+set_target_properties(obs-qsv-test PROPERTIES FOLDER "plugins/obs-qsv11")
+
+setup_binary_target(obs-qsv-test)

+ 8 - 11
plugins/obs-text/CMakeLists.txt

@@ -1,19 +1,16 @@
-project(obs-text)
+cmake_minimum_required(VERSION 3.24...3.25)
+
+legacy_check()
 
 
 add_library(obs-text MODULE)
 add_library(obs-text MODULE)
 add_library(OBS::text ALIAS obs-text)
 add_library(OBS::text ALIAS obs-text)
 
 
-target_link_libraries(obs-text PRIVATE OBS::libobs)
-
-set_target_properties(obs-text PROPERTIES FOLDER "plugins")
-
-set(MODULE_DESCRIPTION "OBS GDI+ text module")
-configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-text.rc)
+configure_file(cmake/windows/obs-module.rc.in obs-text.rc)
 
 
 target_sources(obs-text PRIVATE gdiplus/obs-text.cpp obs-text.rc)
 target_sources(obs-text PRIVATE gdiplus/obs-text.cpp obs-text.rc)
 
 
-target_link_libraries(obs-text PRIVATE gdiplus)
-
-target_compile_definitions(obs-text PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
+target_link_libraries(obs-text PRIVATE OBS::libobs gdiplus)
 
 
-setup_plugin_target(obs-text)
+# cmake-format: off
+set_target_properties_obs(obs-text PROPERTIES FOLDER plugins PREFIX "")
+# cmake-format: on

+ 19 - 0
plugins/obs-text/cmake/legacy.cmake

@@ -0,0 +1,19 @@
+project(obs-text)
+
+add_library(obs-text MODULE)
+add_library(OBS::text ALIAS obs-text)
+
+target_link_libraries(obs-text PRIVATE OBS::libobs)
+
+set_target_properties(obs-text PROPERTIES FOLDER "plugins")
+
+set(MODULE_DESCRIPTION "OBS GDI+ text module")
+configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in obs-text.rc)
+
+target_sources(obs-text PRIVATE gdiplus/obs-text.cpp obs-text.rc)
+
+target_link_libraries(obs-text PRIVATE gdiplus)
+
+target_compile_definitions(obs-text PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
+
+setup_plugin_target(obs-text)

+ 24 - 0
plugins/obs-text/cmake/windows/obs-module.rc.in

@@ -0,0 +1,24 @@
+1 VERSIONINFO
+FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName", "${OBS_COMPANY_NAME}"
+      VALUE "FileDescription", "OBS GDI+ text module"
+      VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "ProductName", "${OBS_PRODUCT_NAME}"
+      VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "Comments", "${OBS_COMMENTS}"
+      VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
+      VALUE "InternalName", "obs-text"
+      VALUE "OriginalFilename", "obs-text"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04B0
+  END
+END

+ 58 - 33
plugins/win-capture/CMakeLists.txt

@@ -1,62 +1,87 @@
-project(win-capture)
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
-option(ENABLE_COMPAT_UPDATES "Checks for service updates" OFF)
+if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
+  add_library(hook-config INTERFACE)
+  add_library(OBS::hook-config ALIAS hook-config)
+  target_sources(hook-config INTERFACE graphics-hook-ver.h graphics-hook-info.h hook-helpers.h)
+  target_include_directories(hook-config INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+
+  add_library(inject-library INTERFACE)
+  add_library(OBS::inject-library ALIAS inject-library)
+  target_sources(inject-library INTERFACE inject-library.c inject-library.h)
+  target_include_directories(inject-library INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+
+  add_library(d3d8-api INTERFACE)
+  add_library(OBS::d3d8-api ALIAS d3d8-api)
+  target_sources(d3d8-api INTERFACE d3d8-api/d3d8.h d3d8-api/d3d8caps.h d3d8-api/d3d8types.h)
+  target_include_directories(d3d8-api INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/d3d8-api")
+endif()
+
+legacy_check()
 
 
-set(COMPAT_URL
-    "https://obsproject.com/obs2_update/win-capture"
-    CACHE STRING "Default services package URL")
+option(ENABLE_COMPAT_UPDATES "Checks for service updates" OFF)
 
 
+# cmake-format: off
+set(COMPAT_URL "https://obsproject.com/obs2_update/win-capture" CACHE STRING "Default services package URL")
 mark_as_advanced(COMPAT_URL)
 mark_as_advanced(COMPAT_URL)
+# cmake-format: on
+
+if(NOT TARGET OBS::ipc-util)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/deps/ipc-util" "${CMAKE_BINARY_DIR}/deps/ipc-util")
+endif()
+
+if(NOT TARGET OBS::file-updater)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/deps/file-updater" "${CMAKE_BINARY_DIR}/deps/file-updater")
+endif()
+
+find_package(jansson REQUIRED)
 
 
 add_library(win-capture MODULE)
 add_library(win-capture MODULE)
 add_library(OBS::capture ALIAS win-capture)
 add_library(OBS::capture ALIAS win-capture)
 
 
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compat-config.h.in ${CMAKE_BINARY_DIR}/config/compat-config.h)
-
 target_sources(
 target_sources(
   win-capture
   win-capture
-  PRIVATE plugin-main.c
+  PRIVATE # cmake-format: sortable
           app-helpers.c
           app-helpers.c
           app-helpers.h
           app-helpers.h
+          compat-format-ver.h
+          compat-helpers.c
+          compat-helpers.h
           cursor-capture.c
           cursor-capture.c
           cursor-capture.h
           cursor-capture.h
           dc-capture.c
           dc-capture.c
           dc-capture.h
           dc-capture.h
           duplicator-monitor-capture.c
           duplicator-monitor-capture.c
-          game-capture.c
           game-capture-file-init.c
           game-capture-file-init.c
-          graphics-hook-info.h
-          graphics-hook-ver.h
-          hook-helpers.h
-          inject-library.c
-          inject-library.h
+          game-capture.c
           load-graphics-offsets.c
           load-graphics-offsets.c
           monitor-capture.c
           monitor-capture.c
           nt-stuff.c
           nt-stuff.c
           nt-stuff.h
           nt-stuff.h
-          window-capture.c
-          compat-helpers.c
-          compat-helpers.h
-          compat-format-ver.h
-          ../../libobs/util/windows/obfuscate.c
-          ../../libobs/util/windows/obfuscate.h
-          ${CMAKE_BINARY_DIR}/config/compat-config.h)
-
-target_link_libraries(win-capture PRIVATE OBS::libobs OBS::ipc-util OBS::file-updater Jansson::Jansson)
+          plugin-main.c
+          window-capture.c)
 
 
-set_target_properties(win-capture PROPERTIES FOLDER "plugins/win-capture")
+target_compile_definitions(
+  win-capture PRIVATE COMPAT_URL="${COMPAT_URL}" "$<$<BOOL:${ENABLE_COMPAT_UPDATES}>:ENABLE_COMPAT_UPDATES>"
+                      OBS_VERSION="${OBS_VERSION_CANONICAL}")
 
 
-if(MSVC)
-  target_link_libraries(win-capture PRIVATE OBS::w32-pthreads)
-  target_link_options(win-capture PRIVATE "LINKER:/IGNORE:4098")
-endif()
-
-target_compile_definitions(win-capture PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS
-                                               OBS_VERSION="${OBS_VERSION_CANONICAL}")
+target_link_libraries(
+  win-capture
+  PRIVATE OBS::file-updater
+          OBS::hook-config
+          OBS::inject-library
+          OBS::ipc-util
+          OBS::libobs
+          OBS::obfuscate
+          OBS::w32-pthreads
+          OBS::winrt-headers
+          jansson::jansson)
 
 
-set_property(GLOBAL APPEND PROPERTY OBS_MODULE_LIST "win-capture")
+target_link_options(win-capture PRIVATE /NODEFAULTLIB:msvcrtd.lib)
 
 
-setup_plugin_target(win-capture)
+# cmake-format: off
+set_target_properties_obs(win-capture PROPERTIES FOLDER plugins/win-capture PREFIX "")
+# cmake-format: on
 
 
 add_subdirectory(graphics-hook)
 add_subdirectory(graphics-hook)
 add_subdirectory(get-graphics-offsets)
 add_subdirectory(get-graphics-offsets)

+ 3 - 0
plugins/win-capture/cmake/32bit-build.cmake

@@ -0,0 +1,3 @@
+add_subdirectory(graphics-hook)
+add_subdirectory(get-graphics-offsets)
+add_subdirectory(inject-helper)

+ 63 - 0
plugins/win-capture/cmake/legacy.cmake

@@ -0,0 +1,63 @@
+project(win-capture)
+
+option(ENABLE_COMPAT_UPDATES "Checks for service updates" OFF)
+
+set(COMPAT_URL
+    "https://obsproject.com/obs2_update/win-capture"
+    CACHE STRING "Default services package URL")
+
+mark_as_advanced(COMPAT_URL)
+
+add_library(win-capture MODULE)
+add_library(OBS::capture ALIAS win-capture)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compat-config.h.in ${CMAKE_BINARY_DIR}/config/compat-config.h)
+
+target_sources(
+  win-capture
+  PRIVATE plugin-main.c
+          app-helpers.c
+          app-helpers.h
+          cursor-capture.c
+          cursor-capture.h
+          dc-capture.c
+          dc-capture.h
+          duplicator-monitor-capture.c
+          game-capture.c
+          game-capture-file-init.c
+          graphics-hook-info.h
+          graphics-hook-ver.h
+          hook-helpers.h
+          inject-library.c
+          inject-library.h
+          load-graphics-offsets.c
+          monitor-capture.c
+          nt-stuff.c
+          nt-stuff.h
+          window-capture.c
+          compat-helpers.c
+          compat-helpers.h
+          compat-format-ver.h
+          ../../libobs/util/windows/obfuscate.c
+          ../../libobs/util/windows/obfuscate.h
+          ${CMAKE_BINARY_DIR}/config/compat-config.h)
+
+target_link_libraries(win-capture PRIVATE OBS::libobs OBS::ipc-util OBS::file-updater Jansson::Jansson)
+
+set_target_properties(win-capture PROPERTIES FOLDER "plugins/win-capture")
+
+if(MSVC)
+  target_link_libraries(win-capture PRIVATE OBS::w32-pthreads)
+  target_link_options(win-capture PRIVATE "LINKER:/IGNORE:4098")
+endif()
+
+target_compile_definitions(win-capture PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS
+                                               OBS_VERSION="${OBS_VERSION_CANONICAL}")
+
+set_property(GLOBAL APPEND PROPERTY OBS_MODULE_LIST "win-capture")
+
+setup_plugin_target(win-capture)
+
+add_subdirectory(graphics-hook)
+add_subdirectory(get-graphics-offsets)
+add_subdirectory(inject-helper)

+ 5 - 0
plugins/win-capture/duplicator-monitor-capture.c

@@ -5,8 +5,13 @@
 #include <util/threading.h>
 #include <util/threading.h>
 
 
 #include "cursor-capture.h"
 #include "cursor-capture.h"
+#ifdef OBS_LEGACY
 #include "../../libobs/util/platform.h"
 #include "../../libobs/util/platform.h"
 #include "../../libobs-winrt/winrt-capture.h"
 #include "../../libobs-winrt/winrt-capture.h"
+#else
+#include <util/platform.h>
+#include <winrt-capture.h>
+#endif
 
 
 #define do_log(level, format, ...)                                \
 #define do_log(level, format, ...)                                \
 	blog(level, "[duplicator-monitor-capture: '%s'] " format, \
 	blog(level, "[duplicator-monitor-capture: '%s'] " format, \

+ 13 - 21
plugins/win-capture/get-graphics-offsets/CMakeLists.txt

@@ -1,30 +1,22 @@
-project(get-graphics-offsets)
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
-add_executable(get-graphics-offsets)
+add_library(_get-graphics-offsets INTERFACE)
+target_sources(_get-graphics-offsets INTERFACE d3d8-offsets.cpp d3d9-offsets.cpp dxgi-offsets.cpp
+                                               get-graphics-offsets.c get-graphics-offsets.h)
 
 
-target_sources(
-  get-graphics-offsets
-  PRIVATE get-graphics-offsets.c
-          get-graphics-offsets.h
-          dxgi-offsets.cpp
-          d3d8-offsets.cpp
-          d3d9-offsets.cpp
-          ../graphics-hook-info.h
-          ../hook-helpers.h)
+target_compile_options(_get-graphics-offsets INTERFACE $<IF:$<CONFIG:Debug>,/MTd,/MT>)
 
 
-target_include_directories(get-graphics-offsets PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
+target_link_libraries(_get-graphics-offsets INTERFACE OBS::hook-config OBS::d3d8-api d3d9.lib dxgi.lib d3d11.lib)
 
 
-target_link_libraries(get-graphics-offsets d3d9.lib dxgi.lib d3d11.lib)
+legacy_check()
 
 
-if(MSVC)
-  target_compile_options(get-graphics-offsets PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
-endif()
+add_executable(get-graphics-offsets)
+target_link_libraries(get-graphics-offsets PRIVATE _get-graphics-offsets)
 
 
-set_target_properties(get-graphics-offsets PROPERTIES FOLDER "plugins/win-capture")
-set_target_properties(get-graphics-offsets
-                      PROPERTIES OUTPUT_NAME "get-graphics-offsets$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,64,32>")
+include(cmake/32bit.cmake)
 
 
-set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/")
-setup_plugin_target(get-graphics-offsets)
+# cmake-format: off
+set_target_properties_obs(get-graphics-offsets PROPERTIES FOLDER plugins/win-capture OUTPUT_NAME get-graphics-offsets64)
+# cmake-format: on
 
 
 add_dependencies(win-capture get-graphics-offsets)
 add_dependencies(win-capture get-graphics-offsets)

+ 5 - 0
plugins/win-capture/get-graphics-offsets/cmake/32bit-build.cmake

@@ -0,0 +1,5 @@
+project(get-graphics-offsets)
+
+add_executable(get-graphics-offsets)
+target_link_libraries(get-graphics-offsets PRIVATE _get-graphics-offsets)
+set_property(TARGET get-graphics-offsets PROPERTY OUTPUT_NAME get-graphics-offsets32)

+ 5 - 0
plugins/win-capture/get-graphics-offsets/cmake/32bit.cmake

@@ -0,0 +1,5 @@
+add_custom_command(
+  TARGET get-graphics-offsets
+  POST_BUILD
+  COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $<CONFIG> -t get-graphics-offsets
+  COMMENT "Build 32-bit get-graphics-offsets")

+ 33 - 0
plugins/win-capture/get-graphics-offsets/cmake/legacy.cmake

@@ -0,0 +1,33 @@
+project(get-graphics-offsets)
+
+add_executable(get-graphics-offsets)
+
+target_sources(
+  get-graphics-offsets
+  PRIVATE get-graphics-offsets.c
+          get-graphics-offsets.h
+          dxgi-offsets.cpp
+          d3d8-offsets.cpp
+          d3d9-offsets.cpp
+          ../graphics-hook-info.h
+          ../hook-helpers.h)
+
+target_include_directories(get-graphics-offsets PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..
+                                                        ${CMAKE_CURRENT_SOURCE_DIR}/../d3d8-api)
+
+target_link_libraries(get-graphics-offsets d3d9.lib dxgi.lib d3d11.lib)
+
+target_compile_definitions(get-graphics-offsets PRIVATE OBS_LEGACY)
+
+if(MSVC)
+  target_compile_options(get-graphics-offsets PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
+endif()
+
+set_target_properties(get-graphics-offsets PROPERTIES FOLDER "plugins/win-capture")
+set_target_properties(get-graphics-offsets
+                      PROPERTIES OUTPUT_NAME "get-graphics-offsets$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,64,32>")
+
+set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/")
+setup_plugin_target(get-graphics-offsets)
+
+add_dependencies(win-capture get-graphics-offsets)

+ 4 - 0
plugins/win-capture/get-graphics-offsets/d3d8-offsets.cpp

@@ -1,6 +1,10 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <windows.h>
 #include <windows.h>
+#ifdef OBS_LEGACY
 #include "../d3d8-api/d3d8.h"
 #include "../d3d8-api/d3d8.h"
+#else
+#include <d3d8.h>
+#endif
 #include "get-graphics-offsets.h"
 #include "get-graphics-offsets.h"
 
 
 typedef IDirect3D8 *(WINAPI *d3d8create_t)(UINT);
 typedef IDirect3D8 *(WINAPI *d3d8create_t)(UINT);

+ 4 - 0
plugins/win-capture/get-graphics-offsets/get-graphics-offsets.h

@@ -2,7 +2,11 @@
 
 
 #include <stdint.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <stdbool.h>
+#ifdef OBS_LEGACY
 #include "../graphics-hook-info.h"
 #include "../graphics-hook-info.h"
+#else
+#include <graphics-hook-info.h>
+#endif
 
 
 #define DUMMY_WNDCLASS "get_addrs_wndclass"
 #define DUMMY_WNDCLASS "get_addrs_wndclass"
 
 

+ 41 - 41
plugins/win-capture/graphics-hook/CMakeLists.txt

@@ -1,57 +1,57 @@
-project(graphics-hook)
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
 find_package(Detours REQUIRED)
 find_package(Detours REQUIRED)
 find_package(Vulkan REQUIRED)
 find_package(Vulkan REQUIRED)
 
 
-add_library(graphics-hook MODULE)
-add_library(OBS::graphics-hook ALIAS graphics-hook)
+if(NOT TARGET OBS::ipc-util)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/deps/ipc-util" "${CMAKE_BINARY_DIR}/deps/ipc-util")
+endif()
 
 
-target_sources(
-  graphics-hook
-  PRIVATE graphics-hook.c
-          graphics-hook.h
-          gl-capture.c
-          gl-decs.h
-          d3d8-capture.cpp
-          d3d9-capture.cpp
-          d3d9-patches.hpp
-          dxgi-capture.cpp
-          d3d10-capture.cpp
-          d3d11-capture.cpp
-          d3d12-capture.cpp
-          ../../../libobs/util/windows/obfuscate.c
-          ../../../libobs/util/windows/obfuscate.h
-          ../graphics-hook-ver.h
-          ../graphics-hook-info.h
-          ../hook-helpers.h
-          graphics-hook.rc)
-
-target_include_directories(graphics-hook PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
-
-target_link_libraries(graphics-hook PRIVATE OBS::ipc-util Detours::Detours dxguid)
-target_link_options(graphics-hook PRIVATE "LINKER:/IGNORE:4099")
-
-if(MSVC)
-  target_compile_options(graphics-hook PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
+if(NOT TARGET OBS::obfuscate)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
 endif()
 endif()
 
 
-set_target_properties(graphics-hook PROPERTIES FOLDER "plugins/win-capture"
-                                               OUTPUT_NAME "graphics-hook$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,64,32>")
+add_library(_graphics-hook INTERFACE)
 
 
-target_compile_definitions(graphics-hook PRIVATE COMPILE_D3D12_HOOK)
+target_sources(
+  _graphics-hook
+  INTERFACE d3d8-capture.cpp
+            d3d9-capture.cpp
+            d3d9-patches.hpp
+            d3d10-capture.cpp
+            d3d11-capture.cpp
+            d3d12-capture.cpp
+            dxgi-capture.cpp
+            gl-capture.c
+            gl-decs.h
+            graphics-hook.c
+            graphics-hook.h
+            graphics-hook.rc)
+
+target_compile_definitions(_graphics-hook INTERFACE COMPILE_D3D12_HOOK)
+target_compile_options(_graphics-hook INTERFACE $<IF:$<CONFIG:Debug>,/MTd,/MT>)
+
+target_link_libraries(_graphics-hook INTERFACE OBS::d3d8-api OBS::hook-config OBS::ipc-util OBS::obfuscate
+                                               Detours::Detours dxguid)
+target_link_options(_graphics-hook INTERFACE /IGNORE:4099)
 
 
 if(TARGET Vulkan::Vulkan)
 if(TARGET Vulkan::Vulkan)
-  target_sources(graphics-hook PRIVATE vulkan-capture.c vulkan-capture.h)
+  target_sources(_graphics-hook INTERFACE vulkan-capture.c vulkan-capture.h)
+  target_link_libraries(_graphics-hook INTERFACE Vulkan::Vulkan)
+  target_compile_definitions(_graphics-hook INTERFACE COMPILE_VULKAN_HOOK)
+endif()
 
 
-  target_link_libraries(graphics-hook PRIVATE Vulkan::Vulkan)
+legacy_check()
 
 
-  target_compile_definitions(graphics-hook PRIVATE COMPILE_VULKAN_HOOK)
+add_library(graphics-hook MODULE)
+add_library(OBS::graphics-hook ALIAS graphics-hook)
 
 
-  add_target_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan64.json" "obs-plugins/win-capture/")
-  add_target_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan32.json" "obs-plugins/win-capture/")
-endif()
+target_link_libraries(graphics-hook PRIVATE _graphics-hook)
+
+include(cmake/32bit.cmake)
 
 
-set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/")
-setup_plugin_target(graphics-hook)
+# cmake-format: off
+set_target_properties_obs(graphics-hook PROPERTIES FOLDER "plugins/win-capture" OUTPUT_NAME graphics-hook64)
+# cmake-format: on
 
 
 add_dependencies(win-capture graphics-hook)
 add_dependencies(win-capture graphics-hook)

+ 9 - 0
plugins/win-capture/graphics-hook/cmake/32bit-build.cmake

@@ -0,0 +1,9 @@
+project(graphics-hook)
+
+if(NOT TARGET OBS::obfuscate)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
+endif()
+
+add_library(graphics-hook MODULE)
+target_link_libraries(graphics-hook PRIVATE _graphics-hook)
+set_property(TARGET graphics-hook PROPERTY OUTPUT_NAME graphics-hook32)

+ 5 - 0
plugins/win-capture/graphics-hook/cmake/32bit.cmake

@@ -0,0 +1,5 @@
+add_custom_command(
+  TARGET graphics-hook
+  POST_BUILD
+  COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $<CONFIG> -t graphics-hook
+  COMMENT "Build 32-bit graphics-hook")

+ 58 - 0
plugins/win-capture/graphics-hook/cmake/legacy.cmake

@@ -0,0 +1,58 @@
+project(graphics-hook)
+
+find_package(Detours REQUIRED)
+find_package(Vulkan REQUIRED)
+
+add_library(graphics-hook MODULE)
+add_library(OBS::graphics-hook ALIAS graphics-hook)
+
+target_sources(
+  graphics-hook
+  PRIVATE graphics-hook.c
+          graphics-hook.h
+          gl-capture.c
+          gl-decs.h
+          d3d8-capture.cpp
+          d3d9-capture.cpp
+          d3d9-patches.hpp
+          dxgi-capture.cpp
+          d3d10-capture.cpp
+          d3d11-capture.cpp
+          d3d12-capture.cpp
+          ../../../libobs/util/windows/obfuscate.c
+          ../../../libobs/util/windows/obfuscate.h
+          ../graphics-hook-ver.h
+          ../graphics-hook-info.h
+          ../hook-helpers.h
+          graphics-hook.rc)
+
+target_include_directories(graphics-hook PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_SOURCE_DIR}/libobs
+                                                 ${CMAKE_CURRENT_SOURCE_DIR}/../d3d8-api)
+
+target_link_libraries(graphics-hook PRIVATE OBS::ipc-util Detours::Detours dxguid)
+target_link_options(graphics-hook PRIVATE "LINKER:/IGNORE:4099")
+
+if(MSVC)
+  target_compile_options(graphics-hook PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
+endif()
+
+set_target_properties(graphics-hook PROPERTIES FOLDER "plugins/win-capture"
+                                               OUTPUT_NAME "graphics-hook$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,64,32>")
+
+target_compile_definitions(graphics-hook PRIVATE COMPILE_D3D12_HOOK OBS_LEGACY)
+
+if(TARGET Vulkan::Vulkan)
+  target_sources(graphics-hook PRIVATE vulkan-capture.c vulkan-capture.h)
+
+  target_link_libraries(graphics-hook PRIVATE Vulkan::Vulkan)
+
+  target_compile_definitions(graphics-hook PRIVATE COMPILE_VULKAN_HOOK)
+
+  add_target_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan64.json" "obs-plugins/win-capture/")
+  add_target_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan32.json" "obs-plugins/win-capture/")
+endif()
+
+set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/")
+setup_plugin_target(graphics-hook)
+
+add_dependencies(win-capture graphics-hook)

+ 4 - 0
plugins/win-capture/graphics-hook/d3d8-capture.cpp

@@ -1,6 +1,10 @@
 #include <dxgi.h>
 #include <dxgi.h>
 
 
+#ifdef OBS_LEGACY
 #include "../d3d8-api/d3d8.h"
 #include "../d3d8-api/d3d8.h"
+#else
+#include <d3d8.h>
+#endif
 #include "graphics-hook.h"
 #include "graphics-hook.h"
 
 
 #include <detours.h>
 #include <detours.h>

+ 5 - 0
plugins/win-capture/graphics-hook/graphics-hook.c

@@ -2,8 +2,13 @@
 #include <psapi.h>
 #include <psapi.h>
 #include <inttypes.h>
 #include <inttypes.h>
 #include "graphics-hook.h"
 #include "graphics-hook.h"
+#ifdef OBS_LEGACY
 #include "../graphics-hook-ver.h"
 #include "../graphics-hook-ver.h"
 #include "../../libobs/util/windows/obfuscate.h"
 #include "../../libobs/util/windows/obfuscate.h"
+#else
+#include <graphics-hook-ver.h>
+#include <util/windows/obfuscate.h>
+#endif
 
 
 #define DEBUG_OUTPUT
 #define DEBUG_OUTPUT
 
 

+ 4 - 0
plugins/win-capture/graphics-hook/graphics-hook.h

@@ -5,7 +5,11 @@
 #pragma warning(disable : 4152)
 #pragma warning(disable : 4152)
 #endif
 #endif
 
 
+#ifdef OBS_LEGACY
 #include "../graphics-hook-info.h"
 #include "../graphics-hook-info.h"
+#else
+#include <graphics-hook-info.h>
+#endif
 #include <ipc-util/pipe.h>
 #include <ipc-util/pipe.h>
 #include <psapi.h>
 #include <psapi.h>
 
 

+ 15 - 12
plugins/win-capture/inject-helper/CMakeLists.txt

@@ -1,20 +1,23 @@
-project(inject-helper)
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
-add_executable(inject-helper)
+if(NOT TARGET OBS::obfuscate)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
+endif()
 
 
-target_sources(inject-helper PRIVATE inject-helper.c ../inject-library.c ../inject-library.h
-                                     ../../../libobs/util/windows/obfuscate.c ../../../libobs/util/windows/obfuscate.h)
+add_library(_inject-helper INTERFACE)
+target_sources(_inject-helper INTERFACE inject-helper.c)
+target_compile_options(_inject-helper INTERFACE $<IF:$<CONFIG:Debug>,/MTd,/MT>)
+target_link_libraries(_inject-helper INTERFACE OBS::inject-library OBS::obfuscate)
 
 
-target_include_directories(inject-helper PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
+legacy_check()
 
 
-if(MSVC)
-  target_compile_options(inject-helper PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
-endif()
+add_executable(inject-helper)
+target_link_libraries(inject-helper PRIVATE _inject-helper)
 
 
-set_target_properties(inject-helper PROPERTIES FOLDER "plugins/win-capture"
-                                               OUTPUT_NAME "inject-helper$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,64,32>")
+include(cmake/32bit.cmake)
 
 
-set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/")
-setup_plugin_target(inject-helper)
+# cmake-format: off
+set_target_properties_obs(inject-helper PROPERTIES FOLDER plugins/win-capture OUTPUT_NAME inject-helper64)
+# cmake-format: on
 
 
 add_dependencies(win-capture inject-helper)
 add_dependencies(win-capture inject-helper)

+ 5 - 0
plugins/win-capture/inject-helper/cmake/32bit-build.cmake

@@ -0,0 +1,5 @@
+project(inject-helper)
+
+add_executable(inject-helper)
+target_link_libraries(inject-helper PRIVATE _inject-helper)
+set_property(TARGET inject-helper PROPERTY OUTPUT_NAME inject-helper32)

+ 5 - 0
plugins/win-capture/inject-helper/cmake/32bit.cmake

@@ -0,0 +1,5 @@
+add_custom_command(
+  TARGET inject-helper
+  POST_BUILD
+  COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $<CONFIG> -t inject-helper
+  COMMENT "Build 32-bit inject-helper")

+ 21 - 0
plugins/win-capture/inject-helper/cmake/legacy.cmake

@@ -0,0 +1,21 @@
+project(inject-helper)
+
+add_executable(inject-helper)
+
+target_sources(inject-helper PRIVATE inject-helper.c ../inject-library.c ../inject-library.h
+                                     ../../../libobs/util/windows/obfuscate.c ../../../libobs/util/windows/obfuscate.h)
+
+target_include_directories(inject-helper PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_SOURCE_DIR}/libobs)
+
+target_compile_definitions(inject-helper PRIVATE OBS_LEGACY)
+if(MSVC)
+  target_compile_options(inject-helper PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
+endif()
+
+set_target_properties(inject-helper PROPERTIES FOLDER "plugins/win-capture"
+                                               OUTPUT_NAME "inject-helper$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,64,32>")
+
+set(OBS_PLUGIN_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture/")
+setup_plugin_target(inject-helper)
+
+add_dependencies(win-capture inject-helper)

+ 5 - 0
plugins/win-capture/inject-helper/inject-helper.c

@@ -4,8 +4,13 @@
 #include <windows.h>
 #include <windows.h>
 #include <shellapi.h>
 #include <shellapi.h>
 #include <stdbool.h>
 #include <stdbool.h>
+#ifdef OBS_LEGACY
 #include "../../../libobs/util/windows/obfuscate.h"
 #include "../../../libobs/util/windows/obfuscate.h"
 #include "../inject-library.h"
 #include "../inject-library.h"
+#else
+#include <util/windows/obfuscate.h>
+#include <inject-library.h>
+#endif
 
 
 #if defined(_MSC_VER) && !defined(inline)
 #if defined(_MSC_VER) && !defined(inline)
 #define inline __inline
 #define inline __inline

+ 4 - 0
plugins/win-capture/inject-library.c

@@ -1,6 +1,10 @@
 #include <windows.h>
 #include <windows.h>
 #include <stdbool.h>
 #include <stdbool.h>
+#ifdef OBS_LEGACY
 #include "../../libobs/util/windows/obfuscate.h"
 #include "../../libobs/util/windows/obfuscate.h"
+#else
+#include <util/windows/obfuscate.h>
+#endif
 #include "inject-library.h"
 #include "inject-library.h"
 
 
 typedef HANDLE(WINAPI *create_remote_thread_t)(HANDLE, LPSECURITY_ATTRIBUTES,
 typedef HANDLE(WINAPI *create_remote_thread_t)(HANDLE, LPSECURITY_ATTRIBUTES,

+ 2 - 0
plugins/win-capture/plugin-main.c

@@ -8,7 +8,9 @@
 
 
 #include "compat-helpers.h"
 #include "compat-helpers.h"
 #include "compat-format-ver.h"
 #include "compat-format-ver.h"
+#ifdef OBS_LEGACY
 #include "compat-config.h"
 #include "compat-config.h"
+#endif
 
 
 #define WIN_CAPTURE_LOG_STRING "[win-capture plugin] "
 #define WIN_CAPTURE_LOG_STRING "[win-capture plugin] "
 #define WIN_CAPTURE_VER_STRING "win-capture plugin (libobs " OBS_VERSION ")"
 #define WIN_CAPTURE_VER_STRING "win-capture plugin (libobs " OBS_VERSION ")"

+ 5 - 0
plugins/win-capture/window-capture.c

@@ -4,8 +4,13 @@
 #include <util/windows/window-helpers.h>
 #include <util/windows/window-helpers.h>
 #include "dc-capture.h"
 #include "dc-capture.h"
 #include "compat-helpers.h"
 #include "compat-helpers.h"
+#ifdef OBS_LEGACY
 #include "../../libobs/util/platform.h"
 #include "../../libobs/util/platform.h"
 #include "../../libobs-winrt/winrt-capture.h"
 #include "../../libobs-winrt/winrt-capture.h"
+#else
+#include <util/platform.h>
+#include <winrt-capture.h>
+#endif
 
 
 /* clang-format off */
 /* clang-format off */
 
 

+ 25 - 192
plugins/win-dshow/CMakeLists.txt

@@ -1,215 +1,48 @@
-if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/dshowcapture.hpp")
-  obs_status(FATAL_ERROR "libdshowcapture submodule not found! Please fetch submodules. win-dshow plugin disabled.")
-  return()
-endif()
+cmake_minimum_required(VERSION 3.24...3.25)
 
 
-option(ENABLE_VIRTUALCAM "Enable building with Virtual Camera (Windows)" ON)
+if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
+  add_library(obs-virtualcam-interface INTERFACE)
+  add_library(OBS::virtualcam-interface ALIAS obs-virtualcam-interface)
 
 
-if(NOT ENABLE_VIRTUALCAM)
-  obs_status(DISABLED "Windows Virtual Camera")
-endif()
+  target_sources(obs-virtualcam-interface INTERFACE shared-memory-queue.c shared-memory-queue.h tiny-nv12-scale.c
+                                                    tiny-nv12-scale.h)
+  target_include_directories(obs-virtualcam-interface INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
 
 
-if(ENABLE_VIRTUALCAM AND NOT VIRTUALCAM_GUID)
-  set(VIRTUALCAM_GUID
-      ""
-      CACHE STRING "Virtual Camera GUID" FORCE)
-  mark_as_advanced(VIRTUALCAM_GUID)
+  include(cmake/libdshowcapture.cmake)
+  add_subdirectory(virtualcam-module)
 endif()
 endif()
 
 
-project(win-dshow)
+legacy_check()
 
 
-find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil)
+find_package(FFmpeg REQUIRED avcodec avutil)
 
 
 add_library(win-dshow MODULE)
 add_library(win-dshow MODULE)
 add_library(OBS::dshow ALIAS win-dshow)
 add_library(OBS::dshow ALIAS win-dshow)
 
 
-target_sources(win-dshow PRIVATE encode-dstr.hpp win-dshow.cpp win-dshow-encoder.cpp dshow-plugin.cpp ffmpeg-decode.c
-                                 ffmpeg-decode.h)
-
-add_library(libdshowcapture-external INTERFACE)
-add_library(libdshowcapture INTERFACE)
-add_library(OBS::libdshowcapture-external ALIAS libdshowcapture-external)
-add_library(OBS::libdshowcapture ALIAS libdshowcapture)
-
-target_sources(
-  libdshowcapture-external
-  INTERFACE libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp
-            libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp
-            libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
-            libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp)
-
-target_sources(
-  libdshowcapture
-  INTERFACE libdshowcapture/dshowcapture.hpp
-            libdshowcapture/source/capture-filter.cpp
-            libdshowcapture/source/capture-filter.hpp
-            libdshowcapture/source/output-filter.cpp
-            libdshowcapture/source/output-filter.hpp
-            libdshowcapture/source/dshowcapture.cpp
-            libdshowcapture/source/dshowencode.cpp
-            libdshowcapture/source/device.cpp
-            libdshowcapture/source/device.hpp
-            libdshowcapture/source/device-vendor.cpp
-            libdshowcapture/source/encoder.cpp
-            libdshowcapture/source/encoder.hpp
-            libdshowcapture/source/dshow-base.cpp
-            libdshowcapture/source/dshow-base.hpp
-            libdshowcapture/source/dshow-demux.cpp
-            libdshowcapture/source/dshow-demux.hpp
-            libdshowcapture/source/dshow-device-defs.hpp
-            libdshowcapture/source/dshow-enum.cpp
-            libdshowcapture/source/dshow-enum.hpp
-            libdshowcapture/source/dshow-formats.cpp
-            libdshowcapture/source/dshow-formats.hpp
-            libdshowcapture/source/dshow-media-type.cpp
-            libdshowcapture/source/dshow-encoded-device.cpp
-            libdshowcapture/source/dshow-media-type.hpp
-            libdshowcapture/source/log.cpp
-            libdshowcapture/source/log.hpp
-            libdshowcapture/source/external/IVideoCaptureFilter.h)
-
-target_include_directories(
-  libdshowcapture INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture
-                            ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/external/capture-device-support/Library)
-
-target_compile_definitions(libdshowcapture-external INTERFACE _UP_WINDOWS=1)
-target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1)
-target_compile_options(libdshowcapture-external INTERFACE /wd4018)
-
-set(MODULE_DESCRIPTION "OBS DirectShow module")
-
-configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-dshow.rc)
+target_sources(win-dshow PRIVATE dshow-plugin.cpp encode-dstr.hpp ffmpeg-decode.c ffmpeg-decode.h win-dshow-encoder.cpp
+                                 win-dshow.cpp)
 
 
+configure_file(cmake/windows/obs-module.rc.in win-dshow.rc)
 target_sources(win-dshow PRIVATE win-dshow.rc)
 target_sources(win-dshow PRIVATE win-dshow.rc)
 
 
-target_compile_definitions(win-dshow PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
-
-set(VIRTUALCAM_AVAILABLE OFF)
-if(ENABLE_VIRTUALCAM)
-  if(VIRTUALCAM_GUID STREQUAL "")
-    obs_status(WARNING "Windows Virtual Camera - GUID not set. Specify as 'VIRTUALCAM_GUID' to enable.")
-  else()
-    set(INVALID_GUID ON)
-
-    string(REPLACE "-" ";" GUID_VALS ${VIRTUALCAM_GUID})
-
-    list(LENGTH GUID_VALS GUID_VAL_COUNT)
-    if(GUID_VAL_COUNT EQUAL 5)
-      string(REPLACE ";" "0" GUID_HEX ${GUID_VALS})
-      string(REGEX MATCH "[0-9a-fA-F]+" GUID_ACTUAL_HEX ${GUID_HEX})
-      if(GUID_ACTUAL_HEX STREQUAL GUID_HEX)
-        list(GET GUID_VALS 0 GUID_VALS_DATA1)
-        list(GET GUID_VALS 1 GUID_VALS_DATA2)
-        list(GET GUID_VALS 2 GUID_VALS_DATA3)
-        list(GET GUID_VALS 3 GUID_VALS_DATA4)
-        list(GET GUID_VALS 4 GUID_VALS_DATA5)
-        string(LENGTH ${GUID_VALS_DATA1} GUID_VALS_DATA1_LENGTH)
-        string(LENGTH ${GUID_VALS_DATA2} GUID_VALS_DATA2_LENGTH)
-        string(LENGTH ${GUID_VALS_DATA3} GUID_VALS_DATA3_LENGTH)
-        string(LENGTH ${GUID_VALS_DATA4} GUID_VALS_DATA4_LENGTH)
-        string(LENGTH ${GUID_VALS_DATA5} GUID_VALS_DATA5_LENGTH)
-        if(GUID_VALS_DATA1_LENGTH EQUAL 8
-           AND GUID_VALS_DATA2_LENGTH EQUAL 4
-           AND GUID_VALS_DATA3_LENGTH EQUAL 4
-           AND GUID_VALS_DATA4_LENGTH EQUAL 4
-           AND GUID_VALS_DATA5_LENGTH EQUAL 12)
-          set(GUID_VAL01 ${GUID_VALS_DATA1})
-          set(GUID_VAL02 ${GUID_VALS_DATA2})
-          set(GUID_VAL03 ${GUID_VALS_DATA3})
-          string(SUBSTRING ${GUID_VALS_DATA4} 0 2 GUID_VAL04)
-          string(SUBSTRING ${GUID_VALS_DATA4} 2 2 GUID_VAL05)
-          string(SUBSTRING ${GUID_VALS_DATA5} 0 2 GUID_VAL06)
-          string(SUBSTRING ${GUID_VALS_DATA5} 2 2 GUID_VAL07)
-          string(SUBSTRING ${GUID_VALS_DATA5} 4 2 GUID_VAL08)
-          string(SUBSTRING ${GUID_VALS_DATA5} 6 2 GUID_VAL09)
-          string(SUBSTRING ${GUID_VALS_DATA5} 8 2 GUID_VAL10)
-          string(SUBSTRING ${GUID_VALS_DATA5} 10 2 GUID_VAL11)
-          set(VIRTUALCAM_AVAILABLE ON)
-          set(INVALID_GUID OFF)
-        endif()
-      endif()
-    endif()
-  endif()
-
-  if(INVALID_GUID)
-    obs_status(WARNING "Windows Virtual Camera - invalid GUID supplied")
-  endif()
-endif()
-
 target_link_libraries(
 target_link_libraries(
   win-dshow
   win-dshow
   PRIVATE OBS::libobs
   PRIVATE OBS::libobs
           OBS::w32-pthreads
           OBS::w32-pthreads
-          OBS::libdshowcapture-external
           OBS::libdshowcapture
           OBS::libdshowcapture
-          setupapi
-          strmiids
-          ksuser
-          winmm
-          wmcodecdspuuid
           FFmpeg::avcodec
           FFmpeg::avcodec
-          FFmpeg::avutil)
-
-source_group(
-  "libdshowcapture-external\\Source Files"
-  FILES libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp
-        libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp
-        libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
-        libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp)
-source_group(
-  "libdshowcapture\\Source Files"
-  FILES libdshowcapture/source/capture-filter.cpp
-        libdshowcapture/source/output-filter.cpp
-        libdshowcapture/source/dshowcapture.cpp
-        libdshowcapture/source/dshowencode.cpp
-        libdshowcapture/source/device.cpp
-        libdshowcapture/source/device-vendor.cpp
-        libdshowcapture/source/encoder.cpp
-        libdshowcapture/source/dshow-base.cpp
-        libdshowcapture/source/dshow-demux.cpp
-        libdshowcapture/source/dshow-enum.cpp
-        libdshowcapture/source/dshow-formats.cpp
-        libdshowcapture/source/dshow-media-type.cpp
-        libdshowcapture/source/dshow-encoded-device.cpp
-        libdshowcapture/source/log.cpp)
-source_group(
-  "libdshowcapture\\Header Files"
-  FILES libdshowcapture/dshowcapture.hpp
-        libdshowcapture/source/capture-filter.hpp
-        libdshowcapture/source/output-filter.hpp
-        libdshowcapture/source/device.hpp
-        libdshowcapture/source/encoder.hpp
-        libdshowcapture/source/dshow-base.hpp
-        libdshowcapture/source/dshow-demux.hpp
-        libdshowcapture/source/dshow-device-defs.hpp
-        libdshowcapture/source/dshow-enum.hpp
-        libdshowcapture/source/dshow-formats.hpp
-        libdshowcapture/source/dshow-media-type.hpp
-        libdshowcapture/source/log.hpp
-        libdshowcapture/source/external/IVideoCaptureFilter.h)
-
-set_target_properties(win-dshow PROPERTIES FOLDER "plugins/win-dshow")
-
-setup_plugin_target(win-dshow)
-
-if(ENABLE_VIRTUALCAM AND VIRTUALCAM_AVAILABLE)
-  target_sources(win-dshow PRIVATE tiny-nv12-scale.c tiny-nv12-scale.h shared-memory-queue.c shared-memory-queue.h
-                                   virtualcam.c)
+          FFmpeg::avutil
+          strmiids
+          winmm)
 
 
+if(TARGET OBS::virtualcam AND TARGET OBS::virtualcam-guid)
+  target_sources(win-dshow PRIVATE virtualcam.c)
+  target_link_libraries(win-dshow PRIVATE OBS::virtualcam-interface OBS::virtualcam-guid)
   target_compile_definitions(win-dshow PRIVATE VIRTUALCAM_AVAILABLE)
   target_compile_definitions(win-dshow PRIVATE VIRTUALCAM_AVAILABLE)
 
 
-  target_include_directories(win-dshow PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config)
-
-  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-guid.h.in ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h)
-
-  target_sources(win-dshow PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h)
-
-  configure_file(virtualcam-install.bat.in "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat")
-
-  configure_file(virtualcam-uninstall.bat.in "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat")
-
-  add_target_resource(win-dshow "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat" "obs-plugins/win-dshow/")
-  add_target_resource(win-dshow "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat" "obs-plugins/win-dshow/")
-
-  add_subdirectory(virtualcam-module)
+  add_dependencies(win-dshow obs-virtualcam-module)
 endif()
 endif()
+
+# cmake-format: off
+set_target_properties_obs(win-dshow PROPERTIES FOLDER plugins/win-dshow PREFIX "")
+# cmake-format: on

+ 216 - 0
plugins/win-dshow/cmake/legacy.cmake

@@ -0,0 +1,216 @@
+if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/dshowcapture.hpp")
+  obs_status(FATAL_ERROR "libdshowcapture submodule not found! Please fetch submodules. win-dshow plugin disabled.")
+  return()
+endif()
+
+option(ENABLE_VIRTUALCAM "Enable building with Virtual Camera (Windows)" ON)
+
+if(NOT ENABLE_VIRTUALCAM)
+  obs_status(DISABLED "Windows Virtual Camera")
+endif()
+
+if(ENABLE_VIRTUALCAM AND NOT VIRTUALCAM_GUID)
+  set(VIRTUALCAM_GUID
+      ""
+      CACHE STRING "Virtual Camera GUID" FORCE)
+  mark_as_advanced(VIRTUALCAM_GUID)
+endif()
+
+project(win-dshow)
+
+find_package(FFmpeg REQUIRED COMPONENTS avcodec avutil)
+
+add_library(win-dshow MODULE)
+add_library(OBS::dshow ALIAS win-dshow)
+
+target_sources(win-dshow PRIVATE encode-dstr.hpp win-dshow.cpp win-dshow-encoder.cpp dshow-plugin.cpp ffmpeg-decode.c
+                                 ffmpeg-decode.h)
+
+add_library(libdshowcapture-external INTERFACE)
+add_library(libdshowcapture INTERFACE)
+add_library(OBS::libdshowcapture-external ALIAS libdshowcapture-external)
+add_library(OBS::libdshowcapture ALIAS libdshowcapture)
+
+target_sources(
+  libdshowcapture-external
+  INTERFACE libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp
+            libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp
+            libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
+            libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp)
+
+target_sources(
+  libdshowcapture
+  INTERFACE libdshowcapture/dshowcapture.hpp
+            libdshowcapture/source/capture-filter.cpp
+            libdshowcapture/source/capture-filter.hpp
+            libdshowcapture/source/output-filter.cpp
+            libdshowcapture/source/output-filter.hpp
+            libdshowcapture/source/dshowcapture.cpp
+            libdshowcapture/source/dshowencode.cpp
+            libdshowcapture/source/device.cpp
+            libdshowcapture/source/device.hpp
+            libdshowcapture/source/device-vendor.cpp
+            libdshowcapture/source/encoder.cpp
+            libdshowcapture/source/encoder.hpp
+            libdshowcapture/source/dshow-base.cpp
+            libdshowcapture/source/dshow-base.hpp
+            libdshowcapture/source/dshow-demux.cpp
+            libdshowcapture/source/dshow-demux.hpp
+            libdshowcapture/source/dshow-device-defs.hpp
+            libdshowcapture/source/dshow-enum.cpp
+            libdshowcapture/source/dshow-enum.hpp
+            libdshowcapture/source/dshow-formats.cpp
+            libdshowcapture/source/dshow-formats.hpp
+            libdshowcapture/source/dshow-media-type.cpp
+            libdshowcapture/source/dshow-encoded-device.cpp
+            libdshowcapture/source/dshow-media-type.hpp
+            libdshowcapture/source/log.cpp
+            libdshowcapture/source/log.hpp
+            libdshowcapture/source/external/IVideoCaptureFilter.h)
+
+target_include_directories(
+  libdshowcapture INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture
+                            ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/external/capture-device-support/Library)
+
+target_compile_definitions(libdshowcapture-external INTERFACE _UP_WINDOWS=1)
+target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1)
+target_compile_options(libdshowcapture-external INTERFACE /wd4018)
+
+set(MODULE_DESCRIPTION "OBS DirectShow module")
+
+configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-dshow.rc)
+
+target_sources(win-dshow PRIVATE win-dshow.rc)
+
+target_compile_definitions(win-dshow PRIVATE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS
+                                             OBS_LEGACY)
+
+set(VIRTUALCAM_AVAILABLE OFF)
+if(ENABLE_VIRTUALCAM)
+  if(VIRTUALCAM_GUID STREQUAL "")
+    obs_status(WARNING "Windows Virtual Camera - GUID not set. Specify as 'VIRTUALCAM_GUID' to enable.")
+  else()
+    set(INVALID_GUID ON)
+
+    string(REPLACE "-" ";" GUID_VALS ${VIRTUALCAM_GUID})
+
+    list(LENGTH GUID_VALS GUID_VAL_COUNT)
+    if(GUID_VAL_COUNT EQUAL 5)
+      string(REPLACE ";" "0" GUID_HEX ${GUID_VALS})
+      string(REGEX MATCH "[0-9a-fA-F]+" GUID_ACTUAL_HEX ${GUID_HEX})
+      if(GUID_ACTUAL_HEX STREQUAL GUID_HEX)
+        list(GET GUID_VALS 0 GUID_VALS_DATA1)
+        list(GET GUID_VALS 1 GUID_VALS_DATA2)
+        list(GET GUID_VALS 2 GUID_VALS_DATA3)
+        list(GET GUID_VALS 3 GUID_VALS_DATA4)
+        list(GET GUID_VALS 4 GUID_VALS_DATA5)
+        string(LENGTH ${GUID_VALS_DATA1} GUID_VALS_DATA1_LENGTH)
+        string(LENGTH ${GUID_VALS_DATA2} GUID_VALS_DATA2_LENGTH)
+        string(LENGTH ${GUID_VALS_DATA3} GUID_VALS_DATA3_LENGTH)
+        string(LENGTH ${GUID_VALS_DATA4} GUID_VALS_DATA4_LENGTH)
+        string(LENGTH ${GUID_VALS_DATA5} GUID_VALS_DATA5_LENGTH)
+        if(GUID_VALS_DATA1_LENGTH EQUAL 8
+           AND GUID_VALS_DATA2_LENGTH EQUAL 4
+           AND GUID_VALS_DATA3_LENGTH EQUAL 4
+           AND GUID_VALS_DATA4_LENGTH EQUAL 4
+           AND GUID_VALS_DATA5_LENGTH EQUAL 12)
+          set(GUID_VAL01 ${GUID_VALS_DATA1})
+          set(GUID_VAL02 ${GUID_VALS_DATA2})
+          set(GUID_VAL03 ${GUID_VALS_DATA3})
+          string(SUBSTRING ${GUID_VALS_DATA4} 0 2 GUID_VAL04)
+          string(SUBSTRING ${GUID_VALS_DATA4} 2 2 GUID_VAL05)
+          string(SUBSTRING ${GUID_VALS_DATA5} 0 2 GUID_VAL06)
+          string(SUBSTRING ${GUID_VALS_DATA5} 2 2 GUID_VAL07)
+          string(SUBSTRING ${GUID_VALS_DATA5} 4 2 GUID_VAL08)
+          string(SUBSTRING ${GUID_VALS_DATA5} 6 2 GUID_VAL09)
+          string(SUBSTRING ${GUID_VALS_DATA5} 8 2 GUID_VAL10)
+          string(SUBSTRING ${GUID_VALS_DATA5} 10 2 GUID_VAL11)
+          set(VIRTUALCAM_AVAILABLE ON)
+          set(INVALID_GUID OFF)
+        endif()
+      endif()
+    endif()
+  endif()
+
+  if(INVALID_GUID)
+    obs_status(WARNING "Windows Virtual Camera - invalid GUID supplied")
+  endif()
+endif()
+
+target_link_libraries(
+  win-dshow
+  PRIVATE OBS::libobs
+          OBS::w32-pthreads
+          OBS::libdshowcapture-external
+          OBS::libdshowcapture
+          setupapi
+          strmiids
+          ksuser
+          winmm
+          wmcodecdspuuid
+          FFmpeg::avcodec
+          FFmpeg::avutil)
+
+source_group(
+  "libdshowcapture-external\\Source Files"
+  FILES libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp
+        libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp
+        libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
+        libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp)
+source_group(
+  "libdshowcapture\\Source Files"
+  FILES libdshowcapture/source/capture-filter.cpp
+        libdshowcapture/source/output-filter.cpp
+        libdshowcapture/source/dshowcapture.cpp
+        libdshowcapture/source/dshowencode.cpp
+        libdshowcapture/source/device.cpp
+        libdshowcapture/source/device-vendor.cpp
+        libdshowcapture/source/encoder.cpp
+        libdshowcapture/source/dshow-base.cpp
+        libdshowcapture/source/dshow-demux.cpp
+        libdshowcapture/source/dshow-enum.cpp
+        libdshowcapture/source/dshow-formats.cpp
+        libdshowcapture/source/dshow-media-type.cpp
+        libdshowcapture/source/dshow-encoded-device.cpp
+        libdshowcapture/source/log.cpp)
+source_group(
+  "libdshowcapture\\Header Files"
+  FILES libdshowcapture/dshowcapture.hpp
+        libdshowcapture/source/capture-filter.hpp
+        libdshowcapture/source/output-filter.hpp
+        libdshowcapture/source/device.hpp
+        libdshowcapture/source/encoder.hpp
+        libdshowcapture/source/dshow-base.hpp
+        libdshowcapture/source/dshow-demux.hpp
+        libdshowcapture/source/dshow-device-defs.hpp
+        libdshowcapture/source/dshow-enum.hpp
+        libdshowcapture/source/dshow-formats.hpp
+        libdshowcapture/source/dshow-media-type.hpp
+        libdshowcapture/source/log.hpp
+        libdshowcapture/source/external/IVideoCaptureFilter.h)
+
+set_target_properties(win-dshow PROPERTIES FOLDER "plugins/win-dshow")
+
+setup_plugin_target(win-dshow)
+
+if(ENABLE_VIRTUALCAM AND VIRTUALCAM_AVAILABLE)
+  target_sources(win-dshow PRIVATE tiny-nv12-scale.c tiny-nv12-scale.h shared-memory-queue.c shared-memory-queue.h
+                                   virtualcam.c)
+
+  target_compile_definitions(win-dshow PRIVATE VIRTUALCAM_AVAILABLE)
+
+  target_include_directories(win-dshow PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config)
+
+  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-guid.h.in ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h)
+
+  target_sources(win-dshow PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h)
+
+  configure_file(virtualcam-module/virtualcam-install.bat.in "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat")
+
+  configure_file(virtualcam-module/virtualcam-uninstall.bat.in "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat")
+
+  add_target_resource(win-dshow "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat" "obs-plugins/win-dshow/")
+  add_target_resource(win-dshow "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat" "obs-plugins/win-dshow/")
+
+  add_subdirectory(virtualcam-module)
+endif()

+ 56 - 0
plugins/win-dshow/cmake/libdshowcapture.cmake

@@ -0,0 +1,56 @@
+add_library(libdshowcapture INTERFACE)
+add_library(OBS::libdshowcapture ALIAS libdshowcapture)
+
+target_sources(
+  libdshowcapture
+  INTERFACE libdshowcapture/dshowcapture.hpp
+            libdshowcapture/source/capture-filter.cpp
+            libdshowcapture/source/capture-filter.hpp
+            libdshowcapture/source/device-vendor.cpp
+            libdshowcapture/source/device.cpp
+            libdshowcapture/source/device.hpp
+            libdshowcapture/source/dshow-base.cpp
+            libdshowcapture/source/dshow-base.hpp
+            libdshowcapture/source/dshow-demux.cpp
+            libdshowcapture/source/dshow-demux.hpp
+            libdshowcapture/source/dshow-device-defs.hpp
+            libdshowcapture/source/dshow-encoded-device.cpp
+            libdshowcapture/source/dshow-enum.cpp
+            libdshowcapture/source/dshow-enum.hpp
+            libdshowcapture/source/dshow-formats.cpp
+            libdshowcapture/source/dshow-formats.hpp
+            libdshowcapture/source/dshow-media-type.cpp
+            libdshowcapture/source/dshow-media-type.hpp
+            libdshowcapture/source/dshowcapture.cpp
+            libdshowcapture/source/dshowencode.cpp
+            libdshowcapture/source/encoder.cpp
+            libdshowcapture/source/encoder.hpp
+            libdshowcapture/source/external/IVideoCaptureFilter.h
+            libdshowcapture/source/log.cpp
+            libdshowcapture/source/log.hpp
+            libdshowcapture/source/output-filter.cpp
+            libdshowcapture/source/output-filter.hpp
+            libdshowcapture/external/capture-device-support/Library/EGAVResult.cpp
+            libdshowcapture/external/capture-device-support/Library/ElgatoUVCDevice.cpp
+            libdshowcapture/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
+            libdshowcapture/external/capture-device-support/SampleCode/DriverInterface.cpp)
+
+target_include_directories(
+  libdshowcapture INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture"
+                            "${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/external/capture-device-support/Library")
+
+target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1)
+target_compile_options(libdshowcapture INTERFACE /wd4018)
+
+get_target_property(target_sources libdshowcapture INTERFACE_SOURCES)
+set(target_headers ${target_sources})
+set(target_external_sources ${target_sources})
+
+list(FILTER target_external_sources INCLUDE REGEX ".+external/.+/.+\\.cpp")
+list(FILTER target_sources EXCLUDE REGEX ".+external/.+/.+\\.cpp")
+list(FILTER target_sources INCLUDE REGEX ".*\\.(m|c[cp]?p?|swift)")
+list(FILTER target_headers INCLUDE REGEX ".*\\.h(pp)?")
+
+source_group("libdshowcapture-external\\Source Files" FILES ${target_external_sources})
+source_group("libdshowcapture\\Source Files" FILES ${target_sources})
+source_group("libdshowcapture\\Header Files" FILES ${target_headers})

+ 24 - 0
plugins/win-dshow/cmake/windows/obs-module.rc.in

@@ -0,0 +1,24 @@
+1 VERSIONINFO
+FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName", "${OBS_COMPANY_NAME}"
+      VALUE "FileDescription", "OBS DirectShow module"
+      VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "ProductName", "${OBS_PRODUCT_NAME}"
+      VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "Comments", "${OBS_COMMENTS}"
+      VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
+      VALUE "InternalName", "win-dshow"
+      VALUE "OriginalFilename", "win-dshow"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04B0
+  END
+END

+ 89 - 51
plugins/win-dshow/virtualcam-module/CMakeLists.txt

@@ -1,59 +1,97 @@
-cmake_minimum_required(VERSION 3.5)
-project(obs-virtualcam-module)
-
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-  set(_output_suffix "64")
-else()
-  set(_output_suffix "32")
+cmake_minimum_required(VERSION 3.24...3.25)
+
+if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
+  option(ENABLE_VIRTUALCAM "Enable Windows Virtual Camera" ON)
+  if(NOT ENABLE_VIRTUALCAM)
+    target_disable_feature(obs-virtualcam-module "Virtual Camera Support")
+    target_disable(obs-virtualcam-module)
+    return()
+  endif()
+
+  if(NOT VIRTUALCAM_GUID)
+    # cmake-format: off
+    set(VIRTUALCAM_GUID "" CACHE STRING "Virtual Camera GUID" FORCE)
+    mark_as_advanced(VIRTUALCAM_GUID)
+    # cmake-format: on
+
+    message(WARNING "Empty Virtual Camera GUID set.")
+    target_disable_feature(obs-virtualcam-module "Virtual Camera Support (empty GUID)")
+    return()
+  else()
+    set(VALID_GUID FALSE)
+    check_uuid(${VIRTUALCAM_GUID} VALID_GUID)
+
+    if(NOT VALID_GUID)
+      message(WARNING "Invalid Virtual Camera GUID set.")
+      target_disable_feature(obs-virtualcam-module "Virtual Camera Support (invalid GUID)")
+      return()
+    endif()
+
+    # DirectShow API requires separate GUID tokens
+    string(REPLACE "-" ";" GUID_VALS ${VIRTUALCAM_GUID})
+    list(GET GUID_VALS 0 GUID_VALS_DATA1)
+    list(GET GUID_VALS 1 GUID_VALS_DATA2)
+    list(GET GUID_VALS 2 GUID_VALS_DATA3)
+    list(GET GUID_VALS 3 GUID_VALS_DATA4)
+    list(GET GUID_VALS 4 GUID_VALS_DATA5)
+    set(GUID_VAL01 ${GUID_VALS_DATA1})
+    set(GUID_VAL02 ${GUID_VALS_DATA2})
+    set(GUID_VAL03 ${GUID_VALS_DATA3})
+    string(SUBSTRING ${GUID_VALS_DATA4} 0 2 GUID_VAL04)
+    string(SUBSTRING ${GUID_VALS_DATA4} 2 2 GUID_VAL05)
+    string(SUBSTRING ${GUID_VALS_DATA5} 0 2 GUID_VAL06)
+    string(SUBSTRING ${GUID_VALS_DATA5} 2 2 GUID_VAL07)
+    string(SUBSTRING ${GUID_VALS_DATA5} 4 2 GUID_VAL08)
+    string(SUBSTRING ${GUID_VALS_DATA5} 6 2 GUID_VAL09)
+    string(SUBSTRING ${GUID_VALS_DATA5} 8 2 GUID_VAL10)
+    string(SUBSTRING ${GUID_VALS_DATA5} 10 2 GUID_VAL11)
+  endif()
+
+  add_library(obs-virtualcam-guid INTERFACE)
+  add_library(OBS::virtualcam-guid ALIAS obs-virtualcam-guid)
+
+  configure_file(virtualcam-guid.h.in virtualcam-guid.h)
+  target_sources(obs-virtualcam-guid INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-guid.h")
+  target_include_directories(obs-virtualcam-guid INTERFACE "${CMAKE_CURRENT_BINARY_DIR}")
+
+  add_library(_virtualcam INTERFACE)
+
+  configure_file(cmake/windows/obs-module.rc.in virtualcam-module.rc)
+  target_sources(_virtualcam INTERFACE placeholder.cpp sleepto.c sleepto.h virtualcam-filter.cpp virtualcam-filter.hpp
+                                       virtualcam-module.cpp)
+  target_include_directories(_virtualcam INTERFACE "${CMAKE_CURRENT_BINARY_DIR}")
+  target_compile_definitions(_virtualcam INTERFACE VIRTUALCAM_AVAILABLE)
+  target_compile_options(_virtualcam INTERFACE $<IF:$<CONFIG:Debug>,/MTd,/MT>)
+
+  target_link_libraries(
+    _virtualcam
+    INTERFACE OBS::virtualcam-interface
+              OBS::virtualcam-guid
+              OBS::libdshowcapture
+              OBS::winhandle
+              gdiplus
+              strmiids
+              winmm)
 endif()
 endif()
 
 
-add_library(obs-virtualcam-module MODULE)
-add_library(OBS::virtualcam-module ALIAS obs-virtualcam-module)
-
-target_sources(
-  obs-virtualcam-module
-  PRIVATE sleepto.c
-          sleepto.h
-          placeholder.cpp
-          virtualcam-module.cpp
-          virtualcam-filter.cpp
-          virtualcam-filter.hpp
-          virtualcam-module.rc
-          ../shared-memory-queue.c
-          ../shared-memory-queue.h
-          ../tiny-nv12-scale.c
-          ../tiny-nv12-scale.h)
-
-target_include_directories(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
-
-set(MODULE_DESCRIPTION "OBS Virtual Camera output module")
-
-configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in virtualcam-module.rc)
-
-target_sources(obs-virtualcam-module PRIVATE virtualcam-module.rc)
+legacy_check()
 
 
-target_link_libraries(obs-virtualcam-module PRIVATE OBS::libdshowcapture OBS::libdshowcapture-external setupapi winmm
-                                                    strmiids gdiplus)
-
-target_link_options(obs-virtualcam-module PRIVATE "LINKER:/ignore:4104")
-
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-module.def.in ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.def)
-
-target_sources(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.def)
-
-target_include_directories(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../config)
-
-target_compile_definitions(obs-virtualcam-module PRIVATE VIRTUALCAM_AVAILABLE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS
-                                                         _CRT_NONSTDC_NO_WARNINGS)
+add_library(obs-virtualcam-module MODULE)
+add_library(OBS::virtualcam ALIAS obs-virtualcam-module)
 
 
-if(MSVC)
-  target_compile_options(obs-virtualcam-module PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
-  add_target_resource(win-dshow "$<TARGET_PDB_FILE:obs-virtualcam-module>" "obs-plugins/win-dshow/" OPTIONAL)
+target_sources(obs-virtualcam-module PRIVATE cmake/windows/virtualcam-module64.def)
+target_link_libraries(obs-virtualcam-module PRIVATE _virtualcam)
 
 
-endif()
+configure_file(virtualcam-install.bat.in virtualcam-install.bat)
+target_add_resource(obs-virtualcam-module "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat"
+                    "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow")
 
 
-set_target_properties(obs-virtualcam-module PROPERTIES FOLDER "plugins/win-dshow")
+configure_file(virtualcam-uninstall.bat.in virtualcam-uninstall.bat)
+target_add_resource(obs-virtualcam-module "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-uninstall.bat"
+                    "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow")
 
 
-set_target_properties(obs-virtualcam-module PROPERTIES OUTPUT_NAME "obs-virtualcam-module${_output_suffix}")
+include(cmake/32bit.cmake)
 
 
-add_target_resource(win-dshow "$<TARGET_FILE:obs-virtualcam-module>" "obs-plugins/win-dshow/")
+# cmake-format: off
+set_target_properties_obs(obs-virtualcam-module PROPERTIES FOLDER plugins/win-dshow OUTPUT_NAME obs-virtualcam-module64)
+# cmake-format: on

+ 49 - 0
plugins/win-dshow/virtualcam-module/cmake/32bit-build.cmake

@@ -0,0 +1,49 @@
+option(ENABLE_VIRTUALCAM "Enable Windows Virtual Camera" ON)
+if(NOT ENABLE_VIRTUALCAM)
+  return()
+endif()
+
+if(NOT VIRTUALCAM_GUID)
+  set(VIRTUALCAM_GUID
+      ""
+      CACHE STRING "Virtual Camera GUID" FORCE)
+  mark_as_advanced(VIRTUALCAM_GUID)
+
+  message(WARNING "Empty Virtual Camera GUID set.")
+  return()
+else()
+  set(VALID_GUID FALSE)
+  check_uuid(${VIRTUALCAM_GUID} VALID_GUID)
+
+  if(NOT VALID_GUID)
+    message(WARNING "Invalid Virtual Camera GUID set.")
+    return()
+  endif()
+
+  # DirectShow API requires separate GUID tokens
+  string(REPLACE "-" ";" GUID_VALS ${VIRTUALCAM_GUID})
+  list(GET GUID_VALS 0 GUID_VALS_DATA1)
+  list(GET GUID_VALS 1 GUID_VALS_DATA2)
+  list(GET GUID_VALS 2 GUID_VALS_DATA3)
+  list(GET GUID_VALS 3 GUID_VALS_DATA4)
+  list(GET GUID_VALS 4 GUID_VALS_DATA5)
+  set(GUID_VAL01 ${GUID_VALS_DATA1})
+  set(GUID_VAL02 ${GUID_VALS_DATA2})
+  set(GUID_VAL03 ${GUID_VALS_DATA3})
+  string(SUBSTRING ${GUID_VALS_DATA4} 0 2 GUID_VAL04)
+  string(SUBSTRING ${GUID_VALS_DATA4} 2 2 GUID_VAL05)
+  string(SUBSTRING ${GUID_VALS_DATA5} 0 2 GUID_VAL06)
+  string(SUBSTRING ${GUID_VALS_DATA5} 2 2 GUID_VAL07)
+  string(SUBSTRING ${GUID_VALS_DATA5} 4 2 GUID_VAL08)
+  string(SUBSTRING ${GUID_VALS_DATA5} 6 2 GUID_VAL09)
+  string(SUBSTRING ${GUID_VALS_DATA5} 8 2 GUID_VAL10)
+  string(SUBSTRING ${GUID_VALS_DATA5} 10 2 GUID_VAL11)
+endif()
+
+add_library(obs-virtualcam-module MODULE)
+add_library(OBS::virtualcam ALIAS obs-virtualcam-module)
+
+target_sources(obs-virtualcam-module PRIVATE cmake/windows/virtualcam-module32.def)
+target_link_libraries(obs-virtualcam-module PRIVATE _virtualcam)
+
+set_property(TARGET obs-virtualcam-module PROPERTY OUTPUT_NAME obs-virtualcam-module32)

+ 5 - 0
plugins/win-dshow/virtualcam-module/cmake/32bit.cmake

@@ -0,0 +1,5 @@
+add_custom_command(
+  TARGET obs-virtualcam-module
+  POST_BUILD
+  COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $<CONFIG> -t obs-virtualcam-module
+  COMMENT "Build 32-bit obs-virtualcam")

+ 60 - 0
plugins/win-dshow/virtualcam-module/cmake/legacy.cmake

@@ -0,0 +1,60 @@
+cmake_minimum_required(VERSION 3.5)
+project(obs-virtualcam-module)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  set(_output_suffix "64")
+else()
+  set(_output_suffix "32")
+endif()
+
+add_library(obs-virtualcam-module MODULE)
+add_library(OBS::virtualcam-module ALIAS obs-virtualcam-module)
+
+target_sources(
+  obs-virtualcam-module
+  PRIVATE sleepto.c
+          sleepto.h
+          placeholder.cpp
+          virtualcam-module.cpp
+          virtualcam-filter.cpp
+          virtualcam-filter.hpp
+          virtualcam-module.rc
+          ../shared-memory-queue.c
+          ../shared-memory-queue.h
+          ../tiny-nv12-scale.c
+          ../tiny-nv12-scale.h)
+
+target_include_directories(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+set(MODULE_DESCRIPTION "OBS Virtual Camera output module")
+
+configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in virtualcam-module.rc)
+
+target_sources(obs-virtualcam-module PRIVATE virtualcam-module.rc)
+
+target_link_libraries(obs-virtualcam-module PRIVATE OBS::libdshowcapture OBS::libdshowcapture-external setupapi winmm
+                                                    strmiids gdiplus)
+
+target_link_options(obs-virtualcam-module PRIVATE "LINKER:/ignore:4104")
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-module.def.in ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.def)
+
+target_sources(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.def)
+
+target_include_directories(obs-virtualcam-module PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../config
+                                                         ${CMAKE_SOURCE_DIR}/libobs)
+
+target_compile_definitions(obs-virtualcam-module PRIVATE VIRTUALCAM_AVAILABLE UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS
+                                                         _CRT_NONSTDC_NO_WARNINGS OBS_LEGACY)
+
+if(MSVC)
+  target_compile_options(obs-virtualcam-module PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
+  add_target_resource(win-dshow "$<TARGET_PDB_FILE:obs-virtualcam-module>" "obs-plugins/win-dshow/" OPTIONAL)
+
+endif()
+
+set_target_properties(obs-virtualcam-module PROPERTIES FOLDER "plugins/win-dshow")
+
+set_target_properties(obs-virtualcam-module PROPERTIES OUTPUT_NAME "obs-virtualcam-module${_output_suffix}")
+
+add_target_resource(win-dshow "$<TARGET_FILE:obs-virtualcam-module>" "obs-plugins/win-dshow/")

+ 24 - 0
plugins/win-dshow/virtualcam-module/cmake/windows/obs-module.rc.in

@@ -0,0 +1,24 @@
+1 VERSIONINFO
+FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName", "${OBS_COMPANY_NAME}"
+      VALUE "FileDescription", "OBS Virtual Camera output module"
+      VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "ProductName", "${OBS_PRODUCT_NAME}"
+      VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "Comments", "${OBS_COMMENTS}"
+      VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
+      VALUE "InternalName", "${PROJECT_NAME}"
+      VALUE "OriginalFilename", "${PROJECT_NAME}"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04B0
+  END
+END

+ 8 - 0
plugins/win-dshow/virtualcam-module/cmake/windows/virtualcam-module32.def

@@ -0,0 +1,8 @@
+LIBRARY     obs-virtualcam-module32.dll
+EXPORTS
+            DllMain                 PRIVATE
+            DllGetClassObject       PRIVATE
+            DllCanUnloadNow         PRIVATE
+            DllRegisterServer       PRIVATE
+            DllUnregisterServer     PRIVATE
+            DllInstall              PRIVATE

+ 8 - 0
plugins/win-dshow/virtualcam-module/cmake/windows/virtualcam-module64.def

@@ -0,0 +1,8 @@
+LIBRARY     obs-virtualcam-module64.dll
+EXPORTS
+            DllMain                 PRIVATE
+            DllGetClassObject       PRIVATE
+            DllCanUnloadNow         PRIVATE
+            DllRegisterServer       PRIVATE
+            DllUnregisterServer     PRIVATE
+            DllInstall              PRIVATE

+ 10 - 0
plugins/win-dshow/virtualcam-module/virtualcam-filter.hpp

@@ -3,12 +3,22 @@
 #include <windows.h>
 #include <windows.h>
 #include <cstdint>
 #include <cstdint>
 #include <thread>
 #include <thread>
+
+#ifdef OBS_LEGACY
 #include "../shared-memory-queue.h"
 #include "../shared-memory-queue.h"
 #include "../tiny-nv12-scale.h"
 #include "../tiny-nv12-scale.h"
 #include "../libdshowcapture/source/output-filter.hpp"
 #include "../libdshowcapture/source/output-filter.hpp"
 #include "../libdshowcapture/source/dshow-formats.hpp"
 #include "../libdshowcapture/source/dshow-formats.hpp"
 #include "../../../libobs/util/windows/WinHandle.hpp"
 #include "../../../libobs/util/windows/WinHandle.hpp"
 #include "../../../libobs/util/threading-windows.h"
 #include "../../../libobs/util/threading-windows.h"
+#else
+#include <shared-memory-queue.h>
+#include <tiny-nv12-scale.h>
+#include <libdshowcapture/source/output-filter.hpp>
+#include <libdshowcapture/source/dshow-formats.hpp>
+#include <util/windows/WinHandle.hpp>
+#include <util/threading-windows.h>
+#endif
 
 
 typedef struct {
 typedef struct {
 	int cx;
 	int cx;

+ 0 - 0
plugins/win-dshow/virtualcam-guid.h.in → plugins/win-dshow/virtualcam-module/virtualcam-guid.h.in


+ 0 - 0
plugins/win-dshow/virtualcam-install.bat.in → plugins/win-dshow/virtualcam-module/virtualcam-install.bat.in


+ 0 - 0
plugins/win-dshow/virtualcam-uninstall.bat.in → plugins/win-dshow/virtualcam-module/virtualcam-uninstall.bat.in


+ 8 - 9
plugins/win-wasapi/CMakeLists.txt

@@ -1,18 +1,17 @@
-project(win-wasapi)
+cmake_minimum_required(VERSION 3.24...3.25)
+
+legacy_check()
 
 
 add_library(win-wasapi MODULE)
 add_library(win-wasapi MODULE)
 add_library(OBS::wasapi ALIAS win-wasapi)
 add_library(OBS::wasapi ALIAS win-wasapi)
 
 
-target_sources(win-wasapi PRIVATE win-wasapi.cpp enum-wasapi.cpp enum-wasapi.hpp plugin-main.cpp)
-
-set(MODULE_DESCRIPTION "OBS WASAPI module")
-
-configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-wasapi.rc)
+target_sources(win-wasapi PRIVATE enum-wasapi.cpp enum-wasapi.hpp plugin-main.cpp win-wasapi.cpp)
 
 
+configure_file(cmake/windows/obs-module.rc.in win-wasapi.rc)
 target_sources(win-wasapi PRIVATE win-wasapi.rc)
 target_sources(win-wasapi PRIVATE win-wasapi.rc)
 
 
 target_link_libraries(win-wasapi PRIVATE OBS::libobs Avrt)
 target_link_libraries(win-wasapi PRIVATE OBS::libobs Avrt)
 
 
-set_target_properties(win-wasapi PROPERTIES FOLDER "plugins")
-
-setup_plugin_target(win-wasapi)
+# cmake-format: off
+set_target_properties_obs(win-wasapi PROPERTIES FOLDER plugins PREFIX "")
+# cmake-format: on

+ 18 - 0
plugins/win-wasapi/cmake/legacy.cmake

@@ -0,0 +1,18 @@
+project(win-wasapi)
+
+add_library(win-wasapi MODULE)
+add_library(OBS::wasapi ALIAS win-wasapi)
+
+target_sources(win-wasapi PRIVATE win-wasapi.cpp enum-wasapi.cpp enum-wasapi.hpp plugin-main.cpp)
+
+set(MODULE_DESCRIPTION "OBS WASAPI module")
+
+configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-wasapi.rc)
+
+target_sources(win-wasapi PRIVATE win-wasapi.rc)
+
+target_link_libraries(win-wasapi PRIVATE OBS::libobs Avrt)
+
+set_target_properties(win-wasapi PROPERTIES FOLDER "plugins")
+
+setup_plugin_target(win-wasapi)

+ 24 - 0
plugins/win-wasapi/cmake/windows/obs-module.rc.in

@@ -0,0 +1,24 @@
+1 VERSIONINFO
+FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName", "${OBS_COMPANY_NAME}"
+      VALUE "FileDescription", "OBS WASAPI module"
+      VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "ProductName", "${OBS_PRODUCT_NAME}"
+      VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
+      VALUE "Comments", "${OBS_COMMENTS}"
+      VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
+      VALUE "InternalName", "win-wasapi"
+      VALUE "OriginalFilename", "win-wasapi"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04B0
+  END
+END