From 210ba6ac8c83811a1081f2cc3e1ae09a8967a3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Fri, 19 Oct 2012 13:10:42 -0400 Subject: [PATCH] channels: fix linking of libfreerdp-client and libfreerdp-server --- CMakeLists.txt | 2 +- channels/CMakeLists.txt | 5 +++- channels/client/CMakeLists.txt | 14 +++------- channels/sample/client/CMakeLists.txt | 7 ++--- .../client/{skel_main.c => sample_main.c} | 28 ++++++++++--------- .../client/{skel_main.h => sample_main.h} | 2 +- channels/server/CMakeLists.txt | 8 ++---- channels/server/channels.c | 25 +++++++++++++++++ client/Sample/CMakeLists.txt | 2 ++ client/X11/CMakeLists.txt | 4 +-- client/common/CMakeLists.txt | 9 +++++- include/freerdp/client/channels.h | 1 + server/Sample/CMakeLists.txt | 1 - server/common/CMakeLists.txt | 9 +++++- server/common/server.c | 1 - 15 files changed, 77 insertions(+), 41 deletions(-) rename channels/sample/client/{skel_main.c => sample_main.c} (87%) rename channels/sample/client/{skel_main.h => sample_main.h} (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99f50fd89..68e3ffa75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ if(NOT DEFINED BUILD_SHARED_LIBS) endif() if(NOT DEFINED EXPORT_ALL_SYMBOLS) - set(EXPORT_ALL_SYMBOLS TRUE) + set(EXPORT_ALL_SYMBOLS FALSE) endif() # Configure MSVC Runtime diff --git a/channels/CMakeLists.txt b/channels/CMakeLists.txt index fb125dbd2..49b6df28d 100644 --- a/channels/CMakeLists.txt +++ b/channels/CMakeLists.txt @@ -131,9 +131,12 @@ endforeach(FILEPATH) if(WITH_CLIENT_CHANNELS) add_subdirectory(client) + set(FREERDP_CHANNELS_CLIENT_SRCS ${FREERDP_CHANNELS_CLIENT_SRCS} PARENT_SCOPE) + set(FREERDP_CHANNELS_CLIENT_LIBS ${FREERDP_CHANNELS_CLIENT_LIBS} PARENT_SCOPE) endif() if(WITH_SERVER_CHANNELS) add_subdirectory(server) + set(FREERDP_CHANNELS_SERVER_SRCS ${FREERDP_CHANNELS_SERVER_SRCS} PARENT_SCOPE) + set(FREERDP_CHANNELS_SERVER_LIBS ${FREERDP_CHANNELS_SERVER_LIBS} PARENT_SCOPE) endif() - diff --git a/channels/client/CMakeLists.txt b/channels/client/CMakeLists.txt index f1e29fdf5..4f8bd6a47 100644 --- a/channels/client/CMakeLists.txt +++ b/channels/client/CMakeLists.txt @@ -37,7 +37,7 @@ foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES}) 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} },") + set(${STATIC_ENTRY}_TABLE "${${STATIC_ENTRY}_TABLE}\n\t{ \"${STATIC_MODULE_CHANNEL}\", ${ENTRY_POINT_NAME} },") endif() endforeach() @@ -61,12 +61,8 @@ set(CLIENT_STATIC_ENTRY_TABLES_LIST "${CLIENT_STATIC_ENTRY_TABLES_LIST}\n\t{ \"\ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tables.c.in ${CMAKE_CURRENT_SOURCE_DIR}/tables.c) -add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) - -set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") - set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS - MONOLITHIC ${MONOLITHIC_BUILD} INTERNAL + MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp MODULES freerdp-utils) @@ -75,7 +71,5 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MODULE winpr MODULES winpr-crt winpr-synch winpr-interlocked) -target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) - -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Client") - +set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} PARENT_SCOPE) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) diff --git a/channels/sample/client/CMakeLists.txt b/channels/sample/client/CMakeLists.txt index c960d05b5..a4c163319 100644 --- a/channels/sample/client/CMakeLists.txt +++ b/channels/sample/client/CMakeLists.txt @@ -18,10 +18,10 @@ define_channel_client("sample") set(${MODULE_PREFIX}_SRCS - skel_main.c - skel_main.h) + sample_main.c + sample_main.h) -add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") +add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "VirtualChannelEntry") set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") @@ -35,4 +35,3 @@ if(NOT STATIC_CHANNELS) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client") - diff --git a/channels/sample/client/skel_main.c b/channels/sample/client/sample_main.c similarity index 87% rename from channels/sample/client/skel_main.c rename to channels/sample/client/sample_main.c index 4fb37cffd..b9f2b3cc2 100644 --- a/channels/sample/client/skel_main.c +++ b/channels/sample/client/sample_main.c @@ -1,6 +1,6 @@ /** * FreeRDP: A Remote Desktop Protocol Implementation - * Audio Output Virtual Channel + * Sample Virtual Channel * * Copyright 2009-2012 Jay Sorg * Copyright 2010-2012 Vic Lee @@ -30,15 +30,17 @@ #include #include -#include +#include + #include +#include #include #include #include #include #include -#include "skel_main.h" +#include "sample_main.h" struct sample_plugin { @@ -50,20 +52,20 @@ struct sample_plugin static void sample_process_interval(rdpSvcPlugin* plugin) { - printf("skel_process_interval:\n"); + printf("sample_process_interval:\n"); } static void sample_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) { - skelPlugin* skel = (skelPlugin*)plugin; - STREAM* data_out; int bytes; + STREAM* data_out; + samplePlugin* sample = (samplePlugin*) plugin; - printf("skel_process_receive:\n"); + printf("sample_process_receive:\n"); - if (skel == NULL) + if (sample == NULL) { - printf("skel_process_receive: skel is nil\n"); + printf("sample_process_receive: sample is nil\n"); return; } @@ -71,7 +73,7 @@ static void sample_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) /* here we just send the same data back */ bytes = stream_get_size(data_in); - printf("skel_process_receive: got bytes %d\n", bytes); + printf("sample_process_receive: got bytes %d\n", bytes); if (bytes > 0) { data_out = stream_new(bytes); @@ -80,7 +82,7 @@ static void sample_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) we do not free it */ bytes = stream_get_length(data_in); - printf("skel_process_receive: sending bytes %d\n", bytes); + printf("sample_process_receive: sending bytes %d\n", bytes); svc_plugin_send(plugin, data_out); } @@ -118,11 +120,11 @@ static void sample_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) static void sample_process_terminate(rdpSvcPlugin* plugin) { - skelPlugin* skel = (skelPlugin*)plugin; + samplePlugin* sample = (samplePlugin*)plugin; printf("sample_process_terminate:\n"); - if (skel == NULL) + if (sample == NULL) { return; } diff --git a/channels/sample/client/skel_main.h b/channels/sample/client/sample_main.h similarity index 96% rename from channels/sample/client/skel_main.h rename to channels/sample/client/sample_main.h index 0f55dd6ce..865919135 100644 --- a/channels/sample/client/skel_main.h +++ b/channels/sample/client/sample_main.h @@ -1,6 +1,6 @@ /** * FreeRDP: A Remote Desktop Protocol Implementation - * Audio Output Virtual Channel + * Sample Virtual Channel * * Copyright 2012 Jay Sorg * Copyright 2010-2012 Vic Lee diff --git a/channels/server/CMakeLists.txt b/channels/server/CMakeLists.txt index 4c067857a..6e35cf5ac 100644 --- a/channels/server/CMakeLists.txt +++ b/channels/server/CMakeLists.txt @@ -34,7 +34,7 @@ add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS - MONOLITHIC ${MONOLITHIC_BUILD} INTERNAL + MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp MODULES freerdp-utils) @@ -43,7 +43,5 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MODULE winpr MODULES winpr-crt winpr-synch winpr-interlocked) -target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) - -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Server") - +set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} PARENT_SCOPE) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) diff --git a/channels/server/channels.c b/channels/server/channels.c index f9c5c4abf..2066a7e02 100644 --- a/channels/server/channels.c +++ b/channels/server/channels.c @@ -18,6 +18,10 @@ * limitations under the License. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -30,6 +34,27 @@ #include "channels.h" +/** + * this is a workaround to force importing symbols + * will need to fix that later on cleanly + */ + +#include +#include + +void freerdp_channels_dummy() +{ + audin_server_context_new(NULL); + audin_server_context_free(NULL); + + rdpsnd_server_context_new(NULL); + rdpsnd_server_context_free(NULL); +} + +/** + * end of ugly symbols import workaround + */ + #define CREATE_REQUEST_PDU 0x01 #define DATA_FIRST_PDU 0x02 #define DATA_PDU 0x03 diff --git a/client/Sample/CMakeLists.txt b/client/Sample/CMakeLists.txt index 903a77688..c5070a7bd 100644 --- a/client/Sample/CMakeLists.txt +++ b/client/Sample/CMakeLists.txt @@ -25,6 +25,8 @@ add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${CMAKE_DL_LIBS}) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client) + set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 0ef0b6a50..722a55b4c 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -16,7 +16,7 @@ # limitations under the License. set(MODULE_NAME "xfreerdp") -set(MODULE_PREFIX "FREERDP_CLIENT_WINDOWS") +set(MODULE_PREFIX "FREERDP_CLIENT_X11") include(FindXmlto) include_directories(${X11_INCLUDE_DIRS}) @@ -101,7 +101,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHI MODULES freerdp-core freerdp-gdi freerdp-locale freerdp-rail freerdp-utils) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/X11") - diff --git a/client/common/CMakeLists.txt b/client/common/CMakeLists.txt index 2a0cc2fbf..6b5346ab6 100644 --- a/client/common/CMakeLists.txt +++ b/client/common/CMakeLists.txt @@ -22,6 +22,11 @@ set(${MODULE_PREFIX}_SRCS client.c file.c) +set(FREERDP_CHANNELS_CLIENT_PATH "../../channels/client") +foreach(FREERDP_CHANNELS_CLIENT_SRC ${FREERDP_CHANNELS_CLIENT_SRCS}) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} "${FREERDP_CHANNELS_CLIENT_PATH}/${FREERDP_CHANNELS_CLIENT_SRC}") +endforeach() + if(MSVC) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() @@ -30,9 +35,11 @@ add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-channels-client) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} + ${FREERDP_CHANNELS_CLIENT_LIBS}) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) +set_target_properties(${MODULE_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) diff --git a/include/freerdp/client/channels.h b/include/freerdp/client/channels.h index 8797f8b8a..f2dbc9d20 100644 --- a/include/freerdp/client/channels.h +++ b/include/freerdp/client/channels.h @@ -21,6 +21,7 @@ #define FREERDP_CHANNELS_CLIENT #include +#include FREERDP_API void* freerdp_channels_client_find_static_entry(const char* name, const char* identifier); FREERDP_API void* freerdp_channels_client_find_dynamic_entry(const char* name, const char* identifier); diff --git a/server/Sample/CMakeLists.txt b/server/Sample/CMakeLists.txt index e92305876..976893198 100644 --- a/server/Sample/CMakeLists.txt +++ b/server/Sample/CMakeLists.txt @@ -44,4 +44,3 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Sample") - diff --git a/server/common/CMakeLists.txt b/server/common/CMakeLists.txt index 00c9e33c6..48ddf6cc6 100644 --- a/server/common/CMakeLists.txt +++ b/server/common/CMakeLists.txt @@ -21,6 +21,11 @@ set(MODULE_PREFIX "FREERDP_SERVER") set(${MODULE_PREFIX}_SRCS server.c) +set(FREERDP_CHANNELS_SERVER_PATH "../../channels/server") +foreach(FREERDP_CHANNELS_SERVER_SRC ${FREERDP_CHANNELS_SERVER_SRCS}) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} "${FREERDP_CHANNELS_SERVER_PATH}/${FREERDP_CHANNELS_SERVER_SRC}") +endforeach() + if(MSVC) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() @@ -29,9 +34,11 @@ add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-channels-server) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} + ${FREERDP_CHANNELS_SERVER_LIBS}) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) +set_target_properties(${MODULE_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) diff --git a/server/common/server.c b/server/common/server.c index 7ddd6ebf2..c2ea8fc5b 100644 --- a/server/common/server.c +++ b/server/common/server.c @@ -21,4 +21,3 @@ #include "config.h" #endif -