CMakeLists.txt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. cmake_minimum_required(VERSION 3.28...3.30)
  2. find_package(Detours REQUIRED)
  3. find_package(Vulkan REQUIRED)
  4. if(NOT TARGET OBS::ipc-util)
  5. add_subdirectory("${CMAKE_SOURCE_DIR}/shared/ipc-util" ipc-util)
  6. endif()
  7. if(NOT TARGET OBS::obfuscate)
  8. add_subdirectory("${CMAKE_SOURCE_DIR}/libobs" "${CMAKE_BINARY_DIR}/libobs")
  9. endif()
  10. if(NOT TARGET OBS::d3d8-api)
  11. add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-d3d8-api" obs-d3d8-api)
  12. endif()
  13. if(NOT TARGET OBS::hook-config)
  14. add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-hook-config" obs-hook-config)
  15. endif()
  16. add_library(graphics-hook MODULE)
  17. add_library(OBS::graphics-hook ALIAS graphics-hook)
  18. target_sources(
  19. graphics-hook
  20. PRIVATE
  21. d3d10-capture.cpp
  22. d3d11-capture.cpp
  23. d3d12-capture.cpp
  24. d3d8-capture.cpp
  25. d3d9-capture.cpp
  26. d3d9-patches.hpp
  27. dxgi-capture.cpp
  28. gl-capture.c
  29. gl-decs.h
  30. graphics-hook.c
  31. graphics-hook.h
  32. graphics-hook.rc
  33. )
  34. target_compile_definitions(graphics-hook PRIVATE COMPILE_D3D12_HOOK)
  35. target_link_libraries(
  36. graphics-hook
  37. PRIVATE OBS::d3d8-api OBS::hook-config OBS::ipc-util OBS::obfuscate Detours::Detours dxguid
  38. )
  39. target_link_options(graphics-hook PRIVATE /IGNORE:4099)
  40. if(TARGET Vulkan::Vulkan)
  41. target_sources(graphics-hook PRIVATE vulkan-capture.c vulkan-capture.h)
  42. target_link_libraries(graphics-hook PRIVATE Vulkan::Vulkan)
  43. target_compile_definitions(graphics-hook PRIVATE COMPILE_VULKAN_HOOK)
  44. endif()
  45. if(OBS_PARENT_ARCHITECTURE STREQUAL CMAKE_VS_PLATFORM_NAME)
  46. if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
  47. add_custom_command(
  48. TARGET graphics-hook
  49. POST_BUILD
  50. COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_SOURCE_DIR}/build_x86 --config $<CONFIG> -t graphics-hook
  51. COMMENT "Build x86 graphics-hook"
  52. )
  53. endif()
  54. add_dependencies(win-capture graphics-hook)
  55. endif()
  56. if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
  57. set(_OUTPUT_NAME graphics-hook64)
  58. else()
  59. set(_OUTPUT_NAME graphics-hook32)
  60. endif()
  61. set_target_properties_obs(
  62. graphics-hook PROPERTIES
  63. FOLDER "plugins/win-capture"
  64. OUTPUT_NAME ${_OUTPUT_NAME}
  65. MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
  66. )