PatTheMav d42c98fa22
win-capture: Fix added resources not properly copied to rundir
The `add_target_resource` function uses unnecessary path components
when copying files to the rundir, resulting in files added that way
not to end up where OBS expects them to.

The generated binaries created by sub-targets also need to be copied
as part of `win-capture`'s data files, which was easy to fix as the
target exists before CMake switches into the subdirectories.
2022-03-30 11:10:54 +02:00

67 lines
1.9 KiB
CMake

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
../obfuscate.c
../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)
if(MSVC)
target_compile_options(graphics-hook PRIVATE "$<IF:$<CONFIG:Debug>,/MTd,/MT>")
add_target_resource(win-capture "$<TARGET_PDB_FILE:graphics-hook>"
"obs-plugins/win-capture/" OPTIONAL)
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)
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(
win-capture "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan64.json"
"obs-plugins/win-capture/")
add_target_resource(
win-capture "${CMAKE_CURRENT_SOURCE_DIR}/obs-vulkan32.json"
"obs-plugins/win-capture/")
endif()
add_target_resource(win-capture "$<TARGET_FILE:graphics-hook>"
"obs-plugins/win-capture/")
add_dependencies(win-capture graphics-hook)