-
Notifications
You must be signed in to change notification settings - Fork 54
/
CMakeLists.txt
114 lines (100 loc) · 3.89 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
if (NOT WIN32)
return()
endif()
cmake_minimum_required(VERSION 3.5)
project(win-spout)
set(CMAKE_PREFIX_PATH "${QTDIR}")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/plugins/win-spout/external")
if(MSVC)
include_directories(deps/Spout2/SPOUTSDK/SpoutLibrary)
include_directories(deps/Spout2/SPOUTSDK/SpoutDirectX/SpoutDX)
link_directories(deps/Spout2/BUILD/Binaries/x64)
endif()
add_library(win-spout MODULE)
add_library(OBS::win-spout ALIAS win-spout)
target_sources(
win-spout
PRIVATE
source/win-spout.h
source/win-spout-config.h
source/ui/win-spout-output-settings.h
source/win-spout.cpp
source/win-spout-source.cpp
source/win-spout-output.cpp
source/win-spout-filter.cpp
source/win-spout-config.cpp
source/ui/win-spout-output-settings.cpp)
target_include_directories(win-spout
PUBLIC
obs::frontend-api
obs::libobs
)
set(SPOUTDX_LIB "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/x64/SpoutDX.lib")
target_link_libraries(win-spout
PRIVATE
OBS::frontend-api
OBS::libobs
${SPOUTDX_LIB}
OBS::w32-pthreads
Qt::Core
Qt::Widgets
)
function(copy_spout_file)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_src_suffix "x64")
else()
set(_src_suffix "win32")
endif()
add_custom_command(TARGET win-spout POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.dll"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/Spout.dll"
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.dll"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/SpoutLibrary.dll"
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.dll"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/SpoutDX.dll"
)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.pdb")
add_custom_command(TARGET win-spout POST_BUILD
COMMAND if $<CONFIG:Debug>==1(
"${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.pdb"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/Spout.pdb")
COMMAND if $<CONFIG:RelWithDebInfo>==1(
"${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.pdb"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/Spout.pdb")
)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.pdb")
add_custom_command(TARGET win-spout POST_BUILD
COMMAND if $<CONFIG:Debug>==1(
"${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.pdb"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/SpoutLibrary.pdb")
COMMAND if $<CONFIG:RelWithDebInfo>==1(
"${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.pdb"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/SpoutLibrary.pdb")
)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.pdb")
add_custom_command(TARGET win-spout POST_BUILD
COMMAND if $<CONFIG:Debug>==1(
"${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.pdb"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/SpoutDX.pdb")
COMMAND if $<CONFIG:RelWithDebInfo>==1(
"${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.pdb"
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/${OBS_PLUGIN_DESTINATION}/SpoutDX.pdb")
)
endif()
endfunction()
set_target_properties_obs(win-spout PROPERTIES FOLDER plugins/win-spout PREFIX "")
copy_spout_file()