Browse Source

cmake: Update cross-platform build project management for Windows

Enables creation of x64 and x86 child projects when building on ARM64
and decouples functionality from legacy_check function
PatTheMav 1 year ago
parent
commit
d81fcd70e0
33 changed files with 602 additions and 457 deletions
  1. 1 1
      .gitmodules
  2. 5 3
      CMakeLists.txt
  3. 2 2
      build-aux/.run-format.zsh
  4. 0 63
      cmake/32bit/projects.cmake
  5. 3 0
      cmake/common/buildspec_common.cmake
  6. 1 1
      cmake/common/helpers_common.cmake
  7. 97 0
      cmake/windows/architecture.cmake
  8. 1 1
      cmake/windows/buildspec.cmake
  9. 1 1
      cmake/windows/defaults.cmake
  10. 27 6
      cmake/windows/helpers.cmake
  11. 43 0
      deps/libdshowcapture/CMakeLists.txt
  12. 0 0
      deps/libdshowcapture/src
  13. 0 16
      libobs/cmake/32bit-build.cmake
  14. 28 17
      libobs/cmake/os-windows.cmake
  15. 6 15
      plugins/win-capture/CMakeLists.txt
  16. 37 12
      plugins/win-capture/get-graphics-offsets/CMakeLists.txt
  17. 0 9
      plugins/win-capture/get-graphics-offsets/cmake/32bit-build.cmake
  18. 0 6
      plugins/win-capture/get-graphics-offsets/cmake/32bit.cmake
  19. 44 20
      plugins/win-capture/graphics-hook/CMakeLists.txt
  20. 0 13
      plugins/win-capture/graphics-hook/cmake/32bit-build.cmake
  21. 0 6
      plugins/win-capture/graphics-hook/cmake/32bit.cmake
  22. 1 1
      plugins/win-capture/graphics-hook/graphics-hook.rc
  23. 30 9
      plugins/win-capture/inject-helper/CMakeLists.txt
  24. 0 9
      plugins/win-capture/inject-helper/cmake/32bit-build.cmake
  25. 0 6
      plugins/win-capture/inject-helper/cmake/32bit.cmake
  26. 29 15
      plugins/win-dshow/CMakeLists.txt
  27. 114 91
      plugins/win-dshow/cmake/legacy.cmake
  28. 120 75
      plugins/win-dshow/virtualcam-module/CMakeLists.txt
  29. 0 49
      plugins/win-dshow/virtualcam-module/cmake/32bit-build.cmake
  30. 0 6
      plugins/win-dshow/virtualcam-module/cmake/32bit.cmake
  31. 4 4
      plugins/win-dshow/virtualcam-module/virtualcam-filter.hpp
  32. 4 0
      plugins/win-dshow/win-dshow-encoder.cpp
  33. 4 0
      plugins/win-dshow/win-dshow.cpp

+ 1 - 1
.gitmodules

@@ -1,5 +1,5 @@
 [submodule "plugins/win-dshow/libdshowcapture"]
-	path = plugins/win-dshow/libdshowcapture
+	path = deps/libdshowcapture/src
 	url = https://github.com/obsproject/libdshowcapture.git
 [submodule "plugins/obs-browser"]
 	path = plugins/obs-browser

+ 5 - 3
CMakeLists.txt

@@ -5,9 +5,11 @@ if(CMAKE_HOST_SYSTEM_NAME MATCHES "(Darwin)" OR OBS_CMAKE_VERSION VERSION_GREATE
 
   project(obs-studio VERSION ${OBS_VERSION_CANONICAL})
 
-  if(CMAKE_HOST_SYSTEM_NAME MATCHES "(Windows)" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
-    include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/32bit/projects.cmake")
-    return()
+  if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+    include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/architecture.cmake")
+    if(NOT OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_GENERATOR_PLATFORM)
+      return()
+    endif()
   endif()
 
   include(compilerconfig)

+ 2 - 2
build-aux/.run-format.zsh

@@ -56,7 +56,7 @@ invoke_formatter() {
 
       if (( ! #source_files )) source_files=((libobs|libobs-*|UI|plugins|deps|shared)/**/*.(c|cpp|h|hpp|m|mm)(.N))
 
-      source_files=(${source_files:#*/(obs-websocket/deps|decklink/*/decklink-sdk|mac-syphon/syphon-framework|win-dshow/libdshowcapture)/*})
+      source_files=(${source_files:#*/(obs-websocket/deps|decklink/*/decklink-sdk|mac-syphon/syphon-framework|libdshowcapture)/*})
 
       local -a format_args=(-style=file -fallback-style=none)
       if (( _loglevel > 2 )) format_args+=(--verbose)
@@ -104,7 +104,7 @@ invoke_formatter() {
 
       if (( ! #source_files )) source_files=(CMakeLists.txt (libobs|libobs-*|UI|plugins|deps|shared|cmake|test)/**/(CMakeLists.txt|*.cmake)(.N))
 
-      source_files=(${source_files:#*/(jansson|decklink/*/decklink-sdk|obs-websocket|obs-browser|win-dshow/libdshowcapture)/*})
+      source_files=(${source_files:#*/(jansson|decklink/*/decklink-sdk|obs-websocket|obs-browser|libdshowcapture)/*})
       source_files=(${source_files:#(cmake/Modules/*|*/legacy.cmake)})
 
       check_files() {

+ 0 - 63
cmake/32bit/projects.cmake

@@ -1,63 +0,0 @@
-# OBS CMake 32-bit slice module
-
-include_guard(GLOBAL)
-
-include(compilerconfig)
-
-# legacy_check: Helper macro to automatically include available 32-bit build script
-macro(legacy_check)
-  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/32bit-build.cmake")
-    include(cmake/32bit-build.cmake)
-  endif()
-  return()
-endmacro()
-
-# target_disable_feature: Stub macro for 32-bit projects
-macro(target_disable_feature)
-endmacro()
-
-# target_disable: Stub macro for 32-bit projects
-macro(target_disable)
-endmacro()
-
-# check_uuid: Helper function to check for valid UUID
-function(check_uuid uuid_string return_value)
-  set(valid_uuid TRUE)
-  # gersemi: off
-  set(uuid_token_lengths 8 4 4 4 12)
-  # gersemi: on
-  set(token_num 0)
-
-  string(REPLACE "-" ";" uuid_tokens ${uuid_string})
-  list(LENGTH uuid_tokens uuid_num_tokens)
-
-  if(uuid_num_tokens EQUAL 5)
-    message(DEBUG "UUID ${uuid_string} is valid with 5 tokens.")
-    foreach(uuid_token IN LISTS uuid_tokens)
-      list(GET uuid_token_lengths ${token_num} uuid_target_length)
-      string(LENGTH "${uuid_token}" uuid_actual_length)
-      if(uuid_actual_length EQUAL uuid_target_length)
-        string(REGEX MATCH "[0-9a-fA-F]+" uuid_hex_match ${uuid_token})
-        if(NOT uuid_hex_match STREQUAL uuid_token)
-          set(valid_uuid FALSE)
-          break()
-        endif()
-      else()
-        set(valid_uuid FALSE)
-        break()
-      endif()
-      math(EXPR token_num "${token_num}+1")
-    endforeach()
-  else()
-    set(valid_uuid FALSE)
-  endif()
-  message(DEBUG "UUID ${uuid_string} valid: ${valid_uuid}")
-  set(${return_value} ${valid_uuid} PARENT_SCOPE)
-endfunction()
-
-if(OS_WINDOWS)
-  include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/buildspec.cmake")
-  add_subdirectory(libobs)
-  add_subdirectory(plugins/win-capture)
-  add_subdirectory(plugins/win-dshow)
-endif()

+ 3 - 0
cmake/common/buildspec_common.cmake

@@ -51,6 +51,9 @@ function(_check_dependencies)
   string(JSON dependency_data GET ${buildspec} dependencies)
 
   foreach(dependency IN LISTS dependencies_list)
+    if(dependency STREQUAL cef AND NOT ENABLE_BROWSER)
+      continue()
+    endif()
     if(dependency STREQUAL cef AND arch STREQUAL universal)
       if(CMAKE_OSX_ARCHITECTURES MATCHES ".+;.+")
         continue()

+ 1 - 1
cmake/common/helpers_common.cmake

@@ -138,7 +138,7 @@ function(_handle_generator_expression_dependency library)
     if(TARGET ${gen_target})
       set(${var_FOUND_VAR} "${gen_target}")
     endif()
-  elseif(library MATCHES "\\$<.*Qt6::EntryPointPrivate>" OR library MATCHES "\\$<.*Qt6::QDarwin.+PermissionPlugin>")
+  elseif(library MATCHES "\\$<.*Qt6::(EntryPointPrivate|QDarwin.*PermissionPlugin)>")
     set(${var_FOUND_VAR} "${var_FOUND_VAR}-SKIP")
   else()
     # Unknown or unimplemented generator expression found. Abort script run to either add to ignore list or implement

+ 97 - 0
cmake/windows/architecture.cmake

@@ -0,0 +1,97 @@
+# OBS CMake Windows Architecture Helper
+
+include_guard(GLOBAL)
+
+include(compilerconfig)
+
+if(NOT DEFINED OBS_PARENT_ARCHITECTURE)
+  if(CMAKE_GENERATOR_PLATFORM MATCHES "(Win32|x64)")
+    set(OBS_PARENT_ARCHITECTURE ${CMAKE_GENERATOR_PLATFORM})
+  else()
+    message(FATAL_ERROR "Unsupported generator platform for Windows builds: ${CMAKE_GENERATOR_PLATFORM}!")
+  endif()
+endif()
+
+if(OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_GENERATOR_PLATFORM)
+  if(OBS_PARENT_ARCHITECTURE STREQUAL x64)
+    execute_process(
+      COMMAND
+        "${CMAKE_COMMAND}" -S ${CMAKE_CURRENT_SOURCE_DIR} -B ${CMAKE_SOURCE_DIR}/build_x86 -A Win32 -G
+        "${CMAKE_GENERATOR}" -DCMAKE_SYSTEM_VERSION:STRING='${CMAKE_SYSTEM_VERSION}' -DOBS_CMAKE_VERSION:STRING=3.0.0
+        -DVIRTUALCAM_GUID:STRING=${VIRTUALCAM_GUID} -DCMAKE_MESSAGE_LOG_LEVEL:STRING=${CMAKE_MESSAGE_LOG_LEVEL}
+        -DENABLE_CCACHE:BOOL=${ENABLE_CCACHE} -DOBS_PARENT_ARCHITECTURE:STRING=x64
+      RESULT_VARIABLE _process_result
+      COMMAND_ERROR_IS_FATAL ANY
+    )
+  endif()
+else()
+  # legacy_check: Stub macro for child architecture builds
+  macro(legacy_check)
+  endmacro()
+
+  # target_disable_feature: Stub macro for child architecture builds
+  macro(target_disable_feature)
+  endmacro()
+
+  # target_disable: Stub macro for child architecture builds
+  macro(target_disable)
+  endmacro()
+
+  # target_add_resource: Stub macro for child architecture builds
+  macro(target_add_resource)
+  endmacro()
+
+  # target_export: Stub macro for child architecture builds
+  macro(target_export)
+  endmacro()
+
+  # set_target_properties_obs: Stub macro for child architecture builds
+  macro(set_target_properties_obs)
+    set_target_properties(${ARGV})
+  endmacro()
+
+  # check_uuid: Helper function to check for valid UUID
+  function(check_uuid uuid_string return_value)
+    set(valid_uuid TRUE)
+    # gersemi: off
+    set(uuid_token_lengths 8 4 4 4 12)
+    # gersemi: on
+    set(token_num 0)
+
+    string(REPLACE "-" ";" uuid_tokens ${uuid_string})
+    list(LENGTH uuid_tokens uuid_num_tokens)
+
+    if(uuid_num_tokens EQUAL 5)
+      message(DEBUG "UUID ${uuid_string} is valid with 5 tokens.")
+      foreach(uuid_token IN LISTS uuid_tokens)
+        list(GET uuid_token_lengths ${token_num} uuid_target_length)
+        string(LENGTH "${uuid_token}" uuid_actual_length)
+        if(uuid_actual_length EQUAL uuid_target_length)
+          string(REGEX MATCH "[0-9a-fA-F]+" uuid_hex_match ${uuid_token})
+          if(NOT uuid_hex_match STREQUAL uuid_token)
+            set(valid_uuid FALSE)
+            break()
+          endif()
+        else()
+          set(valid_uuid FALSE)
+          break()
+        endif()
+        math(EXPR token_num "${token_num}+1")
+      endforeach()
+    else()
+      set(valid_uuid FALSE)
+    endif()
+    message(DEBUG "UUID ${uuid_string} valid: ${valid_uuid}")
+    set(${return_value} ${valid_uuid} PARENT_SCOPE)
+  endfunction()
+
+  include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/buildspec.cmake")
+
+  add_subdirectory(libobs)
+  add_subdirectory(plugins/win-capture/get-graphics-offsets)
+  add_subdirectory(plugins/win-capture/graphics-hook)
+  add_subdirectory(plugins/win-capture/inject-helper)
+  add_subdirectory(plugins/win-dshow/virtualcam-module)
+
+  return()
+endif()

+ 1 - 1
cmake/windows/buildspec.cmake

@@ -18,7 +18,7 @@ function(_check_dependencies_windows)
     set(arch x86)
     set(dependencies_list prebuilt)
   else()
-    set(arch ${CMAKE_GENERATOR_PLATFORM})
+    string(TOLOWER "${CMAKE_GENERATOR_PLATFORM}" arch)
     set(dependencies_list prebuilt qt6 cef)
   endif()
   set(platform windows-${arch})

+ 1 - 1
cmake/windows/defaults.cmake

@@ -24,7 +24,7 @@ set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
 include(buildspec)
 include(cpackconfig)
 
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
   execute_process(
     COMMAND
       "${CMAKE_COMMAND}" -S ${CMAKE_CURRENT_SOURCE_DIR} -B ${CMAKE_SOURCE_DIR}/build_x86 -A Win32 -G

+ 27 - 6
cmake/windows/helpers.cmake

@@ -26,7 +26,7 @@ function(set_target_properties_obs target)
     elseif(target STREQUAL inject-helper OR target STREQUAL get-graphics-offsets)
       set(OBS_EXECUTABLE_DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/win-capture")
 
-      _target_install_obs(${target} DESTINATION ${OBS_EXECUTABLE_DESTINATION} 32BIT)
+      _target_install_obs(${target} DESTINATION ${OBS_EXECUTABLE_DESTINATION} x86)
     endif()
 
     _target_install_obs(${target} DESTINATION ${OBS_EXECUTABLE_DESTINATION})
@@ -66,11 +66,11 @@ function(set_target_properties_obs target)
       target_add_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan64.json" "${target_destination}")
       target_add_resource(graphics-hook "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan32.json" "${target_destination}")
 
-      _target_install_obs(${target} DESTINATION ${target_destination} 32BIT)
+      _target_install_obs(${target} DESTINATION ${target_destination} x86)
     elseif(target STREQUAL obs-virtualcam-module)
       set(target_destination "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow")
 
-      _target_install_obs(${target} DESTINATION ${target_destination} 32BIT)
+      _target_install_obs(${target} DESTINATION ${target_destination} x86)
     else()
       set(target_destination "${OBS_PLUGIN_DESTINATION}")
     endif()
@@ -171,12 +171,12 @@ endfunction()
 
 # _target_install_obs: Helper function to install build artifacts to rundir and install location
 function(_target_install_obs target)
-  set(options "32BIT")
+  set(options "x86" "x64")
   set(oneValueArgs "DESTINATION" "LIBRARY_DESTINATION" "HEADER_DESTINATION")
   set(multiValueArgs "")
   cmake_parse_arguments(PARSE_ARGV 0 _TIO "${options}" "${oneValueArgs}" "${multiValueArgs}")
 
-  if(_TIO_32BIT)
+  if(_TIO_x86)
     get_target_property(target_type ${target} TYPE)
     if(target_type STREQUAL EXECUTABLE)
       set(suffix exe)
@@ -189,7 +189,7 @@ function(_target_install_obs target)
     set(32bit_project_path "${OBS_SOURCE_DIR}/build_x86/${project_path}")
     set(target_file "${32bit_project_path}/$<CONFIG>/${target}32.${suffix}")
     set(target_pdb_file "${32bit_project_path}/$<CONFIG>/${target}32.pdb")
-    set(comment "Copy ${target} (32-bit) to destination")
+    set(comment "Copy ${target} (x86) to destination")
 
     install(
       FILES "${32bit_project_path}/$<CONFIG>/${target}32.${suffix}"
@@ -197,6 +197,27 @@ function(_target_install_obs target)
       COMPONENT Runtime
       OPTIONAL
     )
+  elseif(_TIO_x64)
+    get_target_property(target_type ${target} TYPE)
+    if(target_type STREQUAL EXECUTABLE)
+      set(suffix exe)
+    else()
+      set(suffix dll)
+    endif()
+
+    cmake_path(RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR BASE_DIRECTORY "${OBS_SOURCE_DIR}" OUTPUT_VARIABLE project_path)
+
+    set(32bit_project_path "${OBS_SOURCE_DIR}/build_x64/${project_path}")
+    set(target_file "${32bit_project_path}/$<CONFIG>/${target}64.${suffix}")
+    set(target_pdb_file "${32bit_project_path}/$<CONFIG>/${target}64.pdb")
+    set(comment "Copy ${target} (x64) to destination")
+
+    install(
+      FILES "${32bit_project_path}/$<CONFIG>/${target}64.${suffix}"
+      DESTINATION "${_TIO_DESTINATION}"
+      COMPONENT Runtime
+      OPTIONAL
+    )
   else()
     set(target_file "$<TARGET_FILE:${target}>")
     set(target_pdb_file "$<TARGET_PDB_FILE:${target}>")

+ 43 - 0
deps/libdshowcapture/CMakeLists.txt

@@ -0,0 +1,43 @@
+add_library(libdshowcapture INTERFACE)
+add_library(OBS::libdshowcapture ALIAS libdshowcapture)
+
+target_sources(
+  libdshowcapture
+  INTERFACE src/dshowcapture.hpp
+            src/source/capture-filter.cpp
+            src/source/capture-filter.hpp
+            src/source/device-vendor.cpp
+            src/source/device.cpp
+            src/source/device.hpp
+            src/source/dshow-base.cpp
+            src/source/dshow-base.hpp
+            src/source/dshow-demux.cpp
+            src/source/dshow-demux.hpp
+            src/source/dshow-device-defs.hpp
+            src/source/dshow-encoded-device.cpp
+            src/source/dshow-enum.cpp
+            src/source/dshow-enum.hpp
+            src/source/dshow-formats.cpp
+            src/source/dshow-formats.hpp
+            src/source/dshow-media-type.cpp
+            src/source/dshow-media-type.hpp
+            src/source/dshowcapture.cpp
+            src/source/dshowencode.cpp
+            src/source/encoder.cpp
+            src/source/encoder.hpp
+            src/source/external/IVideoCaptureFilter.h
+            src/source/log.cpp
+            src/source/log.hpp
+            src/source/output-filter.cpp
+            src/source/output-filter.hpp
+            src/external/capture-device-support/Library/EGAVResult.cpp
+            src/external/capture-device-support/Library/ElgatoUVCDevice.cpp
+            src/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
+            src/external/capture-device-support/SampleCode/DriverInterface.cpp)
+
+target_include_directories(
+  libdshowcapture INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/src"
+                            "${CMAKE_CURRENT_SOURCE_DIR}/src/external/capture-device-support/Library")
+
+target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1)
+target_compile_options(libdshowcapture INTERFACE /wd4018)

+ 0 - 0
plugins/win-dshow/libdshowcapture → deps/libdshowcapture/src


+ 0 - 16
libobs/cmake/32bit-build.cmake

@@ -1,16 +0,0 @@
-if(OS_WINDOWS)
-  add_library(obs-obfuscate INTERFACE)
-  add_library(OBS::obfuscate ALIAS obs-obfuscate)
-  target_sources(obs-obfuscate INTERFACE util/windows/obfuscate.c util/windows/obfuscate.h)
-  target_include_directories(obs-obfuscate INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
-
-  add_library(obs-comutils INTERFACE)
-  add_library(OBS::COMutils ALIAS obs-comutils)
-  target_sources(obs-comutils INTERFACE util/windows/ComPtr.hpp)
-  target_include_directories(obs-comutils INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
-
-  add_library(obs-winhandle INTERFACE)
-  add_library(OBS::winhandle ALIAS obs-winhandle)
-  target_sources(obs-winhandle INTERFACE util/windows/WinHandle.hpp)
-  target_include_directories(obs-winhandle INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
-endif()

+ 28 - 17
libobs/cmake/os-windows.cmake

@@ -1,23 +1,36 @@
-if(NOT TARGET OBS::w32-pthreads)
-  add_subdirectory("${CMAKE_SOURCE_DIR}/deps/w32-pthreads" "${CMAKE_BINARY_DIR}/deps/w32-pthreads")
+if(NOT TARGET OBS::obfuscate)
+  add_library(obs-obfuscate INTERFACE)
+  add_library(OBS::obfuscate ALIAS obs-obfuscate)
+  target_sources(obs-obfuscate INTERFACE util/windows/obfuscate.c util/windows/obfuscate.h)
+  target_include_directories(obs-obfuscate INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
 endif()
 
-configure_file(cmake/windows/obs-module.rc.in libobs.rc)
+if(NOT TARGET OBS::comutils)
+  add_library(obs-comutils INTERFACE)
+  add_library(OBS::COMutils ALIAS obs-comutils)
+  target_sources(obs-comutils INTERFACE util/windows/ComPtr.hpp)
+  target_include_directories(obs-comutils INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+endif()
 
-add_library(obs-obfuscate INTERFACE)
-add_library(OBS::obfuscate ALIAS obs-obfuscate)
-target_sources(obs-obfuscate INTERFACE util/windows/obfuscate.c util/windows/obfuscate.h)
-target_include_directories(obs-obfuscate INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+if(NOT TARGET OBS::winhandle)
+  add_library(obs-winhandle INTERFACE)
+  add_library(OBS::winhandle ALIAS obs-winhandle)
+  target_sources(obs-winhandle INTERFACE util/windows/WinHandle.hpp)
+  target_include_directories(obs-winhandle INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+endif()
 
-add_library(obs-comutils INTERFACE)
-add_library(OBS::COMutils ALIAS obs-comutils)
-target_sources(obs-comutils INTERFACE util/windows/ComPtr.hpp)
-target_include_directories(obs-comutils INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+if(NOT TARGET OBS::threading-windows)
+  add_library(obs-threading-windows INTERFACE)
+  add_library(OBS::threading-windows ALIAS obs-threading-windows)
+  target_sources(obs-threading-windows INTERFACE util/threading-windows.h)
+  target_include_directories(obs-threading-windows INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+endif()
 
-add_library(obs-winhandle INTERFACE)
-add_library(OBS::winhandle ALIAS obs-winhandle)
-target_sources(obs-winhandle INTERFACE util/windows/WinHandle.hpp)
-target_include_directories(obs-winhandle INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
+if(NOT TARGET OBS::w32-pthreads)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/deps/w32-pthreads" "${CMAKE_BINARY_DIR}/deps/w32-pthreads")
+endif()
+
+configure_file(cmake/windows/obs-module.rc.in libobs.rc)
 
 target_sources(
   libobs
@@ -37,8 +50,6 @@ target_sources(
     util/windows/device-enum.c
     util/windows/device-enum.h
     util/windows/HRError.hpp
-    util/windows/obfuscate.c
-    util/windows/obfuscate.h
     util/windows/win-registry.h
     util/windows/win-version.h
     util/windows/window-helpers.c

+ 6 - 15
plugins/win-capture/CMakeLists.txt

@@ -1,23 +1,14 @@
 cmake_minimum_required(VERSION 3.24...3.25)
 
-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}")
+legacy_check()
 
-  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")
+if(NOT TARGET OBS::obfuscate)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
 endif()
 
-legacy_check()
+if(NOT TARGET OBS::inject-library)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-inject-library" "${CMAKE_BINARY_DIR}/shared/obs-inject-library")
+endif()
 
 option(ENABLE_COMPAT_UPDATES "Checks for capture compatibility data updates" ON)
 

+ 37 - 12
plugins/win-capture/get-graphics-offsets/CMakeLists.txt

@@ -1,23 +1,48 @@
 cmake_minimum_required(VERSION 3.24...3.25)
 
-add_library(_get-graphics-offsets INTERFACE)
+legacy_check()
+
+if(NOT TARGET OBS::d3d8-api)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-d3d8-api" obs-d3d8-api)
+endif()
+
+if(NOT TARGET OBS::hook-config)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-hook-config" obs-hook-config)
+endif()
+
+add_executable(get-graphics-offsets)
 target_sources(
-  _get-graphics-offsets
-  INTERFACE d3d8-offsets.cpp d3d9-offsets.cpp dxgi-offsets.cpp get-graphics-offsets.c get-graphics-offsets.h
+  get-graphics-offsets
+  PRIVATE d3d8-offsets.cpp d3d9-offsets.cpp dxgi-offsets.cpp get-graphics-offsets.c get-graphics-offsets.h
 )
 
 target_link_libraries(
-  _get-graphics-offsets
-  INTERFACE OBS::hook-config OBS::d3d8-api d3d9.lib dxgi.lib d3d11.lib
+  get-graphics-offsets
+  PRIVATE OBS::hook-config OBS::d3d8-api d3d9.lib dxgi.lib d3d11.lib
 )
 
-legacy_check()
-
-add_executable(get-graphics-offsets)
-target_link_libraries(get-graphics-offsets PRIVATE _get-graphics-offsets)
+if(OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_GENERATOR_PLATFORM)
+  if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
+    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 x86 get-graphics-offsets"
+    )
+  endif()
 
-include(cmake/32bit.cmake)
+  add_dependencies(win-capture get-graphics-offsets)
+endif()
 
-set_target_properties_obs(get-graphics-offsets PROPERTIES FOLDER plugins/win-capture OUTPUT_NAME get-graphics-offsets64 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
+  set(_OUTPUT_NAME get-graphics-offsets64)
+else()
+  set(_OUTPUT_NAME get-graphics-offsets32)
+endif()
 
-add_dependencies(win-capture get-graphics-offsets)
+set_target_properties_obs(
+  get-graphics-offsets PROPERTIES
+                       FOLDER plugins/win-capture
+                       OUTPUT_NAME ${_OUTPUT_NAME}
+                       MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
+)

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

@@ -1,9 +0,0 @@
-project(get-graphics-offsets)
-
-add_executable(get-graphics-offsets)
-target_link_libraries(get-graphics-offsets PRIVATE _get-graphics-offsets)
-
-set_target_properties(
-  get-graphics-offsets
-  PROPERTIES OUTPUT_NAME get-graphics-offsets32 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
-)

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

@@ -1,6 +0,0 @@
-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"
-)

+ 44 - 20
plugins/win-capture/graphics-hook/CMakeLists.txt

@@ -1,21 +1,32 @@
 cmake_minimum_required(VERSION 3.24...3.25)
 
+legacy_check()
+
 find_package(Detours REQUIRED)
 find_package(Vulkan REQUIRED)
 
 if(NOT TARGET OBS::ipc-util)
-  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/ipc-util" "${CMAKE_BINARY_DIR}/shared/ipc-util")
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/ipc-util" ipc-util)
 endif()
 
 if(NOT TARGET OBS::obfuscate)
   add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
 endif()
 
-add_library(_graphics-hook INTERFACE)
+if(NOT TARGET OBS::d3d8-api)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-d3d8-api" obs-d3d8-api)
+endif()
+
+if(NOT TARGET OBS::hook-config)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-hook-config" obs-hook-config)
+endif()
+
+add_library(graphics-hook MODULE)
+add_library(OBS::graphics-hook ALIAS graphics-hook)
 
 target_sources(
-  _graphics-hook
-  INTERFACE
+  graphics-hook
+  PRIVATE
     d3d10-capture.cpp
     d3d11-capture.cpp
     d3d12-capture.cpp
@@ -30,30 +41,43 @@ target_sources(
     graphics-hook.rc
 )
 
-target_compile_definitions(_graphics-hook INTERFACE COMPILE_D3D12_HOOK)
+target_compile_definitions(graphics-hook PRIVATE COMPILE_D3D12_HOOK)
 
 target_link_libraries(
-  _graphics-hook
-  INTERFACE OBS::d3d8-api OBS::hook-config OBS::ipc-util OBS::obfuscate Detours::Detours dxguid
+  graphics-hook
+  PRIVATE OBS::d3d8-api OBS::hook-config OBS::ipc-util OBS::obfuscate Detours::Detours dxguid
 )
 
-target_link_options(_graphics-hook INTERFACE /IGNORE:4099)
+target_link_options(graphics-hook PRIVATE /IGNORE:4099)
 
 if(TARGET Vulkan::Vulkan)
-  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)
+  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)
 endif()
 
-legacy_check()
-
-add_library(graphics-hook MODULE)
-add_library(OBS::graphics-hook ALIAS graphics-hook)
+if(OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_GENERATOR_PLATFORM)
+  if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
+    add_custom_command(
+      TARGET graphics-hook
+      POST_BUILD
+      COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $<CONFIG> -t graphics-hook
+      COMMENT "Build x86 graphics-hook"
+    )
+  endif()
 
-target_link_libraries(graphics-hook PRIVATE _graphics-hook)
-
-include(cmake/32bit.cmake)
+  add_dependencies(win-capture graphics-hook)
+endif()
 
-set_target_properties_obs(graphics-hook PROPERTIES FOLDER "plugins/win-capture" OUTPUT_NAME graphics-hook64 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
+  set(_OUTPUT_NAME graphics-hook64)
+else()
+  set(_OUTPUT_NAME graphics-hook32)
+endif()
 
-add_dependencies(win-capture graphics-hook)
+set_target_properties_obs(
+  graphics-hook PROPERTIES
+                FOLDER "plugins/win-capture"
+                OUTPUT_NAME ${_OUTPUT_NAME}
+                MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
+)

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

@@ -1,13 +0,0 @@
-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_target_properties(
-  graphics-hook
-  PROPERTIES OUTPUT_NAME graphics-hook32 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
-)

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

@@ -1,6 +0,0 @@
-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"
-)

+ 1 - 1
plugins/win-capture/graphics-hook/graphics-hook.rc

@@ -11,7 +11,7 @@
  *
  * THIS IS YOUR ONLY WARNING. */
 
-#include "../graphics-hook-ver.h"
+#include <graphics-hook-ver.h>
 
 1 VERSIONINFO
 FILEVERSION HOOK_VER_MAJOR,HOOK_VER_MINOR,HOOK_VER_PATCH,0

+ 30 - 9
plugins/win-capture/inject-helper/CMakeLists.txt

@@ -1,22 +1,43 @@
 cmake_minimum_required(VERSION 3.24...3.25)
 
+legacy_check()
+
 if(NOT TARGET OBS::obfuscate)
   add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
 endif()
 
-add_library(_inject-helper INTERFACE)
+if(NOT TARGET OBS::inject-library)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-inject-library" obs-inject-library)
+endif()
 
-target_sources(_inject-helper INTERFACE inject-helper.c)
+add_executable(inject-helper)
 
-target_link_libraries(_inject-helper INTERFACE OBS::inject-library OBS::obfuscate)
+target_sources(inject-helper PRIVATE inject-helper.c)
 
-legacy_check()
+target_link_libraries(inject-helper PRIVATE OBS::inject-library OBS::obfuscate)
 
-add_executable(inject-helper)
-target_link_libraries(inject-helper PRIVATE _inject-helper)
+if(OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_GENERATOR_PLATFORM)
+  if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
+    add_custom_command(
+      TARGET inject-helper
+      POST_BUILD
+      COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $<CONFIG> -t inject-helper
+      COMMENT "Build x86 inject-helper"
+    )
+  endif()
 
-include(cmake/32bit.cmake)
+  add_dependencies(win-capture inject-helper)
+endif()
 
-set_target_properties_obs(inject-helper PROPERTIES FOLDER plugins/win-capture OUTPUT_NAME inject-helper64 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
+  set(_OUTPUT_NAME inject-helper64)
+else()
+  set(_OUTPUT_NAME inject-helper32)
+endif()
 
-add_dependencies(win-capture inject-helper)
+set_target_properties_obs(
+  inject-helper PROPERTIES
+                FOLDER plugins/win-capture
+                OUTPUT_NAME ${_OUTPUT_NAME}
+                MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
+)

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

@@ -1,9 +0,0 @@
-project(inject-helper)
-
-add_executable(inject-helper)
-target_link_libraries(inject-helper PRIVATE _inject-helper)
-
-set_target_properties(
-  inject-helper
-  PROPERTIES OUTPUT_NAME inject-helper32 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
-)

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

@@ -1,6 +0,0 @@
-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"
-)

+ 29 - 15
plugins/win-dshow/CMakeLists.txt

@@ -1,19 +1,5 @@
 cmake_minimum_required(VERSION 3.24...3.25)
 
-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)
-
-  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}")
-
-  include(cmake/libdshowcapture.cmake)
-  add_subdirectory(virtualcam-module)
-endif()
-
 legacy_check()
 
 find_package(FFmpeg REQUIRED avcodec avutil)
@@ -21,6 +7,22 @@ find_package(FFmpeg REQUIRED avcodec avutil)
 add_library(win-dshow MODULE)
 add_library(OBS::dshow ALIAS win-dshow)
 
+if(NOT TARGET OBS::tiny-nv12-scale)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-tiny-nv12-scale" obs-tiny-nv12-scale)
+endif()
+
+if(NOT TARGET OBS::shared-memory-queue)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-shared-memory-queue" obs-shared-memory-queue)
+endif()
+
+if(NOT TARGET OBS::libdshowcapture)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/deps/libdshowcapture" libdshowcapture)
+endif()
+
+if(NOT TARGET OBS::winhandle)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
+endif()
+
 target_sources(
   win-dshow
   PRIVATE dshow-plugin.cpp encode-dstr.hpp ffmpeg-decode.c ffmpeg-decode.h win-dshow-encoder.cpp win-dshow.cpp
@@ -31,7 +33,17 @@ target_sources(win-dshow PRIVATE win-dshow.rc)
 
 target_link_libraries(
   win-dshow
-  PRIVATE OBS::libobs OBS::w32-pthreads OBS::libdshowcapture FFmpeg::avcodec FFmpeg::avutil strmiids winmm
+  PRIVATE
+    OBS::libobs
+    OBS::w32-pthreads
+    OBS::libdshowcapture
+    OBS::tiny-nv12-scale
+    OBS::shared-memory-queue
+    OBS::winhandle
+    FFmpeg::avcodec
+    FFmpeg::avutil
+    strmiids
+    winmm
 )
 
 if(TARGET OBS::virtualcam AND TARGET OBS::virtualcam-guid)
@@ -43,3 +55,5 @@ if(TARGET OBS::virtualcam AND TARGET OBS::virtualcam-guid)
 endif()
 
 set_target_properties_obs(win-dshow PROPERTIES FOLDER plugins/win-dshow PREFIX "")
+
+add_subdirectory(virtualcam-module)

+ 114 - 91
plugins/win-dshow/cmake/legacy.cmake

@@ -10,9 +10,7 @@ if(NOT ENABLE_VIRTUALCAM)
 endif()
 
 if(ENABLE_VIRTUALCAM AND NOT VIRTUALCAM_GUID)
-  set(VIRTUALCAM_GUID
-      ""
-      CACHE STRING "Virtual Camera GUID" FORCE)
+  set(VIRTUALCAM_GUID "" CACHE STRING "Virtual Camera GUID" FORCE)
   mark_as_advanced(VIRTUALCAM_GUID)
 endif()
 
@@ -23,8 +21,10 @@ 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)
+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)
@@ -33,44 +33,51 @@ 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)
+  INTERFACE
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/external/capture-device-support/Library/EGAVResult.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/external/capture-device-support/Library/ElgatoUVCDevice.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/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)
+  INTERFACE
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshowcapture.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/capture-filter.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/capture-filter.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/output-filter.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/output-filter.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshowcapture.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshowencode.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/device.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/device.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/device-vendor.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/encoder.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/encoder.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-base.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-base.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-demux.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-demux.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-device-defs.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-enum.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-enum.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-formats.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-formats.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-media-type.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-encoded-device.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/dshow-media-type.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/log.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/log.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/source/external/IVideoCaptureFilter.h
+)
 
 target_include_directories(
-  libdshowcapture INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture
-                            ${CMAKE_CURRENT_SOURCE_DIR}/libdshowcapture/external/capture-device-support/Library)
+  libdshowcapture
+  INTERFACE
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/external/capture-device-support/Library
+)
 
 target_compile_definitions(libdshowcapture-external INTERFACE _UP_WINDOWS=1)
 target_compile_definitions(libdshowcapture INTERFACE _UP_WINDOWS=1)
@@ -82,8 +89,10 @@ configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in win-dsh
 
 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)
+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)
@@ -109,11 +118,13 @@ if(ENABLE_VIRTUALCAM)
         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)
+        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})
@@ -139,70 +150,82 @@ 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)
+  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)
+  FILES
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/external/capture-device-support/Library/EGAVResult.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/external/capture-device-support/Library/ElgatoUVCDevice.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/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)
+  FILES
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/capture-filter.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/output-filter.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshowcapture.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshowencode.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/device.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/device-vendor.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/encoder.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-base.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-demux.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-enum.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-formats.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-media-type.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-encoded-device.cpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/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)
+  FILES
+    libdshowcapture/dshowcapture.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/capture-filter.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/output-filter.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/device.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/encoder.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-base.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-demux.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-device-defs.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-enum.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-formats.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/dshow-media-type.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/log.hpp
+    ${CMAKE_SOURCE_DIR}/deps/libdshowcapture/src/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_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-module/virtualcam-guid.h.in
-                 ${CMAKE_CURRENT_BINARY_DIR}/config/virtualcam-guid.h)
+  configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/virtualcam-module/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)
 

+ 120 - 75
plugins/win-dshow/virtualcam-module/CMakeLists.txt

@@ -1,89 +1,131 @@
 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()
+legacy_check()
+
+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)
+  set(VIRTUALCAM_GUID "" CACHE STRING "Virtual Camera GUID" FORCE)
+  mark_as_advanced(VIRTUALCAM_GUID)
 
-  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.")
+  target_disable_feature(obs-virtualcam-module "Virtual Camera Support (empty GUID)")
+  return()
+else()
+  set(VALID_GUID FALSE)
+  check_uuid(${VIRTUALCAM_GUID} VALID_GUID)
 
-    message(WARNING "Empty Virtual Camera GUID set.")
-    target_disable_feature(obs-virtualcam-module "Virtual Camera Support (empty GUID)")
+  if(NOT VALID_GUID)
+    message(WARNING "Invalid Virtual Camera GUID set.")
+    target_disable_feature(obs-virtualcam-module "Virtual Camera Support (invalid 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
-      ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.rc
-      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_link_libraries(
-    _virtualcam
-    INTERFACE OBS::virtualcam-interface OBS::virtualcam-guid OBS::libdshowcapture OBS::winhandle gdiplus strmiids winmm
-  )
+  # 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()
 
-legacy_check()
+if(NOT TARGET OBS::winhandle)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
+endif()
+
+if(NOT TARGET OBS::threading-windows)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
+endif()
+
+if(NOT TARGET OBS::tiny-nv12-scale)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-tiny-nv12-scale" obs-tiny-nv12-scale)
+endif()
+
+if(NOT TARGET OBS::shared-memory-queue)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-shared-memory-queue" obs-shared-memory-queue)
+endif()
+
+if(NOT TARGET OBS::libdshowcapture)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/deps/libdshowcapture" libdshowcapture)
+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(obs-virtualcam-module MODULE)
 add_library(OBS::virtualcam ALIAS obs-virtualcam-module)
 
-target_sources(obs-virtualcam-module PRIVATE cmake/windows/virtualcam-module64.def)
-target_link_libraries(obs-virtualcam-module PRIVATE _virtualcam)
+configure_file(cmake/windows/obs-module.rc.in virtualcam-module.rc)
+target_sources(
+  obs-virtualcam-module
+  PRIVATE
+    ${CMAKE_CURRENT_BINARY_DIR}/virtualcam-module.rc
+    placeholder.cpp
+    sleepto.c
+    sleepto.h
+    virtualcam-filter.cpp
+    virtualcam-filter.hpp
+    virtualcam-module.cpp
+)
+
+target_include_directories(obs-virtualcam-module PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
+target_compile_definitions(obs-virtualcam-module PRIVATE VIRTUALCAM_AVAILABLE)
+
+target_link_libraries(
+  obs-virtualcam-module
+  PRIVATE
+    OBS::tiny-nv12-scale
+    OBS::shared-memory-queue
+    OBS::virtualcam-guid
+    OBS::libdshowcapture
+    OBS::winhandle
+    OBS::threading-windows
+    gdiplus
+    strmiids
+    winmm
+)
+
+if(OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_GENERATOR_PLATFORM)
+  if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
+    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 x86 obs-virtualcam-module"
+    )
+  endif()
+
+  add_dependencies(win-dshow obs-virtualcam-module)
+endif()
 
-set_property(TARGET obs-virtualcam-module PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+if(CMAKE_GENERATOR_PLATFORM STREQUAL x64)
+  set(_OUTPUT_NAME virtualcam-module64)
+else()
+  set(_OUTPUT_NAME virtualcam-module32)
+endif()
+
+target_sources(obs-virtualcam-module PRIVATE cmake/windows/${_OUTPUT_NAME}.def)
 
 configure_file(virtualcam-install.bat.in virtualcam-install.bat)
 target_add_resource(obs-virtualcam-module "${CMAKE_CURRENT_BINARY_DIR}/virtualcam-install.bat"
@@ -95,6 +137,9 @@ target_add_resource(obs-virtualcam-module "${CMAKE_CURRENT_BINARY_DIR}/virtualca
                     "${OBS_DATA_DESTINATION}/obs-plugins/win-dshow"
 )
 
-include(cmake/32bit.cmake)
-
-set_target_properties_obs(obs-virtualcam-module PROPERTIES FOLDER plugins/win-dshow OUTPUT_NAME obs-virtualcam-module64)
+set_target_properties_obs(
+  obs-virtualcam-module PROPERTIES
+                        FOLDER plugins/win-dshow
+                        OUTPUT_NAME obs-${_OUTPUT_NAME}
+                        MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
+)

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

@@ -1,49 +0,0 @@
-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 MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
-
-set_property(TARGET obs-virtualcam-module PROPERTY OUTPUT_NAME obs-virtualcam-module32)

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

@@ -1,6 +0,0 @@
-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"
-)

+ 4 - 4
plugins/win-dshow/virtualcam-module/virtualcam-filter.hpp

@@ -7,15 +7,15 @@
 #ifdef OBS_LEGACY
 #include "../shared-memory-queue.h"
 #include "../tiny-nv12-scale.h"
-#include "../libdshowcapture/source/output-filter.hpp"
-#include "../libdshowcapture/source/dshow-formats.hpp"
+#include "../../../deps/libdshowcapture/src/source/output-filter.hpp"
+#include "../../../deps/libdshowcapture/src/source/dshow-formats.hpp"
 #include "../../../libobs/util/windows/WinHandle.hpp"
 #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 <source/output-filter.hpp>
+#include <source/dshow-formats.hpp>
 #include <util/windows/WinHandle.hpp>
 #include <util/threading-windows.h>
 #endif

+ 4 - 0
plugins/win-dshow/win-dshow-encoder.cpp

@@ -2,7 +2,11 @@
 #include <obs-avc.h>
 #include <util/darray.h>
 #include <util/dstr.hpp>
+#ifdef OBS_LEGACY
 #include "libdshowcapture/dshowcapture.hpp"
+#else
+#include <dshowcapture.hpp>
+#endif
 
 using namespace DShow;
 using namespace std;

+ 4 - 0
plugins/win-dshow/win-dshow.cpp

@@ -6,7 +6,11 @@
 #include <util/platform.h>
 #include <util/windows/WinHandle.hpp>
 #include <util/threading.h>
+#ifdef OBS_LEGACY
 #include "libdshowcapture/dshowcapture.hpp"
+#else
+#include <dshowcapture.hpp>
+#endif
 #include "ffmpeg-decode.h"
 #include "encode-dstr.hpp"