From a9d4164a2336dbfd2e11cbf96560cd6321e8467d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Wed, 3 Oct 2012 19:29:28 -0400 Subject: [PATCH 1/7] freerdp: improve scripts for complex modules with monolithic build option --- libfreerdp/CMakeLists.txt | 38 ++++++++-------- winpr/libwinpr/CMakeLists.txt | 86 ++++++++++++++--------------------- 2 files changed, 54 insertions(+), 70 deletions(-) diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index 20a46bc9b..7ffee7809 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -19,28 +19,28 @@ if(WITH_MONOLITHIC_BUILD) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -add_subdirectory(utils) -add_subdirectory(gdi) -add_subdirectory(rail) -add_subdirectory(cache) -add_subdirectory(codec) -add_subdirectory(crypto) -add_subdirectory(channels) -add_subdirectory(locale) -add_subdirectory(core) +set(FREERDP_MODULES + utils + gdi + rail + cache + codec + crypto + channels + locale + core) + +foreach(FREERDP_MODULE ${FREERDP_MODULES}) + add_subdirectory(${FREERDP_MODULE}) +endforeach() if(WITH_MONOLITHIC_BUILD) - add_library(freerdp - $ - $ - $ - $ - $ - $ - $ - $ - $) + foreach(FREERDP_MODULE ${FREERDP_MODULES}) + set(FREERDP_OBJECTS ${FREERDP_OBJECTS} "$") + endforeach() + + add_library(freerdp ${FREERDP_OBJECTS}) set_target_properties(freerdp PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") target_link_libraries(freerdp ${FREERDP_LIBS}) diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index 0dd4aeaf8..9a4d09885 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -25,59 +25,43 @@ if(WITH_MONOLITHIC_BUILD) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -add_subdirectory(crt) -add_subdirectory(utils) -add_subdirectory(heap) -add_subdirectory(path) -add_subdirectory(io) -add_subdirectory(file) -add_subdirectory(error) -add_subdirectory(environment) -add_subdirectory(interlocked) -add_subdirectory(handle) -add_subdirectory(synch) -add_subdirectory(thread) -add_subdirectory(sysinfo) -add_subdirectory(bcrypt) -add_subdirectory(dsparse) -add_subdirectory(asn1) -add_subdirectory(rpc) -add_subdirectory(sspicli) -add_subdirectory(sspi) -add_subdirectory(registry) -add_subdirectory(library) -add_subdirectory(timezone) -add_subdirectory(winsock) -add_subdirectory(winhttp) +set(WINPR_MODULES + crt + utils + heap + path + io + file + error + environment + interlocked + handle + synch + thread + sysinfo + bcrypt + dsparse + asn1 + rpc + sspicli + sspi + registry + library + timezone + winsock) + +foreach(WINPR_MODULE ${WINPR_MODULES}) + add_subdirectory(${WINPR_MODULE}) +endforeach() if(WITH_MONOLITHIC_BUILD) - add_library(winpr - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $) - - set_target_properties(winpr PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") + + foreach(WINPR_MODULE ${WINPR_MODULES}) + set(WINPR_OBJECTS ${WINPR_OBJECTS} "$") + endforeach() + + add_library(winpr ${WINPR_OBJECTS}) + set_target_properties(winpr PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") target_link_libraries(winpr ${WINPR_LIBS}) install(TARGETS winpr DESTINATION ${CMAKE_INSTALL_LIBDIR}) From b15e152011b75a9b7edea73ee9c3f7460a3e54c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Wed, 3 Oct 2012 19:50:48 -0400 Subject: [PATCH 2/7] libwinpr: use ModuleOptions.cmake automatically --- winpr/libwinpr/CMakeLists.txt | 33 +++++++----------------- winpr/libwinpr/utils/ModuleOptions.cmake | 9 +++++++ 2 files changed, 18 insertions(+), 24 deletions(-) create mode 100644 winpr/libwinpr/utils/ModuleOptions.cmake diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index 9a4d09885..3ebf5cb2b 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -25,30 +25,15 @@ if(WITH_MONOLITHIC_BUILD) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -set(WINPR_MODULES - crt - utils - heap - path - io - file - error - environment - interlocked - handle - synch - thread - sysinfo - bcrypt - dsparse - asn1 - rpc - sspicli - sspi - registry - library - timezone - winsock) +set(FILENAME "ModuleOptions.cmake") +file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") + +foreach(FILEPATH ${FILEPATHS}) + if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}") + string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" WINPR_MODULE ${FILEPATH}) + set(WINPR_MODULES ${WINPR_MODULES} ${WINPR_MODULE}) + endif() +endforeach(FILEPATH) foreach(WINPR_MODULE ${WINPR_MODULES}) add_subdirectory(${WINPR_MODULE}) diff --git a/winpr/libwinpr/utils/ModuleOptions.cmake b/winpr/libwinpr/utils/ModuleOptions.cmake new file mode 100644 index 000000000..9e37ca69e --- /dev/null +++ b/winpr/libwinpr/utils/ModuleOptions.cmake @@ -0,0 +1,9 @@ + +set(MINWIN_LAYER "0") +set(MINWIN_GROUP "none") +set(MINWIN_MAJOR_VERSION "0") +set(MINWIN_MINOR_VERSION "0") +set(MINWIN_SHORT_NAME "utils") +set(MINWIN_LONG_NAME "WinPR Utils") +set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") + From e828feccb7b195f3c733b57b14b86a5a030c37d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 4 Oct 2012 09:42:23 -0400 Subject: [PATCH 3/7] cmake: organize solution folders --- CMakeLists.txt | 4 +++- libfreerdp/CMakeLists.txt | 2 +- libfreerdp/cache/CMakeLists.txt | 2 +- libfreerdp/channels/CMakeLists.txt | 2 +- libfreerdp/codec/CMakeLists.txt | 2 +- libfreerdp/core/CMakeLists.txt | 2 +- libfreerdp/crypto/CMakeLists.txt | 2 +- libfreerdp/gdi/CMakeLists.txt | 2 +- libfreerdp/locale/CMakeLists.txt | 2 +- libfreerdp/rail/CMakeLists.txt | 2 +- libfreerdp/utils/CMakeLists.txt | 2 +- winpr/CMakeLists.txt | 2 +- winpr/libwinpr/crt/CMakeLists.txt | 2 +- winpr/libwinpr/heap/CMakeLists.txt | 2 +- winpr/libwinpr/interlocked/CMakeLists.txt | 2 +- winpr/libwinpr/synch/CMakeLists.txt | 2 +- 16 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5eaa9a8d..28074ce7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) + project(FreeRDP C) + set(CMAKE_COLOR_MAKEFILE ON) # Include cmake modules diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index 7ffee7809..513f49398 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -47,4 +47,4 @@ if(WITH_MONOLITHIC_BUILD) install(TARGETS freerdp DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() - +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/cache/CMakeLists.txt b/libfreerdp/cache/CMakeLists.txt index 0cc624659..a3e69b75a 100644 --- a/libfreerdp/cache/CMakeLists.txt +++ b/libfreerdp/cache/CMakeLists.txt @@ -47,4 +47,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/channels/CMakeLists.txt b/libfreerdp/channels/CMakeLists.txt index 9861f10f6..a3777363f 100644 --- a/libfreerdp/channels/CMakeLists.txt +++ b/libfreerdp/channels/CMakeLists.txt @@ -48,4 +48,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/codec/CMakeLists.txt b/libfreerdp/codec/CMakeLists.txt index a404535d6..d0044eed1 100644 --- a/libfreerdp/codec/CMakeLists.txt +++ b/libfreerdp/codec/CMakeLists.txt @@ -99,4 +99,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/core/CMakeLists.txt b/libfreerdp/core/CMakeLists.txt index 14467460a..b05d760fd 100644 --- a/libfreerdp/core/CMakeLists.txt +++ b/libfreerdp/core/CMakeLists.txt @@ -133,4 +133,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/crypto/CMakeLists.txt b/libfreerdp/crypto/CMakeLists.txt index 33f984a63..579e43f10 100644 --- a/libfreerdp/crypto/CMakeLists.txt +++ b/libfreerdp/crypto/CMakeLists.txt @@ -67,4 +67,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/gdi/CMakeLists.txt b/libfreerdp/gdi/CMakeLists.txt index 106fc0f16..ae490cef0 100644 --- a/libfreerdp/gdi/CMakeLists.txt +++ b/libfreerdp/gdi/CMakeLists.txt @@ -59,4 +59,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/locale/CMakeLists.txt b/libfreerdp/locale/CMakeLists.txt index 52e03500e..e8a43db37 100644 --- a/libfreerdp/locale/CMakeLists.txt +++ b/libfreerdp/locale/CMakeLists.txt @@ -89,4 +89,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/rail/CMakeLists.txt b/libfreerdp/rail/CMakeLists.txt index 8f256ed37..da37af51c 100644 --- a/libfreerdp/rail/CMakeLists.txt +++ b/libfreerdp/rail/CMakeLists.txt @@ -42,4 +42,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/utils/CMakeLists.txt b/libfreerdp/utils/CMakeLists.txt index f6138f099..2b70d87b8 100644 --- a/libfreerdp/utils/CMakeLists.txt +++ b/libfreerdp/utils/CMakeLists.txt @@ -86,4 +86,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index 1330d6921..3bb687751 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) project(WinPR C) diff --git a/winpr/libwinpr/crt/CMakeLists.txt b/winpr/libwinpr/crt/CMakeLists.txt index a92a69137..53b01927f 100644 --- a/winpr/libwinpr/crt/CMakeLists.txt +++ b/winpr/libwinpr/crt/CMakeLists.txt @@ -23,7 +23,7 @@ set(${MODULE_PREFIX}_SRCS memory.c string.c) -if(MSVC) +if(MSVC AND (NOT WITH_MONOLITHIC_BUILD)) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() diff --git a/winpr/libwinpr/heap/CMakeLists.txt b/winpr/libwinpr/heap/CMakeLists.txt index ce34c92b3..fcefa4221 100644 --- a/winpr/libwinpr/heap/CMakeLists.txt +++ b/winpr/libwinpr/heap/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_HEAP") set(${MODULE_PREFIX}_SRCS heap.c) -if(MSVC) +if(MSVC AND (NOT WITH_MONOLITHIC_BUILD)) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() diff --git a/winpr/libwinpr/interlocked/CMakeLists.txt b/winpr/libwinpr/interlocked/CMakeLists.txt index b52b16432..ca95e91df 100644 --- a/winpr/libwinpr/interlocked/CMakeLists.txt +++ b/winpr/libwinpr/interlocked/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_INTERLOCKED") set(${MODULE_PREFIX}_SRCS interlocked.c) -if(MSVC) +if(MSVC AND (NOT WITH_MONOLITHIC_BUILD)) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() diff --git a/winpr/libwinpr/synch/CMakeLists.txt b/winpr/libwinpr/synch/CMakeLists.txt index 9ab399b3f..d604bf08f 100644 --- a/winpr/libwinpr/synch/CMakeLists.txt +++ b/winpr/libwinpr/synch/CMakeLists.txt @@ -37,7 +37,7 @@ set(${MODULE_PREFIX}_SRCS timer.c wait.c) -if(MSVC) +if(MSVC AND (NOT WITH_MONOLITHIC_BUILD)) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() From e0693c8f4cf13a3b861314ab4a58c056ebfb73df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 4 Oct 2012 16:54:16 -0400 Subject: [PATCH 4/7] cmake: refactoring of channels cmake scripts --- channels/audin/client/CMakeLists.txt | 21 ++++++---- channels/cliprdr/client/CMakeLists.txt | 21 ++++++---- channels/drdynvc/client/CMakeLists.txt | 23 ++++++----- channels/rail/client/CMakeLists.txt | 18 ++++---- channels/rdpdr/client/CMakeLists.txt | 22 ++++++---- channels/rdpsnd/client/CMakeLists.txt | 18 ++++---- .../{mac_audio => MacAudio}/CMakeLists.txt | 4 +- .../{mac_audio => MacAudio}/rdpsnd_audio_q.c | 0 channels/rdpsnd/server/CMakeLists.txt | 2 + channels/sample/client/CMakeLists.txt | 19 +++++---- channels/server/CMakeLists.txt | 6 ++- channels/tsmf/client/CMakeLists.txt | 28 +++++++------ channels/urbdrc/CMakeLists.txt | 2 - channels/urbdrc/client/CMakeLists.txt | 41 ++++++++++++------- libfreerdp/CMakeLists.txt | 27 +++++++----- server/Sample/CMakeLists.txt | 4 +- winpr/include/winpr/wtypes.h | 8 ++-- winpr/libwinpr/CMakeLists.txt | 28 ++++++++----- 18 files changed, 166 insertions(+), 126 deletions(-) rename channels/rdpsnd/client/{mac_audio => MacAudio}/CMakeLists.txt (88%) rename channels/rdpsnd/client/{mac_audio => MacAudio}/rdpsnd_audio_q.c (100%) diff --git a/channels/audin/client/CMakeLists.txt b/channels/audin/client/CMakeLists.txt index 2be9f936b..f14356f8f 100644 --- a/channels/audin/client/CMakeLists.txt +++ b/channels/audin/client/CMakeLists.txt @@ -1,9 +1,7 @@ # 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 +# Copyright 2012 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. @@ -17,22 +15,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(AUDIN_SRCS +set(MODULE_NAME "audin") +set(MODULE_PREFIX "CHANNEL_AUDIN_CLIENT") + +set(${MODULE_PREFIX}_SRCS audin_main.c audin_main.h) include_directories(..) -add_library(audin ${AUDIN_SRCS}) -set_target_properties(audin PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") if(WITH_MONOLITHIC_BUILD) - target_link_libraries(audin freerdp) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(audin freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS audin DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") if(WITH_ALSA) add_subdirectory(alsa) diff --git a/channels/cliprdr/client/CMakeLists.txt b/channels/cliprdr/client/CMakeLists.txt index 5c30a67ef..c67038cd5 100644 --- a/channels/cliprdr/client/CMakeLists.txt +++ b/channels/cliprdr/client/CMakeLists.txt @@ -1,9 +1,7 @@ # 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 +# Copyright 2012 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. @@ -17,20 +15,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(CLIPRDR_SRCS +set(MODULE_NAME "cliprdr") +set(MODULE_PREFIX "CHANNEL_CLIPRDR_CLIENT") + +set(${MODULE_PREFIX}_SRCS cliprdr_constants.h cliprdr_format.c cliprdr_format.h cliprdr_main.c cliprdr_main.h) -add_library(cliprdr ${CLIPRDR_SRCS}) -set_target_properties(cliprdr PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") if(WITH_MONOLITHIC_BUILD) - target_link_libraries(cliprdr freerdp) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(cliprdr freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS cliprdr DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/drdynvc/client/CMakeLists.txt b/channels/drdynvc/client/CMakeLists.txt index 42f8bf1d2..0da01496e 100644 --- a/channels/drdynvc/client/CMakeLists.txt +++ b/channels/drdynvc/client/CMakeLists.txt @@ -1,9 +1,7 @@ # 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 +# Copyright 2012 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. @@ -17,22 +15,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(DRDYNVC_SRCS +set(MODULE_NAME "drdynvc") +set(MODULE_PREFIX "CHANNEL_DRDYNVC_CLIENT") + +set(${MODULE_PREFIX}_SRCS drdynvc_main.c drdynvc_main.h drdynvc_types.h dvcman.c - dvcman.h -) + dvcman.h) -add_library(drdynvc ${DRDYNVC_SRCS}) -set_target_properties(drdynvc PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") if(WITH_MONOLITHIC_BUILD) - target_link_libraries(drdynvc freerdp winpr) + target_link_libraries(${MODULE_NAME} freerdp winpr) else() - target_link_libraries(drdynvc freerdp-utils winpr-synch) + target_link_libraries(${MODULE_NAME} freerdp-utils winpr-synch) endif() -install(TARGETS drdynvc DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/rail/client/CMakeLists.txt b/channels/rail/client/CMakeLists.txt index 6e6a45441..e8146d7e0 100644 --- a/channels/rail/client/CMakeLists.txt +++ b/channels/rail/client/CMakeLists.txt @@ -1,8 +1,6 @@ # 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"); @@ -17,20 +15,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(RAIL_SRCS +set(MODULE_NAME "rail") +set(MODULE_PREFIX "CHANNEL_RAIL_CLIENT") + +set(${MODULE_PREFIX}_SRCS rail_main.c rail_main.h rail_orders.c rail_orders.h) -add_library(rail ${RAIL_SRCS}) -set_target_properties(rail PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") if(WITH_MONOLITHIC_BUILD) - target_link_libraries(rail freerdp) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(rail freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS rail DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/rdpdr/client/CMakeLists.txt b/channels/rdpdr/client/CMakeLists.txt index a3fa82e1c..f6dcdde22 100644 --- a/channels/rdpdr/client/CMakeLists.txt +++ b/channels/rdpdr/client/CMakeLists.txt @@ -1,9 +1,7 @@ # 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 +# Copyright 2012 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. @@ -17,7 +15,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(RDPDR_SRCS +set(MODULE_NAME "rdpdr") +set(MODULE_PREFIX "CHANNEL_RDPDR_CLIENT") + +set(${MODULE_PREFIX}_SRCS rdpdr_constants.h rdpdr_types.h rdpdr_capabilities.c @@ -29,19 +30,22 @@ set(RDPDR_SRCS rdpdr_main.c rdpdr_main.h) -add_library(rdpdr ${RDPDR_SRCS}) -set_target_properties(rdpdr PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") if(WITH_MONOLITHIC_BUILD) - target_link_libraries(rdpdr freerdp) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(rdpdr freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS rdpdr DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") add_subdirectory(disk) add_subdirectory(printer) + if(NOT WIN32) add_subdirectory(parallel) add_subdirectory(serial) diff --git a/channels/rdpsnd/client/CMakeLists.txt b/channels/rdpsnd/client/CMakeLists.txt index 745358da0..6bc8a307f 100644 --- a/channels/rdpsnd/client/CMakeLists.txt +++ b/channels/rdpsnd/client/CMakeLists.txt @@ -17,20 +17,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(RDPSND_SRCS +set(MODULE_NAME "rdpsnd") +set(MODULE_PREFIX "CHANNEL_RDPSND_CLIENT") + +set(${MODULE_PREFIX}_SRCS rdpsnd_main.c rdpsnd_main.h) -add_library(rdpsnd ${RDPSND_SRCS}) -set_target_properties(rdpsnd PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${RDPSND_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") if(WITH_MONOLITHIC_BUILD) - target_link_libraries(rdpsnd freerdp) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(rdpsnd freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS rdpsnd DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) if(WITH_ALSA) add_subdirectory(alsa) @@ -41,6 +44,5 @@ if(WITH_PULSEAUDIO) endif() if(WITH_MACAUDIO) - add_subdirectory(mac_audio) + add_subdirectory(MacAudio) endif() - diff --git a/channels/rdpsnd/client/mac_audio/CMakeLists.txt b/channels/rdpsnd/client/MacAudio/CMakeLists.txt similarity index 88% rename from channels/rdpsnd/client/mac_audio/CMakeLists.txt rename to channels/rdpsnd/client/MacAudio/CMakeLists.txt index 45b50548c..76035fed6 100644 --- a/channels/rdpsnd/client/mac_audio/CMakeLists.txt +++ b/channels/rdpsnd/client/MacAudio/CMakeLists.txt @@ -2,9 +2,7 @@ # FreeRDP cmake build script # # Copyright 2012 Laxmikant Rashinkar -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 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. diff --git a/channels/rdpsnd/client/mac_audio/rdpsnd_audio_q.c b/channels/rdpsnd/client/MacAudio/rdpsnd_audio_q.c similarity index 100% rename from channels/rdpsnd/client/mac_audio/rdpsnd_audio_q.c rename to channels/rdpsnd/client/MacAudio/rdpsnd_audio_q.c diff --git a/channels/rdpsnd/server/CMakeLists.txt b/channels/rdpsnd/server/CMakeLists.txt index 2e680b46e..bbdd507b2 100644 --- a/channels/rdpsnd/server/CMakeLists.txt +++ b/channels/rdpsnd/server/CMakeLists.txt @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(MODULE_NAME "rdpsnd") set(MODULE_PREFIX "CHANNEL_RDPSND_SERVER") set(${MODULE_PREFIX}_SRCS @@ -27,3 +28,4 @@ else() set(${MODULE_PREFIX}_LIBS freerdp-utils PARENT_SCOPE) endif() +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Server") diff --git a/channels/sample/client/CMakeLists.txt b/channels/sample/client/CMakeLists.txt index 1c2943c8f..e7919065f 100644 --- a/channels/sample/client/CMakeLists.txt +++ b/channels/sample/client/CMakeLists.txt @@ -1,9 +1,7 @@ # 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 +# Copyright 2012 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. @@ -17,17 +15,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(SKEL_SRCS +set(MODULE_NAME "sample") +set(MODULE_PREFIX "CHANNEL_SAMPLE_CLIENT") + +set(${MODULE_PREFIX}_SRCS skel_main.c skel_main.h) -add_library(skel ${SKEL_SRCS}) -set_target_properties(skel PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") if(WITH_MONOLITHIC_BUILD) - target_link_libraries(skel freerdp) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(skel freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS skel DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) diff --git a/channels/server/CMakeLists.txt b/channels/server/CMakeLists.txt index b8de4ee2d..793564e05 100644 --- a/channels/server/CMakeLists.txt +++ b/channels/server/CMakeLists.txt @@ -15,8 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(MODULE_NAME "freerdp-server-channels") -set(MODULE_PREFIX "FREERDP_SERVER_CHANNELS") +set(MODULE_NAME "freerdp-channels-server") +set(MODULE_PREFIX "FREERDP_CHANNELS_SERVER") foreach(_MODULE_NAME ${CHANNEL_BUILTIN_SERVER_MODULES}) string(TOUPPER "CHANNEL_${_MODULE_NAME}" _MODULE_PREFIX) @@ -35,3 +35,5 @@ set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} target_link_libraries(${MODULE_NAME} ${CHANNEL_SERVER_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Server") diff --git a/channels/tsmf/client/CMakeLists.txt b/channels/tsmf/client/CMakeLists.txt index baf97c55b..f4533a305 100644 --- a/channels/tsmf/client/CMakeLists.txt +++ b/channels/tsmf/client/CMakeLists.txt @@ -1,9 +1,7 @@ # 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 +# Copyright 2012 Marc-Andre Moreau # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(TSMF_SRCS +set(MODULE_NAME "tsmf") +set(MODULE_PREFIX "CHANNEL_TSMF_CLIENT") + +set(${MODULE_PREFIX}_SRCS tsmf_audio.c tsmf_audio.h tsmf_codec.c @@ -36,25 +37,27 @@ set(TSMF_SRCS include_directories(..) -add_library(tsmf ${TSMF_SRCS}) -set_target_properties(tsmf PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") if(WITH_MONOLITHIC_BUILD) - target_link_libraries(tsmf freerdp) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(tsmf freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS tsmf DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") if(WITH_FFMPEG) add_subdirectory(ffmpeg) endif() if(WITH_XRANDR) -if(GSTREAMER_FOUND) - add_subdirectory(gstreamer) -endif() + if(GSTREAMER_FOUND) + add_subdirectory(gstreamer) + endif() endif() if(WITH_ALSA) @@ -64,4 +67,3 @@ endif() if(WITH_PULSEAUDIO) add_subdirectory(pulse) endif() - diff --git a/channels/urbdrc/CMakeLists.txt b/channels/urbdrc/CMakeLists.txt index f49c8bedc..a506d0f74 100644 --- a/channels/urbdrc/CMakeLists.txt +++ b/channels/urbdrc/CMakeLists.txt @@ -20,5 +20,3 @@ add_subdirectory(libusb) if(WITH_CLIENT_CHANNELS) add_subdirectory(client) endif() - - diff --git a/channels/urbdrc/client/CMakeLists.txt b/channels/urbdrc/client/CMakeLists.txt index ce8087e8c..198ed1d28 100644 --- a/channels/urbdrc/client/CMakeLists.txt +++ b/channels/urbdrc/client/CMakeLists.txt @@ -16,27 +16,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(URBDRC_SRCS - searchman.c - searchman.h +set(MODULE_NAME "urbdrc") +set(MODULE_PREFIX "CHANNEL_URBDRC_CLIENT") + +set(${MODULE_PREFIX}_SRCS + searchman.c + searchman.h isoch_queue.c isoch_queue.h - data_transfer.c - data_transfer.h - urbdrc_main.c - urbdrc_main.h + data_transfer.c + data_transfer.h + urbdrc_main.c + urbdrc_main.h urbdrc_types.h) include_directories(..) -add_library(urbdrc ${URBDRC_SRCS}) -set_target_properties(urbdrc PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${URBDRC_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") -target_link_libraries(urbdrc udev) -target_link_libraries(urbdrc dbus-glib-1) -target_link_libraries(urbdrc pthread) -target_link_libraries(urbdrc uuid) -target_link_libraries(urbdrc freerdp-utils) +set(${MODULE_PREFIX}_LIBS + dbus-glib-1 + udev + uuid) -install(TARGETS urbdrc DESTINATION ${FREERDP_PLUGIN_PATH}) +if(WITH_MONOLITHIC_BUILD) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) + target_link_libraries(${MODULE_NAME} ${MODULE_PREFIX}_LIBS) +else() + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-utils) + target_link_libraries(${MODULE_NAME} ${MODULE_PREFIX}_LIBS) +endif() +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index 513f49398..83ff2d7c8 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -15,11 +15,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(MODULE_NAME "freerdp") +set(MODULE_PREFIX "FREERDP") + if(WITH_MONOLITHIC_BUILD) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -set(FREERDP_MODULES +set(${MODULE_PREFIX}_SUBMODULES utils gdi rail @@ -30,21 +33,23 @@ set(FREERDP_MODULES locale core) -foreach(FREERDP_MODULE ${FREERDP_MODULES}) - add_subdirectory(${FREERDP_MODULE}) +foreach(${MODULE_PREFIX}_SUBMODULE ${FREERDP_SUBMODULES}) + add_subdirectory(${${MODULE_PREFIX}_SUBMODULE}) endforeach() if(WITH_MONOLITHIC_BUILD) - foreach(FREERDP_MODULE ${FREERDP_MODULES}) - set(FREERDP_OBJECTS ${FREERDP_OBJECTS} "$") + foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_MODULES}) + set(${MODULE_PREFIX}_OBJECTS ${${MODULE_PREFIX}_OBJECTS} "$") endforeach() - add_library(freerdp ${FREERDP_OBJECTS}) - set_target_properties(freerdp PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") + add_library(${MODULE_NAME} ${${MODULE_PREFIX}_OBJECTS}) - target_link_libraries(freerdp ${FREERDP_LIBS}) - install(TARGETS freerdp DESTINATION ${CMAKE_INSTALL_LIBDIR}) + set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") + + target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") endif() - -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/server/Sample/CMakeLists.txt b/server/Sample/CMakeLists.txt index a7219c248..a1b510580 100644 --- a/server/Sample/CMakeLists.txt +++ b/server/Sample/CMakeLists.txt @@ -26,14 +26,14 @@ add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) if(WITH_MONOLITHIC_BUILD) target_link_libraries(${MODULE_NAME} freerdp - freerdp-server) + freerdp-channels-server) else() target_link_libraries(${MODULE_NAME} freerdp-core freerdp-utils freerdp-codec freerdp-channels - freerdp-server-channels) + freerdp-channels-server) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Sample") diff --git a/winpr/include/winpr/wtypes.h b/winpr/include/winpr/wtypes.h index 3b3669123..d1cd6b42d 100644 --- a/winpr/include/winpr/wtypes.h +++ b/winpr/include/winpr/wtypes.h @@ -89,11 +89,11 @@ typedef unsigned __int3264 ULONG_PTR, *PULONG_PTR; typedef signed int LONG32; typedef signed __int64 LONG64; -typedef CHAR* PSTR, *LPSTR; -typedef const CHAR *LPCSTR,*PCSTR; +typedef CHAR *PSTR, *LPSTR, *LPCH; +typedef const CHAR *LPCSTR, *PCSTR, *LPCCH; -typedef WCHAR* LPWSTR, *PWSTR; -typedef const WCHAR *LPCWSTR,*PCWSTR; +typedef WCHAR *LPWSTR, *PWSTR, *LPWCH; +typedef const WCHAR *LPCWSTR, *PCWSTR, *LPCWCH; typedef CHAR *LPSTR, *LPCH; typedef WCHAR *LPWSTR, *LPWCH; diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index 3ebf5cb2b..df1c31e48 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -15,6 +15,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(MODULE_NAME "winpr") +set(MODULE_PREFIX "WINPR") + if (APPLE) # flat_namespace should be avoided, but is required for -undefined warning. Since WinPR currently has # a lot of undefined symbols in use, use this hack until they're filled out. @@ -30,25 +33,28 @@ file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") foreach(FILEPATH ${FILEPATHS}) if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}") - string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" WINPR_MODULE ${FILEPATH}) - set(WINPR_MODULES ${WINPR_MODULES} ${WINPR_MODULE}) + string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" ${MODULE_PREFIX}_SUBMODULE ${FILEPATH}) + set(${MODULE_PREFIX}_SUBMODULES ${${MODULE_PREFIX}_SUBMODULES} ${${MODULE_PREFIX}_SUBMODULE}) endif() endforeach(FILEPATH) -foreach(WINPR_MODULE ${WINPR_MODULES}) - add_subdirectory(${WINPR_MODULE}) +foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) + add_subdirectory(${${MODULE_PREFIX}_SUBMODULE}) endforeach() if(WITH_MONOLITHIC_BUILD) - foreach(WINPR_MODULE ${WINPR_MODULES}) - set(WINPR_OBJECTS ${WINPR_OBJECTS} "$") + foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) + set(${MODULE_PREFIX}_OBJECTS ${${MODULE_PREFIX}_OBJECTS} "$") endforeach() - add_library(winpr ${WINPR_OBJECTS}) - set_target_properties(winpr PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") + add_library(${MODULE_NAME} ${${MODULE_PREFIX}_OBJECTS}) - target_link_libraries(winpr ${WINPR_LIBS}) - install(TARGETS winpr DESTINATION ${CMAKE_INSTALL_LIBDIR}) + set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") + + target_link_libraries(${MODULE_NAME} ${WINPR_LIBS}) + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/libwinpr") endif() - From bf26079d3faaa39fb027b1405bfe3a2cae5355e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 4 Oct 2012 18:57:32 -0400 Subject: [PATCH 5/7] libwinpr: added tests and fix InterlockedCompareExchange64 on Windows XP --- winpr/include/winpr/interlocked.h | 5 ++- winpr/libwinpr/file/CMakeLists.txt | 4 ++ winpr/libwinpr/file/test/.gitignore | 3 ++ winpr/libwinpr/file/test/CMakeLists.txt | 28 +++++++++++++ winpr/libwinpr/file/test/TestFileCreateFile.c | 10 +++++ winpr/libwinpr/file/test/TestFileDeleteFile.c | 10 +++++ winpr/libwinpr/file/test/TestFileReadFile.c | 10 +++++ winpr/libwinpr/file/test/TestFileWriteFile.c | 10 +++++ winpr/libwinpr/interlocked/interlocked.c | 42 ++++++++++++++++++- winpr/libwinpr/interlocked/module.def | 1 + .../libwinpr/interlocked/test/CMakeLists.txt | 4 +- winpr/libwinpr/io/CMakeLists.txt | 4 ++ winpr/libwinpr/io/test/.gitignore | 3 ++ winpr/libwinpr/io/test/CMakeLists.txt | 25 +++++++++++ .../io/test/TestIoGetOverlappedResult.c | 10 +++++ winpr/libwinpr/library/CMakeLists.txt | 4 ++ winpr/libwinpr/library/test/.gitignore | 3 ++ winpr/libwinpr/library/test/CMakeLists.txt | 30 +++++++++++++ .../library/test/TestLibraryAddDllDirectory.c | 10 +++++ .../library/test/TestLibraryFreeLibrary.c | 10 +++++ .../library/test/TestLibraryGetProcAddress.c | 10 +++++ .../library/test/TestLibraryLoadLibrary.c | 10 +++++ .../test/TestLibraryRemoveDllDirectory.c | 10 +++++ .../TestLibrarySetDefaultDllDirectories.c | 10 +++++ winpr/libwinpr/path/test/CMakeLists.txt | 6 +-- 25 files changed, 261 insertions(+), 11 deletions(-) create mode 100644 winpr/libwinpr/file/test/.gitignore create mode 100644 winpr/libwinpr/file/test/CMakeLists.txt create mode 100644 winpr/libwinpr/file/test/TestFileCreateFile.c create mode 100644 winpr/libwinpr/file/test/TestFileDeleteFile.c create mode 100644 winpr/libwinpr/file/test/TestFileReadFile.c create mode 100644 winpr/libwinpr/file/test/TestFileWriteFile.c create mode 100644 winpr/libwinpr/io/test/.gitignore create mode 100644 winpr/libwinpr/io/test/CMakeLists.txt create mode 100644 winpr/libwinpr/io/test/TestIoGetOverlappedResult.c create mode 100644 winpr/libwinpr/library/test/.gitignore create mode 100644 winpr/libwinpr/library/test/CMakeLists.txt create mode 100644 winpr/libwinpr/library/test/TestLibraryAddDllDirectory.c create mode 100644 winpr/libwinpr/library/test/TestLibraryFreeLibrary.c create mode 100644 winpr/libwinpr/library/test/TestLibraryGetProcAddress.c create mode 100644 winpr/libwinpr/library/test/TestLibraryLoadLibrary.c create mode 100644 winpr/libwinpr/library/test/TestLibraryRemoveDllDirectory.c create mode 100644 winpr/libwinpr/library/test/TestLibrarySetDefaultDllDirectories.c diff --git a/winpr/include/winpr/interlocked.h b/winpr/include/winpr/interlocked.h index d651c629e..c12461a44 100644 --- a/winpr/include/winpr/interlocked.h +++ b/winpr/include/winpr/interlocked.h @@ -135,10 +135,11 @@ WINPR_API LONG InterlockedDecrement(LONG volatile *Addend); WINPR_API LONG InterlockedExchange(LONG volatile *Target, LONG Value); WINPR_API LONG InterlockedExchangeAdd(LONG volatile *Addend, LONG Value); -WINPR_API LONG InterlockedCompareExchange(LONG volatile *Destination,LONG Exchange, LONG Comperand); -WINPR_API LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand); +WINPR_API LONG InterlockedCompareExchange(LONG volatile *Destination, LONG Exchange, LONG Comperand); #endif /* _WIN32 */ +WINPR_API LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand); + #endif /* WINPR_INTERLOCKED_H */ diff --git a/winpr/libwinpr/file/CMakeLists.txt b/winpr/libwinpr/file/CMakeLists.txt index 82baa624a..5e78ba9f2 100644 --- a/winpr/libwinpr/file/CMakeLists.txt +++ b/winpr/libwinpr/file/CMakeLists.txt @@ -41,3 +41,7 @@ else() endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR") + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/winpr/libwinpr/file/test/.gitignore b/winpr/libwinpr/file/test/.gitignore new file mode 100644 index 000000000..5d04ec9e1 --- /dev/null +++ b/winpr/libwinpr/file/test/.gitignore @@ -0,0 +1,3 @@ +TestFile +TestFile.c + diff --git a/winpr/libwinpr/file/test/CMakeLists.txt b/winpr/libwinpr/file/test/CMakeLists.txt new file mode 100644 index 000000000..80371dcd1 --- /dev/null +++ b/winpr/libwinpr/file/test/CMakeLists.txt @@ -0,0 +1,28 @@ + +set(MODULE_NAME "TestFile") +set(MODULE_PREFIX "TEST_FILE") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestFileCreateFile.c + TestFileDeleteFile.c + TestFileReadFile.c + TestFileWriteFile.c) + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +if(NOT WIN32) + target_link_libraries(${MODULE_NAME} winpr-file) +endif() + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/file/test/TestFileCreateFile.c b/winpr/libwinpr/file/test/TestFileCreateFile.c new file mode 100644 index 000000000..39b6a26c7 --- /dev/null +++ b/winpr/libwinpr/file/test/TestFileCreateFile.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestFileCreateFile(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/file/test/TestFileDeleteFile.c b/winpr/libwinpr/file/test/TestFileDeleteFile.c new file mode 100644 index 000000000..aaa341ae2 --- /dev/null +++ b/winpr/libwinpr/file/test/TestFileDeleteFile.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestFileDeleteFile(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/file/test/TestFileReadFile.c b/winpr/libwinpr/file/test/TestFileReadFile.c new file mode 100644 index 000000000..936881a4e --- /dev/null +++ b/winpr/libwinpr/file/test/TestFileReadFile.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestFileReadFile(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/file/test/TestFileWriteFile.c b/winpr/libwinpr/file/test/TestFileWriteFile.c new file mode 100644 index 000000000..a8283ee6d --- /dev/null +++ b/winpr/libwinpr/file/test/TestFileWriteFile.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestFileWriteFile(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/interlocked/interlocked.c b/winpr/libwinpr/interlocked/interlocked.c index 30b608ee7..e1a754b2d 100644 --- a/winpr/libwinpr/interlocked/interlocked.c +++ b/winpr/libwinpr/interlocked/interlocked.c @@ -246,6 +246,45 @@ LONG InterlockedCompareExchange(LONG volatile *Destination, LONG Exchange, LONG #endif } +#endif /* _WIN32 */ + +#if (_WIN32_WINNT < 0x0502) + +static volatile HANDLE mutex = NULL; + +int static_mutex_lock(volatile HANDLE* static_mutex) +{ + if (*static_mutex == NULL) + { + HANDLE handle = CreateMutex(NULL, FALSE, NULL); + + if (InterlockedCompareExchangePointer((PVOID*) static_mutex, (PVOID) handle, NULL) != NULL) + CloseHandle(handle); + } + + return WaitForSingleObject(*static_mutex, INFINITE) == WAIT_FAILED; +} + +/* Not available in XP */ + +LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand) +{ + LONGLONG previousValue = 0; + + static_mutex_lock(&mutex); + + previousValue = *Destination; + + if (*Destination == Comperand) + *Destination = Exchange; + + ReleaseMutex(mutex); + + return previousValue; +} + +#else /* (_WIN32_WINNT < 0x0600) */ + LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand) { #ifdef __GNUC__ @@ -255,4 +294,5 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG E #endif } -#endif +#endif /* (_WIN32_WINNT < 0x0600) */ + diff --git a/winpr/libwinpr/interlocked/module.def b/winpr/libwinpr/interlocked/module.def index a73d92a6b..20b5fd055 100644 --- a/winpr/libwinpr/interlocked/module.def +++ b/winpr/libwinpr/interlocked/module.def @@ -1,2 +1,3 @@ LIBRARY "libwinpr-interlocked" EXPORTS + InterlockedCompareExchange64 @1 diff --git a/winpr/libwinpr/interlocked/test/CMakeLists.txt b/winpr/libwinpr/interlocked/test/CMakeLists.txt index c04306ba1..072aa9e93 100644 --- a/winpr/libwinpr/interlocked/test/CMakeLists.txt +++ b/winpr/libwinpr/interlocked/test/CMakeLists.txt @@ -14,9 +14,7 @@ create_test_sourcelist(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -if(NOT WIN32) - target_link_libraries(${MODULE_NAME} winpr-interlocked) -endif() +target_link_libraries(${MODULE_NAME} winpr-interlocked) foreach(test ${${MODULE_PREFIX}_TESTS}) get_filename_component(TestName ${test} NAME_WE) diff --git a/winpr/libwinpr/io/CMakeLists.txt b/winpr/libwinpr/io/CMakeLists.txt index d2632ae74..598cb20a2 100644 --- a/winpr/libwinpr/io/CMakeLists.txt +++ b/winpr/libwinpr/io/CMakeLists.txt @@ -36,3 +36,7 @@ else() endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR") + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/winpr/libwinpr/io/test/.gitignore b/winpr/libwinpr/io/test/.gitignore new file mode 100644 index 000000000..db7983b28 --- /dev/null +++ b/winpr/libwinpr/io/test/.gitignore @@ -0,0 +1,3 @@ +TestIO +TestIO.c + diff --git a/winpr/libwinpr/io/test/CMakeLists.txt b/winpr/libwinpr/io/test/CMakeLists.txt new file mode 100644 index 000000000..6119501f2 --- /dev/null +++ b/winpr/libwinpr/io/test/CMakeLists.txt @@ -0,0 +1,25 @@ + +set(MODULE_NAME "TestIo") +set(MODULE_PREFIX "TEST_IO") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestIoGetOverlappedResult.c) + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +if(NOT WIN32) + target_link_libraries(${MODULE_NAME} winpr-io) +endif() + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/io/test/TestIoGetOverlappedResult.c b/winpr/libwinpr/io/test/TestIoGetOverlappedResult.c new file mode 100644 index 000000000..044eb11cc --- /dev/null +++ b/winpr/libwinpr/io/test/TestIoGetOverlappedResult.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestIoGetOverlappedResult(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/CMakeLists.txt b/winpr/libwinpr/library/CMakeLists.txt index e8004c957..002cf9d1c 100644 --- a/winpr/libwinpr/library/CMakeLists.txt +++ b/winpr/libwinpr/library/CMakeLists.txt @@ -36,3 +36,7 @@ else() endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR") + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/winpr/libwinpr/library/test/.gitignore b/winpr/libwinpr/library/test/.gitignore new file mode 100644 index 000000000..36c502679 --- /dev/null +++ b/winpr/libwinpr/library/test/.gitignore @@ -0,0 +1,3 @@ +TestLibrary +TestLibrary.c + diff --git a/winpr/libwinpr/library/test/CMakeLists.txt b/winpr/libwinpr/library/test/CMakeLists.txt new file mode 100644 index 000000000..8e9c10423 --- /dev/null +++ b/winpr/libwinpr/library/test/CMakeLists.txt @@ -0,0 +1,30 @@ + +set(MODULE_NAME "TestLibrary") +set(MODULE_PREFIX "TEST_LIBRARY") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestLibraryAddDllDirectory.c + TestLibraryRemoveDllDirectory.c + TestLibrarySetDefaultDllDirectories.c + TestLibraryLoadLibrary.c + TestLibraryFreeLibrary.c + TestLibraryGetProcAddress.c) + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +if(NOT WIN32) + target_link_libraries(${MODULE_NAME} winpr-library) +endif() + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/library/test/TestLibraryAddDllDirectory.c b/winpr/libwinpr/library/test/TestLibraryAddDllDirectory.c new file mode 100644 index 000000000..7f3b941e4 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryAddDllDirectory.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestLibraryAddDllDirectory(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibraryFreeLibrary.c b/winpr/libwinpr/library/test/TestLibraryFreeLibrary.c new file mode 100644 index 000000000..1051402a6 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryFreeLibrary.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestLibraryFreeLibrary(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c b/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c new file mode 100644 index 000000000..995639445 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestLibraryGetProcAddress(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c b/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c new file mode 100644 index 000000000..9740cf0f8 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestLibraryLoadLibrary(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibraryRemoveDllDirectory.c b/winpr/libwinpr/library/test/TestLibraryRemoveDllDirectory.c new file mode 100644 index 000000000..47ecf8cba --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryRemoveDllDirectory.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestLibraryRemoveDllDirectory(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibrarySetDefaultDllDirectories.c b/winpr/libwinpr/library/test/TestLibrarySetDefaultDllDirectories.c new file mode 100644 index 000000000..f7935ea73 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibrarySetDefaultDllDirectories.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestLibrarySetDefaultDllDirectories(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/path/test/CMakeLists.txt b/winpr/libwinpr/path/test/CMakeLists.txt index b8eb05fd0..e3a8e41d5 100644 --- a/winpr/libwinpr/path/test/CMakeLists.txt +++ b/winpr/libwinpr/path/test/CMakeLists.txt @@ -34,11 +34,7 @@ create_test_sourcelist(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -if(WIN32) - target_link_libraries(${MODULE_NAME} Pathcch) -else() - target_link_libraries(${MODULE_NAME} winpr-path) -endif() +target_link_libraries(${MODULE_NAME} winpr-path) foreach(test ${${MODULE_PREFIX}_TESTS}) get_filename_component(TestName ${test} NAME_WE) From e680cb2bfbec1075883e30fab243fd1a46927742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 4 Oct 2012 19:15:44 -0400 Subject: [PATCH 6/7] libfreerdp: fix monolithic build --- libfreerdp/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index 83ff2d7c8..e1fc3b154 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -33,14 +33,14 @@ set(${MODULE_PREFIX}_SUBMODULES locale core) -foreach(${MODULE_PREFIX}_SUBMODULE ${FREERDP_SUBMODULES}) +foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) add_subdirectory(${${MODULE_PREFIX}_SUBMODULE}) endforeach() if(WITH_MONOLITHIC_BUILD) - foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_MODULES}) - set(${MODULE_PREFIX}_OBJECTS ${${MODULE_PREFIX}_OBJECTS} "$") + foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) + set(${MODULE_PREFIX}_OBJECTS ${${MODULE_PREFIX}_OBJECTS} "$") endforeach() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_OBJECTS}) From 94469ffa6f4f94de122b2e12953a68d5f4e099d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 4 Oct 2012 19:21:09 -0400 Subject: [PATCH 7/7] wfreerdp-server: fix server interface build --- server/Windows/CMakeLists.txt | 2 +- server/Windows/cli/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/Windows/CMakeLists.txt b/server/Windows/CMakeLists.txt index b0d680db4..4688b0fa9 100644 --- a/server/Windows/CMakeLists.txt +++ b/server/Windows/CMakeLists.txt @@ -62,7 +62,7 @@ else() freerdp-channels) endif() -target_link_libraries(wfreerdp-server ${${MODULE_PREFIX}_LIBS}) +target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) if(WITH_SERVER_INTERFACE) diff --git a/server/Windows/cli/CMakeLists.txt b/server/Windows/cli/CMakeLists.txt index f7d2ade5a..d8a0e418f 100644 --- a/server/Windows/cli/CMakeLists.txt +++ b/server/Windows/cli/CMakeLists.txt @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(MODULE_NAME "wfreerdp-server") +set(MODULE_NAME "wfreerdp-server-cli") set(MODULE_PREFIX "FREERDP_SERVER_WINDOWS_CLI") include_directories(..)