From cb8c0ef3c8b1c4bcd7c0aec14a4231b08392834b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 20 Sep 2012 23:39:27 -0400 Subject: [PATCH] channels: refactoring of cmake build scripts --- channels/CMakeLists.txt | 23 ++++++----- channels/cliprdr/ChannelOptions.cmake | 10 +++++ channels/drdynvc/ChannelOptions.cmake | 9 +++++ channels/rail/ChannelOptions.cmake | 9 +++++ channels/rdpdbg/CMakeLists.txt | 33 ---------------- channels/rdpdbg/rdpdbg_main.c | 74 ----------------------------------- channels/rdpdr/ChannelOptions.cmake | 14 +++++++ channels/rdpsnd/ChannelOptions.cmake | 12 ++++++ channels/skel/ChannelOptions.cmake | 8 ++++ 9 files changed, 76 insertions(+), 116 deletions(-) create mode 100644 channels/cliprdr/ChannelOptions.cmake create mode 100644 channels/drdynvc/ChannelOptions.cmake create mode 100644 channels/rail/ChannelOptions.cmake delete mode 100644 channels/rdpdbg/CMakeLists.txt delete mode 100644 channels/rdpdbg/rdpdbg_main.c create mode 100644 channels/rdpdr/ChannelOptions.cmake create mode 100644 channels/rdpsnd/ChannelOptions.cmake create mode 100644 channels/skel/ChannelOptions.cmake diff --git a/channels/CMakeLists.txt b/channels/CMakeLists.txt index 1951fd8..06419e8 100644 --- a/channels/CMakeLists.txt +++ b/channels/CMakeLists.txt @@ -17,13 +17,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_subdirectory(cliprdr) -add_subdirectory(drdynvc) -add_subdirectory(rail) -add_subdirectory(rdpdbg) -add_subdirectory(skel) +set(FILENAME "ChannelOptions.cmake") +file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") + +foreach(FILEPATH ${FILEPATHS}) + if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}") + string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" DIR ${FILEPATH}) + set(CHANNEL_OPTION) + include(${FILEPATH}) + if(${CHANNEL_OPTION}) + message(STATUS "Adding ${CHANNEL_TYPE} channel \"${CHANNEL_SHORT_NAME}\": ${CHANNEL_LONG_NAME} (${CHANNEL_SPECIFICATIONS})") + add_subdirectory(${DIR}) + endif() + endif() +endforeach(FILEPATH) -if(NOT WIN32) - add_subdirectory(rdpdr) - add_subdirectory(rdpsnd) -endif() diff --git a/channels/cliprdr/ChannelOptions.cmake b/channels/cliprdr/ChannelOptions.cmake new file mode 100644 index 0000000..1cbbb61 --- /dev/null +++ b/channels/cliprdr/ChannelOptions.cmake @@ -0,0 +1,10 @@ + +set(CHANNEL_TYPE "static") +set(CHANNEL_SHORT_NAME "cliprdr") +set(CHANNEL_LONG_NAME "Clipboard Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPECLIP]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + + diff --git a/channels/drdynvc/ChannelOptions.cmake b/channels/drdynvc/ChannelOptions.cmake new file mode 100644 index 0000000..cf67ef5 --- /dev/null +++ b/channels/drdynvc/ChannelOptions.cmake @@ -0,0 +1,9 @@ + +set(CHANNEL_TYPE "static") +set(CHANNEL_SHORT_NAME "drdynvc") +set(CHANNEL_LONG_NAME "Dynamic Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPEDYC]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + diff --git a/channels/rail/ChannelOptions.cmake b/channels/rail/ChannelOptions.cmake new file mode 100644 index 0000000..786cbfc --- /dev/null +++ b/channels/rail/ChannelOptions.cmake @@ -0,0 +1,9 @@ + +set(CHANNEL_TYPE "static") +set(CHANNEL_SHORT_NAME "rail") +set(CHANNEL_LONG_NAME "Remote Programs Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPERP]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + diff --git a/channels/rdpdbg/CMakeLists.txt b/channels/rdpdbg/CMakeLists.txt deleted file mode 100644 index 7387269..0000000 --- a/channels/rdpdbg/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# FreeRDP: A Remote Desktop Protocol Client -# FreeRDP cmake build script -# -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau -# -# 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. - -set(RDPDBG_SRCS - rdpdbg_main.c -) - -add_library(rdpdbg ${RDPDBG_SRCS}) -set_target_properties(rdpdbg PROPERTIES PREFIX "") - -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(rdpdbg freerdp) -else() - target_link_libraries(rdpdbg freerdp-utils) -endif() - -install(TARGETS rdpdbg DESTINATION ${FREERDP_PLUGIN_PATH}) diff --git a/channels/rdpdbg/rdpdbg_main.c b/channels/rdpdbg/rdpdbg_main.c deleted file mode 100644 index a1cdc21..0000000 --- a/channels/rdpdbg/rdpdbg_main.c +++ /dev/null @@ -1,74 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol client. - * Debugging Virtual Channel - * - * Copyright 2010-2011 Marc-Andre Moreau - * Copyright 2011 Vic Lee - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include -#include -#include - -typedef struct rdpdbg_plugin rdpdbgPlugin; -struct rdpdbg_plugin -{ - rdpSvcPlugin plugin; -}; - -static void rdpdbg_process_connect(rdpSvcPlugin* plugin) -{ - DEBUG_WARN("connecting"); -} - -static void rdpdbg_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) -{ - STREAM* data_out; - - DEBUG_WARN("size %d", stream_get_size(data_in)); - stream_free(data_in); - - data_out = stream_new(8); - stream_write(data_out, "senddata", 8); - svc_plugin_send(plugin, data_out); -} - -static void rdpdbg_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) -{ - DEBUG_WARN("event_type %d", event->event_type); - freerdp_event_free(event); - - event = freerdp_event_new(RDP_EVENT_CLASS_DEBUG, 0, NULL, NULL); - svc_plugin_send_event(plugin, event); -} - -static void rdpdbg_process_terminate(rdpSvcPlugin* plugin) -{ - DEBUG_WARN("terminating"); - xfree(plugin); -} - -DEFINE_SVC_PLUGIN(rdpdbg, "rdpdbg", - CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | - CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL) diff --git a/channels/rdpdr/ChannelOptions.cmake b/channels/rdpdr/ChannelOptions.cmake new file mode 100644 index 0000000..85e3f63 --- /dev/null +++ b/channels/rdpdr/ChannelOptions.cmake @@ -0,0 +1,14 @@ + +set(CHANNEL_TYPE "static") +set(CHANNEL_SHORT_NAME "rdpdr") +set(CHANNEL_LONG_NAME "Device Redirection Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) + +if(WIN32) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +else() + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +endif() + diff --git a/channels/rdpsnd/ChannelOptions.cmake b/channels/rdpsnd/ChannelOptions.cmake new file mode 100644 index 0000000..fb8b2ef --- /dev/null +++ b/channels/rdpsnd/ChannelOptions.cmake @@ -0,0 +1,12 @@ + +set(CHANNEL_TYPE "static") +set(CHANNEL_SHORT_NAME "rdpsnd") +set(CHANNEL_LONG_NAME "Audio Output Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPEA]") + +if(WIN32) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +else() + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +endif() + diff --git a/channels/skel/ChannelOptions.cmake b/channels/skel/ChannelOptions.cmake new file mode 100644 index 0000000..9125cb2 --- /dev/null +++ b/channels/skel/ChannelOptions.cmake @@ -0,0 +1,8 @@ + +set(CHANNEL_TYPE "static") +set(CHANNEL_SHORT_NAME "skel") +set(CHANNEL_LONG_NAME "Skeleton Code Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "") + +option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) + -- 2.7.4