forked from leadedge/Spout2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
170 lines (141 loc) · 4.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
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
#\-------------------------------------- . -----------------------------------/#
# Filename : CMakeList.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 #
#/-------------------------------------- . -----------------------------------\#
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_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)
# add_subdirectory(SPOUTSDK/SpoutDirectX/SpoutDX)
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 DirectX11 support library" OFF)
if(SPOUT_BUILD_SPOUTDX OR SPOUT_BUILD_SPOUTDX_EXAMPLES)
add_subdirectory(SPOUTSDK/SpoutDirectX/SpoutDX)
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)
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(
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
)
endif()
if(SPOUT_BUILD_LIBRARY)
install(
FILES
SPOUTSDK/SpoutLibrary/SpoutLibrary.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/SpoutLibrary
)
endif()
endif()
endif()