forked from Off-World-Live/obs-spout2-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
125 lines (108 loc) · 4.32 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
114
115
116
117
118
119
120
121
122
123
124
if (NOT WIN32)
return()
endif()
cmake_minimum_required(VERSION 3.5)
project(win-spout)
set(CMAKE_CXX_STANDARD 11)
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")
set(LIBOBS_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libobs")
set(LIBOBS_LIB "${CMAKE_BINARY_DIR}/libobs/$<CONFIGURATION>/obs.lib")
set(OBS_FRONTEND_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/UI/obs-frontend-api")
set(OBS_FRONTEND_LIB "${CMAKE_BINARY_DIR}/UI/obs-frontend-api/$<CONFIGURATION>/obs-frontend-api.lib")
set(PTHREAD_LIB "${CMAKE_BINARY_DIR}/deps/w32-pthreads/$<CONFIGURATION>/w32-pthreads.lib")
find_qt(COMPONENTS Core Widgets)
if(MSVC)
include_directories(deps/Spout2/SPOUTSDK/SpoutLibrary)
include_directories(deps/Spout2/SPOUTSDK/SpoutDirectX/SpoutDX)
link_directories(deps/Spout2/BUILD/Binaries/x64)
endif()
set(win-spout_HEADERS
source/win-spout.h
source/win-spout-config.h
source/ui/win-spout-output-settings.h)
set(win-spout_SOURCES
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)
add_library(win-spout MODULE
${win-spout_SOURCES}
${win-spout_HEADERS})
include_directories(
${OBS_FRONTEND_INCLUDE_DIR}
${LIBOBS_INCLUDE_DIR}
${Qt5Core_INCLUDES}
${Qt5Widgets_INCLUDES}
)
set(SPOUTDX_LIB "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/x64/SpoutDX.lib")
target_link_libraries(win-spout
${OBS_FRONTEND_LIB}
${PTHREAD_LIB}
${LIBOBS_LIB}
${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()
setup_plugin_target(win-spout)
copy_spout_file()