cmake: refactoring of channel options with macros

This commit is contained in:
Marc-André Moreau 2012-10-19 15:27:55 -04:00
parent 210ba6ac8c
commit b5989f7299
15 changed files with 108 additions and 115 deletions

View File

@ -17,6 +17,29 @@
set(CMAKE_POSITION_INDEPENDENT_CODE ON) 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) macro(define_channel _channel_name)
set(CHANNEL_NAME ${_channel_name}) set(CHANNEL_NAME ${_channel_name})
set(MODULE_NAME ${CHANNEL_NAME}) set(MODULE_NAME ${CHANNEL_NAME})
@ -123,7 +146,7 @@ foreach(FILEPATH ${FILEPATHS})
set(CHANNEL_OPTION) set(CHANNEL_OPTION)
include(${FILEPATH}) include(${FILEPATH})
if(${CHANNEL_OPTION}) 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}) add_subdirectory(${DIR})
endif() endif()
endif() endif()

View File

@ -1,10 +1,8 @@
set(CHANNEL_TYPE "dynamic") set(OPTION_DEFAULT ON)
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)
define_channel_options(NAME "audin" TYPE "dynamic"
DESCRIPTION "Audio Input Redirection Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEAI]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,10 +1,8 @@
set(CHANNEL_TYPE "static") set(OPTION_DEFAULT ON)
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)
define_channel_options(NAME "cliprdr" TYPE "static"
DESCRIPTION "Clipboard Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPECLIP]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,15 +1,12 @@
set(CHANNEL_TYPE "device") set(OPTION_DEFAULT ON)
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)
if(ANDROID) if(ANDROID)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) set(OPTION_DEFAULT OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif() endif()
define_channel_options(NAME "disk" TYPE "device"
DESCRIPTION "Disk Redirection Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEFS]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,9 +1,8 @@
set(CHANNEL_TYPE "static") set(OPTION_DEFAULT ON)
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) define_channel_options(NAME "drdynvc" TYPE "static"
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) DESCRIPTION "Dynamic Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEDYC]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,14 +1,12 @@
set(CHANNEL_TYPE "device") set(OPTION_DEFAULT ON)
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)
if(WIN32) if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) set(OPTION_DEFAULT OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif() endif()
define_channel_options(NAME "parallel" TYPE "device"
DESCRIPTION "Parallel Port Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPESP]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,16 +1,16 @@
set(CHANNEL_TYPE "device") set(OPTION_DEFAULT ON)
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)
if(WIN32) if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) set(OPTION_DEFAULT ON)
elseif(WITH_CUPS) elseif(WITH_CUPS)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) set(OPTION_DEFAULT ON)
else() else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) set(OPTION_DEFAULT OFF)
endif() endif()
define_channel_options(NAME "printer" TYPE "device"
DESCRIPTION "Print Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEPC]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,9 +1,8 @@
set(CHANNEL_TYPE "static") set(OPTION_DEFAULT ON)
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) define_channel_options(NAME "rail" TYPE "static"
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) DESCRIPTION "Remote Programs Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPERP]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,10 +1,8 @@
set(CHANNEL_TYPE "static") set(OPTION_DEFAULT ON)
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) define_channel_options(NAME "rdpdr" TYPE "static"
DESCRIPTION "Device Redirection Virtual Channel Extension"
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,10 +1,8 @@
set(CHANNEL_TYPE "static") set(OPTION_DEFAULT ON)
set(CHANNEL_SHORT_NAME "rdpsnd")
set(CHANNEL_LONG_NAME "Audio Output Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEA]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) define_channel_options(NAME "rdpsnd" TYPE "static"
DESCRIPTION "Audio Output Virtual Channel Extension"
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) SPECIFICATIONS "[MS-RDPEA]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,15 +1,12 @@
set(CHANNEL_TYPE "static") set(OPTION_DEFAULT OFF)
set(CHANNEL_SHORT_NAME "sample")
set(CHANNEL_LONG_NAME "Sample Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
if(WITH_SAMPLE) if(WITH_SAMPLE)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) set(OPTION_DEFAULT ON)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)
endif() endif()
define_channel_options(NAME "sample" TYPE "static"
DESCRIPTION "Sample Virtual Channel Extension"
SPECIFICATIONS ""
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,14 +1,12 @@
set(CHANNEL_TYPE "device") set(OPTION_DEFAULT ON)
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)
if(WIN32) if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) set(OPTION_DEFAULT OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif() endif()
define_channel_options(NAME "serial" TYPE "device"
DESCRIPTION "Serial Port Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPESP]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,16 +1,12 @@
set(CHANNEL_TYPE "device") set(OPTION_DEFAULT OFF)
set(CHANNEL_SHORT_NAME "smartcard")
set(CHANNEL_LONG_NAME "Smart Card Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPESC]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) if(WITH_PCSC)
set(OPTION_DEFAULT ON)
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)
endif() endif()
define_channel_options(NAME "smartcard" TYPE "device"
DESCRIPTION "Smart Card Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPESC]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,15 +1,12 @@
set(CHANNEL_TYPE "dynamic") set(OPTION_DEFAULT ON)
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)
if(WIN32) if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) set(OPTION_DEFAULT OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif() endif()
define_channel_options(NAME "tsmf" TYPE "dynamic"
DESCRIPTION "Video Redirection Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEV]"
DEFAULT ${OPTION_DEFAULT})

View File

@ -1,11 +1,8 @@
set(CHANNEL_TYPE "dynamic") set(OPTION_DEFAULT OFF)
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)
define_channel_options(NAME "urbdrc" TYPE "dynamic"
DESCRIPTION "USB Devices Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEUSB]"
DEFAULT ${OPTION_DEFAULT})