Blame channels/client/CMakeLists.txt

Packit 1fb8d4
# FreeRDP: A Remote Desktop Protocol Implementation
Packit 1fb8d4
# FreeRDP cmake build script
Packit 1fb8d4
#
Packit 1fb8d4
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Packit 1fb8d4
#
Packit 1fb8d4
# Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
# you may not use this file except in compliance with the License.
Packit 1fb8d4
# You may obtain a copy of the License at
Packit 1fb8d4
#
Packit 1fb8d4
#     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
#
Packit 1fb8d4
# Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
# distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
# See the License for the specific language governing permissions and
Packit 1fb8d4
# limitations under the License.
Packit 1fb8d4
Packit 1fb8d4
set(MODULE_NAME "freerdp-channels-client")
Packit 1fb8d4
set(MODULE_PREFIX "FREERDP_CHANNELS_CLIENT")
Packit 1fb8d4
Packit 1fb8d4
set(${MODULE_PREFIX}_SRCS
Packit 1fb8d4
	${CMAKE_CURRENT_BINARY_DIR}/tables.c
Packit 1fb8d4
	${CMAKE_CURRENT_SOURCE_DIR}/tables.h
Packit 1fb8d4
	${CMAKE_CURRENT_SOURCE_DIR}/addin.c
Packit 1fb8d4
	${CMAKE_CURRENT_SOURCE_DIR}/addin.h)
Packit 1fb8d4
Packit 1fb8d4
if(CHANNEL_STATIC_CLIENT_ENTRIES)
Packit 1fb8d4
	list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES)
Packit 1fb8d4
endif()
Packit 1fb8d4
Packit 1fb8d4
set(CLIENT_STATIC_TYPEDEFS "typedef UINT (*static_entry_fkt)();\n")
Packit 1fb8d4
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}typedef UINT (*static_addin_fkt)();\n")
Packit 1fb8d4
Packit 1fb8d4
foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})
Packit 1fb8d4
	foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
Packit 1fb8d4
		if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL ${STATIC_ENTRY})
Packit 1fb8d4
			set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME})
Packit 1fb8d4
			set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_CLIENT_CHANNEL})
Packit 1fb8d4
			set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${STATIC_MODULE_NAME})
Packit 1fb8d4
Packit 1fb8d4
			set(ENTRY_POINT_NAME "${STATIC_MODULE_CHANNEL}_${${STATIC_MODULE}_CLIENT_ENTRY}")
Packit 1fb8d4
			if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "VirtualChannelEntry")
Packit 1fb8d4
				set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS);")
Packit 1fb8d4
			elseif(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "VirtualChannelEntryEx")
Packit 1fb8d4
				set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS,PVOID);")
Packit 1fb8d4
			else()
Packit 1fb8d4
				set(ENTRY_POINT_IMPORT "extern UINT ${ENTRY_POINT_NAME}(void);")
Packit 1fb8d4
			endif()
Packit 1fb8d4
			set(${STATIC_ENTRY}_IMPORTS "${${STATIC_ENTRY}_IMPORTS}\n${ENTRY_POINT_IMPORT}")
Packit 1fb8d4
			set(${STATIC_ENTRY}_TABLE "${${STATIC_ENTRY}_TABLE}\n\t{ \"${STATIC_MODULE_CHANNEL}\", (static_entry_fkt)${ENTRY_POINT_NAME} },")
Packit 1fb8d4
		endif()
Packit 1fb8d4
	endforeach()
Packit 1fb8d4
endforeach()
Packit 1fb8d4
Packit 1fb8d4
set(CLIENT_STATIC_ENTRY_TABLES_LIST "${CLIENT_STATIC_ENTRY_TABLES_LIST}\nconst STATIC_ENTRY_TABLE CLIENT_STATIC_ENTRY_TABLES[] =\n{")
Packit 1fb8d4
Packit 1fb8d4
foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})
Packit 1fb8d4
	set(CLIENT_STATIC_ENTRY_IMPORTS "${CLIENT_STATIC_ENTRY_IMPORTS}\n${${STATIC_ENTRY}_IMPORTS}")
Packit 1fb8d4
	set(CLIENT_STATIC_ENTRY_TABLES "${CLIENT_STATIC_ENTRY_TABLES}\nconst STATIC_ENTRY CLIENT_${STATIC_ENTRY}_TABLE[] =\n{")
Packit 1fb8d4
	set(CLIENT_STATIC_ENTRY_TABLES "${CLIENT_STATIC_ENTRY_TABLES}\n${${STATIC_ENTRY}_TABLE}")
Packit 1fb8d4
	set(CLIENT_STATIC_ENTRY_TABLES "${CLIENT_STATIC_ENTRY_TABLES}\n\t{ NULL, NULL }\n};")
Packit 1fb8d4
	set(CLIENT_STATIC_ENTRY_TABLES_LIST "${CLIENT_STATIC_ENTRY_TABLES_LIST}\n\t{ \"${STATIC_ENTRY}\", CLIENT_${STATIC_ENTRY}_TABLE },")
Packit 1fb8d4
endforeach()
Packit 1fb8d4
Packit 1fb8d4
set(CLIENT_STATIC_ENTRY_TABLES_LIST "${CLIENT_STATIC_ENTRY_TABLES_LIST}\n\t{ NULL, NULL }\n};")
Packit 1fb8d4
Packit 1fb8d4
set(CLIENT_STATIC_ADDIN_TABLE "const STATIC_ADDIN_TABLE CLIENT_STATIC_ADDIN_TABLE[] =\n{")
Packit 1fb8d4
foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
Packit 1fb8d4
	set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME})
Packit 1fb8d4
	set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_CLIENT_CHANNEL})
Packit 1fb8d4
	string(TOUPPER "CLIENT_${STATIC_MODULE_CHANNEL}_SUBSYSTEM_TABLE" SUBSYSTEM_TABLE_NAME)
Packit 1fb8d4
	set(SUBSYSTEM_TABLE "const STATIC_SUBSYSTEM_ENTRY ${SUBSYSTEM_TABLE_NAME}[] =\n{")
Packit 1fb8d4
	get_target_property(CHANNEL_SUBSYSTEMS ${STATIC_MODULE_NAME} SUBSYSTEMS)
Packit 1fb8d4
	if(CHANNEL_SUBSYSTEMS MATCHES "NOTFOUND")
Packit 1fb8d4
		set(CHANNEL_SUBSYSTEMS "")
Packit 1fb8d4
	endif()
Packit 1fb8d4
	foreach(STATIC_SUBSYSTEM ${CHANNEL_SUBSYSTEMS})
Packit 1fb8d4
		if(${STATIC_SUBSYSTEM} MATCHES "^([^-]*)-(.*)")
Packit 1fb8d4
			string(REGEX REPLACE "^([^-]*)-(.*)" "\\1" STATIC_SUBSYSTEM_NAME ${STATIC_SUBSYSTEM})
Packit 1fb8d4
			string(REGEX REPLACE "^([^-]*)-(.*)" "\\2" STATIC_SUBSYSTEM_TYPE ${STATIC_SUBSYSTEM})
Packit 1fb8d4
		else()
Packit 1fb8d4
			set(STATIC_SUBSYSTEM_NAME "${STATIC_SUBSYSTEM}")
Packit 1fb8d4
			set(STATIC_SUBSYSTEM_TYPE "")
Packit 1fb8d4
		endif()
Packit 1fb8d4
		string(LENGTH "${STATIC_SUBSYSTEM_TYPE}" _type_length)
Packit 1fb8d4
		set(SUBSYSTEM_MODULE_NAME "${STATIC_MODULE_NAME}-${STATIC_SUBSYSTEM}")
Packit 1fb8d4
		set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${SUBSYSTEM_MODULE_NAME})
Packit 1fb8d4
		if(_type_length GREATER 0)
Packit 1fb8d4
			set(STATIC_SUBSYSTEM_ENTRY "${STATIC_SUBSYSTEM_NAME}_freerdp_${STATIC_MODULE_CHANNEL}_client_${STATIC_SUBSYSTEM_TYPE}_subsystem_entry")
Packit 1fb8d4
		else()
Packit 1fb8d4
			set(STATIC_SUBSYSTEM_ENTRY "${STATIC_SUBSYSTEM_NAME}_freerdp_${STATIC_MODULE_CHANNEL}_client_subsystem_entry")
Packit 1fb8d4
		endif()
Packit 1fb8d4
		set(SUBSYSTEM_TABLE "${SUBSYSTEM_TABLE}\n\t{ \"${STATIC_SUBSYSTEM_NAME}\", \"${STATIC_SUBSYSTEM_TYPE}\", ${STATIC_SUBSYSTEM_ENTRY} },")
Packit 1fb8d4
		set(SUBSYSTEM_IMPORT "extern void ${STATIC_SUBSYSTEM_ENTRY}(void);")
Packit 1fb8d4
		set(CLIENT_STATIC_SUBSYSTEM_IMPORTS "${CLIENT_STATIC_SUBSYSTEM_IMPORTS}\n${SUBSYSTEM_IMPORT}")
Packit 1fb8d4
	endforeach()
Packit 1fb8d4
	set(SUBSYSTEM_TABLE "${SUBSYSTEM_TABLE}\n\t{ NULL, NULL, NULL }\n};")
Packit 1fb8d4
	set(CLIENT_STATIC_SUBSYSTEM_TABLES "${CLIENT_STATIC_SUBSYSTEM_TABLES}\n${SUBSYSTEM_TABLE}")
Packit 1fb8d4
	set(ENTRY_POINT_NAME "${STATIC_MODULE_CHANNEL}_${${STATIC_MODULE}_CLIENT_ENTRY}")
Packit 1fb8d4
	set(CLIENT_STATIC_ADDIN_TABLE "${CLIENT_STATIC_ADDIN_TABLE}\n\t{ \"${STATIC_MODULE_CHANNEL}\", (static_addin_fkt)${ENTRY_POINT_NAME}, ${SUBSYSTEM_TABLE_NAME} },")
Packit 1fb8d4
endforeach()
Packit 1fb8d4
set(CLIENT_STATIC_ADDIN_TABLE "${CLIENT_STATIC_ADDIN_TABLE}\n\t{ NULL, NULL, NULL }\n};")
Packit 1fb8d4
Packit 1fb8d4
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tables.c.in ${CMAKE_CURRENT_BINARY_DIR}/tables.c)
Packit 1fb8d4
Packit 1fb8d4
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp winpr)
Packit 1fb8d4
Packit 1fb8d4
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} PARENT_SCOPE)
Packit 1fb8d4
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)