Skip to content

Commit

Permalink
channels: refactoring of channels cmake scripts with macros
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed Oct 17, 2012
1 parent c82ad75 commit 81e4857
Show file tree
Hide file tree
Showing 48 changed files with 253 additions and 245 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ if(CMAKE_COMPILER_IS_GNUCC)
if(Wno-unused-but-set-variable)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable")
endif()
CHECK_C_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarations)
if(Wno-deprecated-declarations)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
Expand Down Expand Up @@ -154,7 +158,7 @@ if(ANDROID)
set(WITH_X11 OFF)
set(WITH_CUPS OFF)
set(WITH_ALSA OFF)
set(WITH_PULSEAUDIO OFF)
set(WITH_PULSE OFF)
set(WITH_FFMPEG OFF)
set(WITH_GSTREAMER OFF)
set(WITH_PCSC OFF)
Expand Down Expand Up @@ -194,10 +198,11 @@ set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/freerdp")
set(FREERDP_KEYMAP_PATH "${FREERDP_DATA_PATH}/keymaps")

# Path to put plugins

if(WIN32)
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}")
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}")
else()
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp")
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/freerdp")
endif()

set(FREERDP_CLIENT_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/client")
Expand Down Expand Up @@ -302,5 +307,8 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${FREERDP_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${FREERDP_VERSION_REVISION})

set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")

include(CPack)

39 changes: 39 additions & 0 deletions channels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,45 @@

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

macro(define_channel _channel_name)
set(CHANNEL_NAME ${_channel_name})
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
endmacro(define_channel)

macro(define_channel_client _channel_name)
set(CHANNEL_NAME ${_channel_name})
set(MODULE_NAME "${CHANNEL_NAME}-client")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX)
endmacro(define_channel_client)

macro(define_channel_server _channel_name)
set(CHANNEL_NAME ${_channel_name})
set(MODULE_NAME "${CHANNEL_NAME}-server")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" MODULE_PREFIX)
endmacro(define_channel_server)

macro(define_channel_client_subsystem _channel_name _subsystem _type)
set(CHANNEL_NAME ${_channel_name})
set(CHANNEL_SUBSYSTEM ${_subsystem})
string(LENGTH "${_type}" _type_length)
if(_type_length GREATER 0)
set(SUBSYSTEM_TYPE ${_type})
set(MODULE_NAME "${CHANNEL_NAME}-client-${CHANNEL_SUBSYSTEM}-${SUBSYSTEM_TYPE}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT_${CHANNEL_SUBSYSTEM}-${SUBSYSTEM_TYPE}" MODULE_PREFIX)
else()
set(MODULE_NAME "${CHANNEL_NAME}-client-${CHANNEL_SUBSYSTEM}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT_${CHANNEL_SUBSYSTEM}" MODULE_PREFIX)
endif()
endmacro(define_channel_client_subsystem)

macro(define_channel_server_subsystem _channel_name _subsystem _type)
set(CHANNEL_NAME ${_channel_name})
set(CHANNEL_SUBSYSTEM ${_subsystem})
set(MODULE_NAME "${CHANNEL_NAME}-server-${CHANNEL_SUBSYSTEM}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_server_${CHANNEL_SUBSYSTEM}" MODULE_PREFIX)
endmacro(define_channel_server_subsystem)

macro(add_channel_client _channel_prefix _channel_name)
add_subdirectory(client)
if(${_channel_prefix}_CLIENT_STATIC)
Expand Down
4 changes: 1 addition & 3 deletions channels/audin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "audin")
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
define_channel("audin")

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
Expand Down
6 changes: 2 additions & 4 deletions channels/audin/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "audin")
set(MODULE_NAME "${CHANNEL_NAME}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX)
define_channel_client("audin")

set(${MODULE_PREFIX}_SRCS
audin_main.c
Expand Down Expand Up @@ -46,6 +44,6 @@ if(WITH_ALSA)
add_subdirectory(alsa)
endif()

if(WITH_PULSEAUDIO)
if(WITH_PULSE)
add_subdirectory(pulse)
endif()
28 changes: 15 additions & 13 deletions channels/audin/client/alsa/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 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.
Expand All @@ -17,21 +15,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(AUDIN_ALSA_SRCS
define_channel_client_subsystem("audin" "alsa" "")

set(${MODULE_PREFIX}_SRCS
audin_alsa.c)

include_directories(..)
include_directories(${ALSA_INCLUDE_DIRS})

add_library(audin_alsa ${AUDIN_ALSA_SRCS})
set_target_properties(audin_alsa PROPERTIES PREFIX "")
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})

set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")

set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-utils)

if(MONOLITHIC_BUILD)
target_link_libraries(audin_alsa freerdp)
else()
target_link_libraries(audin_alsa freerdp-utils)
endif()
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${ALSA_LIBRARIES})

target_link_libraries(audin_alsa ${ALSA_LIBRARIES})
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})

install(TARGETS audin_alsa DESTINATION ${FREERDP_PLUGIN_PATH})
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
32 changes: 16 additions & 16 deletions channels/audin/client/pulse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 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.
Expand All @@ -17,23 +15,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(AUDIN_PULSE_SRCS
audin_pulse.c
)
define_channel_client_subsystem("audin" "pulse" "")

set(${MODULE_PREFIX}_SRCS
audin_pulse.c)

include_directories(..)
include_directories(${PULSEAUDIO_INCLUDE_DIR})
include_directories(${PULSE_INCLUDE_DIR})

add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})

add_library(audin_pulse ${AUDIN_PULSE_SRCS})
set_target_properties(audin_pulse PROPERTIES PREFIX "")
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")

if(MONOLITHIC_BUILD)
target_link_libraries(audin_pulse freerdp)
else()
target_link_libraries(audin_pulse freerdp-utils)
endif()
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-utils)

target_link_libraries(audin_pulse ${PULSEAUDIO_LIBRARY})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${PULSE_LIBRARY})

install(TARGETS audin_pulse DESTINATION ${FREERDP_PLUGIN_PATH})
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})

install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
4 changes: 1 addition & 3 deletions channels/audin/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "audin")
set(MODULE_NAME "${CHANNEL_NAME}-server")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" MODULE_PREFIX)
define_channel_server("audin")

set(${MODULE_PREFIX}_SRCS
audin.c)
Expand Down
4 changes: 2 additions & 2 deletions channels/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})

if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL ${STATIC_ENTRY})
set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME})
set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_CLIENT_CHANNEL})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${STATIC_MODULE_NAME})

set(ENTRY_POINT_NAME "${${STATIC_MODULE}_CLIENT_NAME}_${${STATIC_MODULE}_CLIENT_ENTRY}")
set(ENTRY_POINT_NAME "${STATIC_MODULE_CHANNEL}_${${STATIC_MODULE}_CLIENT_ENTRY}")
set(ENTRY_POINT_IMPORT "extern void ${ENTRY_POINT_NAME}();")
set(${STATIC_ENTRY}_IMPORTS "${${STATIC_ENTRY}_IMPORTS}\n${ENTRY_POINT_IMPORT}")
set(${STATIC_ENTRY}_TABLE "${${STATIC_ENTRY}_TABLE}\n\t{ \"${STATIC_MODULE_NAME}\", ${ENTRY_POINT_NAME} },")
Expand Down Expand Up @@ -75,7 +76,6 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MODULES winpr-crt winpr-synch winpr-interlocked)

target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})

set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Client")

4 changes: 1 addition & 3 deletions channels/cliprdr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "cliprdr")
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
define_channel("cliprdr")

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
Expand Down
4 changes: 1 addition & 3 deletions channels/cliprdr/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "cliprdr")
set(MODULE_NAME "${CHANNEL_NAME}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX)
define_channel_client("cliprdr")

set(${MODULE_PREFIX}_SRCS
cliprdr_constants.h
Expand Down
4 changes: 1 addition & 3 deletions channels/disk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "disk")
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
define_channel("disk")

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
Expand Down
4 changes: 1 addition & 3 deletions channels/disk/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "disk")
set(MODULE_NAME "${CHANNEL_NAME}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX)
define_channel_client("disk")

set(${MODULE_PREFIX}_SRCS
disk_file.c
Expand Down
4 changes: 1 addition & 3 deletions channels/drdynvc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "drdynvc")
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
define_channel("drdynvc")

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
Expand Down
4 changes: 1 addition & 3 deletions channels/drdynvc/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "drdynvc")
set(MODULE_NAME "${CHANNEL_NAME}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX)
define_channel_client("drdynvc")

set(${MODULE_PREFIX}_SRCS
drdynvc_main.c
Expand Down
4 changes: 1 addition & 3 deletions channels/parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "parallel")
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
define_channel("parallel")

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
Expand Down
4 changes: 1 addition & 3 deletions channels/parallel/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "parallel")
set(MODULE_NAME "${CHANNEL_NAME}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX)
define_channel_client("parallel")

set(${MODULE_PREFIX}_SRCS
parallel_main.c)
Expand Down
4 changes: 1 addition & 3 deletions channels/printer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "printer")
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
define_channel("printer")

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
Expand Down
4 changes: 1 addition & 3 deletions channels/printer/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "printer")
set(MODULE_NAME "${CHANNEL_NAME}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX)
define_channel_client("printer")

set(${MODULE_PREFIX}_SRCS
printer_main.c
Expand Down
4 changes: 1 addition & 3 deletions channels/rail/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "rail")
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
define_channel("rail")

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
Expand Down
6 changes: 2 additions & 4 deletions channels/rail/client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP cmake build script
#
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 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.
Expand All @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "rail")
set(MODULE_NAME "${CHANNEL_NAME}")
string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX)
define_channel_client("rail")

set(${MODULE_PREFIX}_SRCS
rail_main.c
Expand Down
4 changes: 1 addition & 3 deletions channels/rdpdr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CHANNEL_NAME "rdpdr")
set(MODULE_NAME ${CHANNEL_NAME})
string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX)
define_channel("rdpdr")

if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
Expand Down
Loading

0 comments on commit 81e4857

Please sign in to comment.