summaryrefslogtreecommitdiffstats
path: root/server/shadow/CMakeLists.txt
blob: 72adcca768f2b822a5e8c0981240feef1efe13ed (plain)
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP Shadow Server cmake build script
#
# Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#	 http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# freerdp-shadow  library

set(MODULE_NAME "freerdp-shadow")

set(SRCS
	shadow_client.c
	shadow_client.h
	shadow_lobby.c
	shadow_lobby.h
	shadow_input.c
	shadow_input.h
	shadow_screen.c
	shadow_screen.h
	shadow_surface.c
	shadow_surface.h
	shadow_encoder.c
	shadow_encoder.h
	shadow_capture.c
	shadow_capture.h
	shadow_channels.c
	shadow_channels.h
	shadow_encomsp.c
	shadow_encomsp.h
	shadow_remdesk.c
	shadow_remdesk.h
	shadow_rdpsnd.c
	shadow_rdpsnd.h
	shadow_audin.c
	shadow_audin.h
	shadow_rdpgfx.c
	shadow_rdpgfx.h
	shadow_subsystem.c
	shadow_subsystem.h
	shadow_mcevent.c
	shadow_mcevent.h
	shadow_server.c
	shadow.h)

if (NOT FREERDP_UNIFIED_BUILD)
	find_package(rdtk 0 REQUIRED)
	include_directories(${RDTK_INCLUDE_DIR})
else()
	if (NOT WITH_RDTK)
		message(FATAL_ERROR "-DWITH_RDTK=ON is required for unified FreeRDP build with shadow server")
	endif()
	include_directories(${PROJECT_SOURCE_DIR}/rdtk/include)
	include_directories(${PROJECT_BINARY_DIR}/rdtk/include)
endif()

# On windows create dll version information.
# Vendor, product and year are already set in top level CMakeLists.txt
if (WIN32)
  set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
  set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR})
  set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION})
  set (RC_VERSION_PATCH 0)
  set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${FREERDP_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" )

  configure_file(
	${PROJECT_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in
	${CMAKE_CURRENT_BINARY_DIR}/version.rc
	@ONLY)

list (APPEND SRCS ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

add_library(${MODULE_NAME} ${SRCS})

list(APPEND LIBS
	freerdp
	freerdp-server
	winpr
	winpr-tools
	rdtk
)

target_include_directories(${MODULE_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})

set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_VERSION_MAJOR})
if (WITH_LIBRARY_VERSIONING)
	  set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION})
endif()

install(TARGETS ${MODULE_NAME} COMPONENT server EXPORT FreeRDP-ShadowTargets
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

if (WITH_DEBUG_SYMBOLS AND MSVC)
	get_target_property(OUTPUT_FILENAME ${MODULE_NAME} OUTPUT_NAME)
	install(FILES ${PROJECT_BINARY_DIR}/${OUTPUT_FILENAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols)
endif()

set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")

# subsystem library

set(MODULE_NAME "freerdp-shadow-subsystem")

set(SRCS
	shadow_subsystem_builtin.c)

if(WIN32)
	add_subdirectory(Win)
elseif(NOT APPLE)
	add_subdirectory(X11)
elseif(APPLE AND NOT IOS)
	add_subdirectory(Mac)
endif()

if (WIN32)
  set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
  set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR})
  set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION})
  set (RC_VERSION_FILE "${MODULE_NAME}${CMAKE_EXECUTABLE_SUFFIX}" )

  configure_file(
	${PROJECT_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in
	${CMAKE_CURRENT_BINARY_DIR}/version.rc
	@ONLY)

  set ( SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

add_library(${MODULE_NAME} ${SRCS})

list(APPEND LIBS
	freerdp-shadow-subsystem-impl
	freerdp-shadow
	freerdp
	winpr
)

target_include_directories(${MODULE_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})

set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_API_VERSION})
if (WITH_LIBRARY_VERSIONING)
	set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION})
endif()

if (NOT BUILD_SHARED_LIBS)
	install(TARGETS freerdp-shadow-subsystem-impl
        DESTINATION ${CMAKE_INSTALL_LIBDIR}
        EXPORT FreeRDP-ShadowTargets
    )
endif()

install(TARGETS ${MODULE_NAME} COMPONENT server EXPORT FreeRDP-ShadowTargets
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

if (WITH_DEBUG_SYMBOLS AND MSVC)
	get_target_property(OUTPUT_FILENAME ${MODULE_NAME} OUTPUT_NAME)
	install(FILES ${PROJECT_BINARY_DIR}/${OUTPUT_FILENAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR}
		COMPONENT symbols)
endif()

set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")

# command-line executable

set(MODULE_NAME "freerdp-shadow-cli")

set(SRCS
	shadow.c)

# On windows create dll version information.
# Vendor, product and year are already set in top level CMakeLists.txt
if (WIN32)
  set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
  set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR})
  set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION})
  set (RC_VERSION_FILE "${MODULE_NAME}${CMAKE_EXECUTABLE_SUFFIX}" )

  configure_file(
	${PROJECT_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in
	${CMAKE_CURRENT_BINARY_DIR}/version.rc
	@ONLY)

  set ( SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()

add_executable(${MODULE_NAME} ${SRCS})

set(MANPAGE_NAME "${MODULE_NAME}")
if (WITH_BINARY_VERSIONING)
	set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "${MODULE_NAME}${FREERDP_API_VERSION}")
	set(MANPAGE_NAME "${MODULE_NAME}${FREERDP_API_VERSION}")
endif()

list(APPEND LIBS freerdp-shadow-subsystem freerdp-shadow freerdp winpr)

target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})

install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server)
if (WITH_DEBUG_SYMBOLS AND MSVC)
	install(FILES ${PROJECT_BINARY_DIR}/${MODULE_NAME}.pdb DESTINATION ${CMAKE_INSTALL_BINDIR}
		COMPONENT symbols)
endif()

set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")

include(pkg-config-install-prefix)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-shadow.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc @ONLY)
configure_file(freerdp-shadow-cli.1.in ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE_NAME}.1)
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE_NAME}.1 1)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR})

export(PACKAGE freerdp-shadow)

SetFreeRDPCMakeInstallDir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Shadow${FREERDP_VERSION_MAJOR}")

configure_package_config_file(FreeRDP-ShadowConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake
	INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}
	PATH_VARS FREERDP_INCLUDE_DIR)

write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake
	VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake
	${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake
	DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR})

install(EXPORT FreeRDP-ShadowTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR})