diff --git a/channels/CMakeLists.txt b/channels/CMakeLists.txt index 49b6df28d..102161138 100644 --- a/channels/CMakeLists.txt +++ b/channels/CMakeLists.txt @@ -17,6 +17,29 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) +include(CMakeParseArguments) + +macro(define_channel_options) + set(PREFIX "CHANNEL") + + cmake_parse_arguments(${PREFIX} + "" + "NAME;TYPE;DESCRIPTION;SPECIFICATIONS;DEFAULT" + "" + ${ARGN}) + + string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) + set(CHANNEL_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel") + option(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT}) + +endmacro(define_channel_options) + +macro(define_channel_client_options _channel_client_default) + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_CLIENT_OPTION) + set(CHANNEL_CLIENT_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel client") + option(${CHANNEL_CLIENT_OPTION} "${CHANNEL_CLIENT_OPTION_DOC}" ${_channel_client_default}) +endmacro(define_channel_client_options) + macro(define_channel _channel_name) set(CHANNEL_NAME ${_channel_name}) set(MODULE_NAME ${CHANNEL_NAME}) @@ -123,7 +146,7 @@ foreach(FILEPATH ${FILEPATHS}) set(CHANNEL_OPTION) include(${FILEPATH}) if(${CHANNEL_OPTION}) - message(STATUS "Adding ${CHANNEL_TYPE} channel \"${CHANNEL_SHORT_NAME}\": ${CHANNEL_LONG_NAME}") + message(STATUS "Adding ${CHANNEL_TYPE} channel \"${CHANNEL_NAME}\": ${CHANNEL_DESCRIPTION}") add_subdirectory(${DIR}) endif() endif() diff --git a/channels/audin/ChannelOptions.cmake b/channels/audin/ChannelOptions.cmake index 71cc38a8d..8e0a9fbcb 100644 --- a/channels/audin/ChannelOptions.cmake +++ b/channels/audin/ChannelOptions.cmake @@ -1,10 +1,8 @@ -set(CHANNEL_TYPE "dynamic") -set(CHANNEL_SHORT_NAME "audin") -set(CHANNEL_LONG_NAME "Audio Input Redirection Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPEAI]") - -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) -option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +set(OPTION_DEFAULT ON) +define_channel_options(NAME "audin" TYPE "dynamic" + DESCRIPTION "Audio Input Redirection Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPEAI]" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/cliprdr/ChannelOptions.cmake b/channels/cliprdr/ChannelOptions.cmake index 1cbbb619b..f4ad8a0b9 100644 --- a/channels/cliprdr/ChannelOptions.cmake +++ b/channels/cliprdr/ChannelOptions.cmake @@ -1,10 +1,8 @@ -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) +set(OPTION_DEFAULT ON) +define_channel_options(NAME "cliprdr" TYPE "static" + DESCRIPTION "Clipboard Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPECLIP]" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/disk/ChannelOptions.cmake b/channels/disk/ChannelOptions.cmake index 353fd5428..de9fe0062 100644 --- a/channels/disk/ChannelOptions.cmake +++ b/channels/disk/ChannelOptions.cmake @@ -1,15 +1,12 @@ -set(CHANNEL_TYPE "device") -set(CHANNEL_SHORT_NAME "disk") -set(CHANNEL_LONG_NAME "Disk Redirection Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPEFS]") - -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +set(OPTION_DEFAULT ON) if(ANDROID) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) -else() - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + set(OPTION_DEFAULT OFF) endif() +define_channel_options(NAME "disk" TYPE "device" + DESCRIPTION "Disk Redirection Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPEFS]" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/drdynvc/ChannelOptions.cmake b/channels/drdynvc/ChannelOptions.cmake index cf67ef513..243b2e15d 100644 --- a/channels/drdynvc/ChannelOptions.cmake +++ b/channels/drdynvc/ChannelOptions.cmake @@ -1,9 +1,8 @@ -set(CHANNEL_TYPE "static") -set(CHANNEL_SHORT_NAME "drdynvc") -set(CHANNEL_LONG_NAME "Dynamic Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPEDYC]") +set(OPTION_DEFAULT ON) -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) -option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +define_channel_options(NAME "drdynvc" TYPE "static" + DESCRIPTION "Dynamic Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPEDYC]" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/parallel/ChannelOptions.cmake b/channels/parallel/ChannelOptions.cmake index 3f6e7abaf..23d692663 100644 --- a/channels/parallel/ChannelOptions.cmake +++ b/channels/parallel/ChannelOptions.cmake @@ -1,14 +1,12 @@ -set(CHANNEL_TYPE "device") -set(CHANNEL_SHORT_NAME "parallel") -set(CHANNEL_LONG_NAME "Parallel Port Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPESP]") - -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +set(OPTION_DEFAULT ON) if(WIN32) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) -else() - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + set(OPTION_DEFAULT OFF) endif() +define_channel_options(NAME "parallel" TYPE "device" + DESCRIPTION "Parallel Port Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPESP]" + DEFAULT ${OPTION_DEFAULT}) + diff --git a/channels/printer/ChannelOptions.cmake b/channels/printer/ChannelOptions.cmake index 16db8e2a2..808322084 100644 --- a/channels/printer/ChannelOptions.cmake +++ b/channels/printer/ChannelOptions.cmake @@ -1,16 +1,16 @@ -set(CHANNEL_TYPE "device") -set(CHANNEL_SHORT_NAME "printer") -set(CHANNEL_LONG_NAME "Print Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPEPC]") - -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +set(OPTION_DEFAULT ON) if(WIN32) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + set(OPTION_DEFAULT ON) elseif(WITH_CUPS) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + set(OPTION_DEFAULT ON) else() - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) + set(OPTION_DEFAULT OFF) endif() +define_channel_options(NAME "printer" TYPE "device" + DESCRIPTION "Print Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPEPC]" + DEFAULT ${OPTION_DEFAULT}) + diff --git a/channels/rail/ChannelOptions.cmake b/channels/rail/ChannelOptions.cmake index 786cbfc17..5df7a64a8 100644 --- a/channels/rail/ChannelOptions.cmake +++ b/channels/rail/ChannelOptions.cmake @@ -1,9 +1,8 @@ -set(CHANNEL_TYPE "static") -set(CHANNEL_SHORT_NAME "rail") -set(CHANNEL_LONG_NAME "Remote Programs Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPERP]") +set(OPTION_DEFAULT ON) -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) -option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +define_channel_options(NAME "rail" TYPE "static" + DESCRIPTION "Remote Programs Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPERP]" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/rdpdr/ChannelOptions.cmake b/channels/rdpdr/ChannelOptions.cmake index 6ae191b62..fb7bc0e3e 100644 --- a/channels/rdpdr/ChannelOptions.cmake +++ b/channels/rdpdr/ChannelOptions.cmake @@ -1,10 +1,8 @@ -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]") +set(OPTION_DEFAULT ON) -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) - -option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +define_channel_options(NAME "rdpdr" TYPE "static" + DESCRIPTION "Device Redirection Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/rdpsnd/ChannelOptions.cmake b/channels/rdpsnd/ChannelOptions.cmake index e22fe2f44..0ef94be84 100644 --- a/channels/rdpsnd/ChannelOptions.cmake +++ b/channels/rdpsnd/ChannelOptions.cmake @@ -1,10 +1,8 @@ -set(CHANNEL_TYPE "static") -set(CHANNEL_SHORT_NAME "rdpsnd") -set(CHANNEL_LONG_NAME "Audio Output Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPEA]") +set(OPTION_DEFAULT ON) -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) - -option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +define_channel_options(NAME "rdpsnd" TYPE "static" + DESCRIPTION "Audio Output Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPEA]" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/sample/ChannelOptions.cmake b/channels/sample/ChannelOptions.cmake index 33e50673e..032423b30 100644 --- a/channels/sample/ChannelOptions.cmake +++ b/channels/sample/ChannelOptions.cmake @@ -1,15 +1,12 @@ -set(CHANNEL_TYPE "static") -set(CHANNEL_SHORT_NAME "sample") -set(CHANNEL_LONG_NAME "Sample Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "") - -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +set(OPTION_DEFAULT OFF) if(WITH_SAMPLE) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) -else() - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) + set(OPTION_DEFAULT ON) endif() +define_channel_options(NAME "sample" TYPE "static" + DESCRIPTION "Sample Virtual Channel Extension" + SPECIFICATIONS "" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/serial/ChannelOptions.cmake b/channels/serial/ChannelOptions.cmake index 232f123db..ff72beb44 100644 --- a/channels/serial/ChannelOptions.cmake +++ b/channels/serial/ChannelOptions.cmake @@ -1,14 +1,12 @@ -set(CHANNEL_TYPE "device") -set(CHANNEL_SHORT_NAME "serial") -set(CHANNEL_LONG_NAME "Serial Port Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPESP]") - -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +set(OPTION_DEFAULT ON) if(WIN32) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) -else() - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + set(OPTION_DEFAULT OFF) endif() +define_channel_options(NAME "serial" TYPE "device" + DESCRIPTION "Serial Port Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPESP]" + DEFAULT ${OPTION_DEFAULT}) + diff --git a/channels/smartcard/ChannelOptions.cmake b/channels/smartcard/ChannelOptions.cmake index e06f9e13e..2c05968aa 100644 --- a/channels/smartcard/ChannelOptions.cmake +++ b/channels/smartcard/ChannelOptions.cmake @@ -1,16 +1,12 @@ -set(CHANNEL_TYPE "device") -set(CHANNEL_SHORT_NAME "smartcard") -set(CHANNEL_LONG_NAME "Smart Card Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPESC]") +set(OPTION_DEFAULT OFF) -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) - -if(WIN32) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) -elseif(WITH_PCSC) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) -else() - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +if(WITH_PCSC) + set(OPTION_DEFAULT ON) endif() +define_channel_options(NAME "smartcard" TYPE "device" + DESCRIPTION "Smart Card Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPESC]" + DEFAULT ${OPTION_DEFAULT}) + diff --git a/channels/tsmf/ChannelOptions.cmake b/channels/tsmf/ChannelOptions.cmake index 0e79c69f5..1ac5e942c 100644 --- a/channels/tsmf/ChannelOptions.cmake +++ b/channels/tsmf/ChannelOptions.cmake @@ -1,15 +1,12 @@ -set(CHANNEL_TYPE "dynamic") -set(CHANNEL_SHORT_NAME "tsmf") -set(CHANNEL_LONG_NAME "Video Redirection Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPEV]") - -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) +set(OPTION_DEFAULT ON) if(WIN32) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) -else() - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + set(OPTION_DEFAULT OFF) endif() +define_channel_options(NAME "tsmf" TYPE "dynamic" + DESCRIPTION "Video Redirection Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPEV]" + DEFAULT ${OPTION_DEFAULT}) diff --git a/channels/urbdrc/ChannelOptions.cmake b/channels/urbdrc/ChannelOptions.cmake index dbf01a2dc..9d4dc0729 100644 --- a/channels/urbdrc/ChannelOptions.cmake +++ b/channels/urbdrc/ChannelOptions.cmake @@ -1,11 +1,8 @@ -set(CHANNEL_TYPE "dynamic") -set(CHANNEL_SHORT_NAME "urbdrc") -set(CHANNEL_LONG_NAME "USB Devices Virtual Channel Extension") -set(CHANNEL_SPECIFICATIONS "[MS-RDPEUSB]") - -string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) - -option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +set(OPTION_DEFAULT OFF) +define_channel_options(NAME "urbdrc" TYPE "dynamic" + DESCRIPTION "USB Devices Virtual Channel Extension" + SPECIFICATIONS "[MS-RDPEUSB]" + DEFAULT ${OPTION_DEFAULT})