-
Notifications
You must be signed in to change notification settings - Fork 140
/
CMakeLists.txt
218 lines (185 loc) · 6.64 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#\-------------------------------------- . -----------------------------------/#
# Filename : CMakeLists.txt | Main Spout CMakeList #
# Author : Alexandre Buge | #
# Started : 08/09/2020 12:00 | #
#/-------------------------------------- . -----------------------------------\#
# Modifications : spout.zeal.co #
# 29/12/20 - Specify Spout Version 2.007 #
# 31/12/20 - Add /MT build option #
# - Add DirectX library build option #
# 06/11/22 - Add Install option by Joakim Kilby #
# 13/01/23 - Default do not skip INSTALL project #
# Add necessary SpoutGL headers to SpoutDX includes #
# 07/10/23 - Add SPOUT_BUILD_ARM option and download sse2neon.h #
# Add compiler include_directory and /Zc:preprocessor define #
# 20/07/24 - Add SpoutDX12 library #
# 21/07/24 - Add SpoutDX9 library #
#/-------------------------------------- . -----------------------------------\#
cmake_minimum_required(VERSION 3.15)
project(Spout
LANGUAGES CXX
VERSION 2.0
HOMEPAGE_URL https://spout.zeal.co
)
# ensure lib and dll will be in the working directories of executables
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${CMAKE_GENERATOR})
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${CMAKE_GENERATOR})
set (SMODE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/pdb/${CMAKE_GENERATOR})
if(NOT WIN32)
message(STATUS "Spout is not supported outside of MS Windows")
return()
endif()
OPTION(SPOUT_BUILD_ARM "Build for Windows on ARM" OFF)
if(SPOUT_BUILD_ARM)
# Use SS2NEON so SIMD code doesn't have to be rewritten for ARM
# Download sse2neon.h
File(DOWNLOAD https://github.com/DLTcollab/sse2neon/raw/master/sse2neon.h ${PROJECT_SOURCE_DIR}/SPOUTSDK/sse2neon/sse2neon.h)
# Add compiler include_directory and /Zc:preprocessor define
include_directories(SPOUTSDK/sse2neon)
add_compile_options(/Zc:preprocessor)
endif()
OPTION(SPOUT_BUILD_CMT "For Visual Studio - build /MT to link runtime libraries" ON)
if(SPOUT_BUILD_CMT)
# https://gitlab.kitware.com/cmake/cmake/-/issues/18390
if(MSVC)
add_compile_options(
$<$<CONFIG:>:/MT> #---------|
$<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries
$<$<CONFIG:Release>:/MT> #--|
)
endif()
endif()
add_subdirectory(SPOUTSDK/SpoutGL)
OPTION(SPOUT_BUILD_LIBRARY "Build C-compatible cross compiler library" ON)
if(SPOUT_BUILD_LIBRARY)
add_subdirectory(SPOUTSDK/SpoutLibrary)
endif()
# The SpoutDX CMakeLists needs this option
OPTION(SPOUT_BUILD_SPOUTDX_EXAMPLES "Build SpoutDX examples" OFF)
OPTION(SPOUT_BUILD_SPOUTDX "Build SpoutDX DirectX 9/11/12 libraries" OFF)
if(SPOUT_BUILD_SPOUTDX OR SPOUT_BUILD_SPOUTDX_EXAMPLES)
add_subdirectory(SPOUTSDK/SpoutDirectX/SpoutDX)
add_subdirectory(SPOUTSDK/SpoutDirectX/SpoutDX/SpoutDX12)
add_subdirectory(SPOUTSDK/SpoutDirectX/SpoutDX/SpoutDX9)
endif()
# Install option check boxes
OPTION(SKIP_INSTALL_ALL "Install headers and libraries" OFF) # Default do not skip all install
OPTION(SKIP_INSTALL_HEADERS "Install headers" OFF)
OPTION(SKIP_INSTALL_LIBRARIES "Install libraries" OFF)
include(GNUInstallDirs)
# Install default output folder
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/INSTALL CACHE PATH "..." FORCE)
endif()
# Install options
if(NOT SKIP_INSTALL_ALL)
if(NOT SKIP_INSTALL_LIBRARIES)
set(Spout2InstallTargets Spout Spout_static)
if(SPOUT_BUILD_SPOUTDX OR SPOUT_BUILD_SPOUTDX_EXAMPLES)
list(APPEND Spout2InstallTargets SpoutDX SpoutDX_static)
list(APPEND Spout2InstallTargets SpoutDX12 SpoutDX12_static)
list(APPEND Spout2InstallTargets SpoutDX9 SpoutDX9_static)
endif()
if(SPOUT_BUILD_LIBRARY)
list(APPEND Spout2InstallTargets SpoutLibrary)
endif()
install(
TARGETS
${Spout2InstallTargets}
EXPORT
spout2-targets
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
EXPORT
spout2-targets
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/spout2
NAMESPACE
Spout2::
)
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/spout2-config.cmake
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/spout2
)
endif()
if(NOT SKIP_INSTALL_HEADERS)
install(
FILES
SPOUTSDK/SpoutGL/Spout.h
SPOUTSDK/SpoutGL/SpoutCommon.h
SPOUTSDK/SpoutGL/SpoutCopy.h
SPOUTSDK/SpoutGL/SpoutDirectX.h
SPOUTSDK/SpoutGL/SpoutFrameCount.h
SPOUTSDK/SpoutGL/SpoutGL.h
SPOUTSDK/SpoutGL/SpoutGLextensions.h
SPOUTSDK/SpoutGL/SpoutReceiver.h
SPOUTSDK/SpoutGL/SpoutSender.h
SPOUTSDK/SpoutGL/SpoutSenderNames.h
SPOUTSDK/SpoutGL/SpoutSharedMemory.h
SPOUTSDK/SpoutGL/SpoutUtils.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/SpoutGL
)
if(SPOUT_BUILD_SPOUTDX OR SPOUT_BUILD_SPOUTDX_EXAMPLES)
install(
# SpoutDX
FILES
SPOUTSDK/SpoutDirectX/SpoutDX/SpoutDX.h
SPOUTSDK/SpoutGL/SpoutCommon.h
SPOUTSDK/SpoutGL/SpoutCopy.h
SPOUTSDK/SpoutGL/SpoutDirectX.h
SPOUTSDK/SpoutGL/SpoutFrameCount.h
SPOUTSDK/SpoutGL/SpoutSenderNames.h
SPOUTSDK/SpoutGL/SpoutSharedMemory.h
SPOUTSDK/SpoutGL/SpoutUtils.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/SpoutDX
)
install(
# SpoutDX12
FILES
SPOUTSDK/SpoutDirectX/SpoutDX/SpoutDX12/SpoutDX12.h
SPOUTSDK/SpoutDirectX/SpoutDX/SpoutDX.h
SPOUTSDK/SpoutGL/SpoutCommon.h
SPOUTSDK/SpoutGL/SpoutCopy.h
SPOUTSDK/SpoutGL/SpoutDirectX.h
SPOUTSDK/SpoutGL/SpoutFrameCount.h
SPOUTSDK/SpoutGL/SpoutSenderNames.h
SPOUTSDK/SpoutGL/SpoutSharedMemory.h
SPOUTSDK/SpoutGL/SpoutUtils.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/SpoutDX12
)
install(
# SpoutDX9
FILES
SPOUTSDK/SpoutDirectX/SpoutDX/SpoutDX9/SpoutDX9.h
SPOUTSDK/SpoutGL/SpoutCommon.h
SPOUTSDK/SpoutGL/SpoutFrameCount.h
SPOUTSDK/SpoutGL/SpoutSenderNames.h
SPOUTSDK/SpoutGL/SpoutSharedMemory.h
SPOUTSDK/SpoutGL/SpoutUtils.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/SpoutDX9
)
endif()
if(SPOUT_BUILD_LIBRARY)
install(
FILES
SPOUTSDK/SpoutLibrary/SpoutLibrary.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/SpoutLibrary
)
endif()
endif()
endif()