diff --git a/.gitignore b/.gitignore index ff66464d9..b6f8ca4cd 100755 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,12 @@ _CPack_Packages external/* !external/README +*.a.objlist.cmake +*.a.objlist +*.a.objdir +*_dummy.c +*_dummy.c.base + # Packages *.zip *.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ca2f3475..d5cc1399c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ project(FreeRDP C) set(CMAKE_COLOR_MAKEFILE ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # Include our extra modules set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) @@ -473,9 +475,7 @@ if(WITH_THIRD_PARTY) endif() endif() -if (NOT WITH_WAYK) - add_subdirectory(include) -endif() +add_subdirectory(include) add_subdirectory(libfreerdp) @@ -500,27 +500,23 @@ endif() SET(CPACK_BINARY_ZIP "ON") -if(NOT WITH_WAYK) - set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/\\\\.gitignore;/CMakeCache.txt") if(NOT WIN32) - if(APPLE AND (NOT IOS)) - #set(CPACK_PACKAGE_EXECUTABLES "mfreerdp") + if(APPLE AND (NOT IOS)) - if(WITH_SERVER) - set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "mfreerdp-server") - endif() + if(WITH_SERVER) + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "mfreerdp-server") + endif() endif() - if(WITH_X11) - set(CPACK_PACKAGE_EXECUTABLES "xfreerdp") + if(WITH_X11) + set(CPACK_PACKAGE_EXECUTABLES "xfreerdp") - if(WITH_SERVER) - set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "xfreerdp-server") - endif() + if(WITH_SERVER) + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "xfreerdp-server") + endif() endif() - endif() set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") @@ -558,28 +554,11 @@ if(MSVC) set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) include(InstallRequiredSystemLibraries) -if(NOT WITH_WAYK) install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries) + endif() endif() - endif() - - set(EXTRA_DATA_DIR "extra/") - file(GLOB EXTRA_FILES "${CMAKE_SOURCE_DIR}/extra/*") - install(FILES ${EXTRA_FILES} - DESTINATION ${EXTRA_DATA_DIR} - COMPONENT extra) - - set(REV_DATA_DIR "REV/") - file(GLOB REV_FILES "${CMAKE_SOURCE_DIR}/REV/*") - install(FILES ${REV_FILES} - DESTINATION ${REV_DATA_DIR} - COMPONENT rev) - - set(CPACK_COMPONENTS_AL ${CPACK_COMPONENTS_ALL} extra rev) -endif() - set(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client") set(CPACK_COMPONENT_CLIENT_GROUP "Applications") @@ -608,4 +587,3 @@ endif() include(CPack) -endif() diff --git a/channels/audin/client/alsa/CMakeLists.txt b/channels/audin/client/alsa/CMakeLists.txt index b39ec52b3..4a4ca6096 100644 --- a/channels/audin/client/alsa/CMakeLists.txt +++ b/channels/audin/client/alsa/CMakeLists.txt @@ -30,7 +30,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp - MODULES freerdp-utils) + MODULES freerdp-codec freerdp-utils) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${ALSA_LIBRARIES}) diff --git a/channels/audin/client/pulse/CMakeLists.txt b/channels/audin/client/pulse/CMakeLists.txt index a183ced3c..6c1f59ded 100644 --- a/channels/audin/client/pulse/CMakeLists.txt +++ b/channels/audin/client/pulse/CMakeLists.txt @@ -30,7 +30,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp - MODULES freerdp-utils) + MODULES freerdp-codec freerdp-utils) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${PULSE_LIBRARY}) diff --git a/channels/rdpsnd/client/CMakeLists.txt b/channels/rdpsnd/client/CMakeLists.txt index 54f3749a4..d741fa76d 100644 --- a/channels/rdpsnd/client/CMakeLists.txt +++ b/channels/rdpsnd/client/CMakeLists.txt @@ -28,7 +28,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp - MODULES freerdp-utils) + MODULES freerdp-codec freerdp-utils) set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} diff --git a/channels/rdpsnd/client/alsa/CMakeLists.txt b/channels/rdpsnd/client/alsa/CMakeLists.txt index 2f5eb1df7..397634c80 100644 --- a/channels/rdpsnd/client/alsa/CMakeLists.txt +++ b/channels/rdpsnd/client/alsa/CMakeLists.txt @@ -30,7 +30,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp - MODULES freerdp-utils) + MODULES freerdp-codec freerdp-utils) set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} diff --git a/channels/rdpsnd/client/pulse/CMakeLists.txt b/channels/rdpsnd/client/pulse/CMakeLists.txt index ab695b2c3..3d4a34b76 100644 --- a/channels/rdpsnd/client/pulse/CMakeLists.txt +++ b/channels/rdpsnd/client/pulse/CMakeLists.txt @@ -30,7 +30,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp - MODULES freerdp-utils) + MODULES freerdp-codec freerdp-utils) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${PULSE_LIBRARY}) diff --git a/channels/tsmf/client/alsa/CMakeLists.txt b/channels/tsmf/client/alsa/CMakeLists.txt index 2ad1dcb71..bf2528206 100644 --- a/channels/tsmf/client/alsa/CMakeLists.txt +++ b/channels/tsmf/client/alsa/CMakeLists.txt @@ -30,7 +30,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp - MODULES freerdp-utils) + MODULES freerdp-codec freerdp-utils) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${ALSA_LIBRARIES}) diff --git a/channels/tsmf/client/pulse/CMakeLists.txt b/channels/tsmf/client/pulse/CMakeLists.txt index 613485b80..c201b5253 100644 --- a/channels/tsmf/client/pulse/CMakeLists.txt +++ b/channels/tsmf/client/pulse/CMakeLists.txt @@ -30,7 +30,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp - MODULES freerdp-utils) + MODULES freerdp-codec freerdp-utils) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${PULSE_LIBRARY}) diff --git a/client/.gitignore b/client/.gitignore index 86106bc3c..8a070de0c 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,4 +1,10 @@ -WaykClient - - -DotNetClient \ No newline at end of file +/* +!/Android +!/common +!/DirectFB +!/iOS +!/Mac +!/Sample +!/Windows +!/X11 +!/CMakeLists.txt diff --git a/client/Android/ModuleOptions.cmake b/client/Android/ModuleOptions.cmake new file mode 100644 index 000000000..38f85b400 --- /dev/null +++ b/client/Android/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_CLIENT_NAME "afreerdp") +set(FREERDP_CLIENT_PLATFORM "Android") +set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e78c37517..3d79c27fa 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -51,10 +51,26 @@ if(ANDROID) add_subdirectory(Android) endif() -if(WITH_WAYK) - add_subdirectory(WaykClient) -endif() +# Pick up other clients + +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" FREERDP_CLIENT ${FILEPATH}) + set(FREERDP_CLIENT_ENABLED 0) + include(${FILEPATH}) + if(FREERDP_CLIENT_ENABLED) + if(NOT (${FREERDP_CLIENT_VENDOR} MATCHES "FreeRDP")) + list(APPEND FREERDP_EXTRA_CLIENTS ${FREERDP_CLIENT}) + endif() + endif() + endif() +endforeach() + +foreach(FREERDP_CLIENT ${FREERDP_EXTRA_CLIENTS}) + add_subdirectory(${FREERDP_CLIENT}) +endforeach() + -if (WITH_DOTNET) - add_subdirectory(DotNetClient) -endif() diff --git a/client/DirectFB/ModuleOptions.cmake b/client/DirectFB/ModuleOptions.cmake new file mode 100644 index 000000000..2ef9266f0 --- /dev/null +++ b/client/DirectFB/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_CLIENT_NAME "dfreerdp") +set(FREERDP_CLIENT_PLATFORM "DirectFB") +set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/Mac/CMakeLists.txt b/client/Mac/CMakeLists.txt index 2344f46a1..75b62161a 100755 --- a/client/Mac/CMakeLists.txt +++ b/client/Mac/CMakeLists.txt @@ -85,7 +85,6 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHI MODULE winpr MODULES winpr-input winpr-crt winpr-utils) -set_target_properties(${MODULE_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) # Set a list of the dependent targets used by the application. There should be a way to get this list automatically diff --git a/client/Mac/ModuleOptions.cmake b/client/Mac/ModuleOptions.cmake new file mode 100644 index 000000000..3902d2b71 --- /dev/null +++ b/client/Mac/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_CLIENT_NAME "mfreerdp") +set(FREERDP_CLIENT_PLATFORM "MacOSX") +set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/Sample/ModuleOptions.cmake b/client/Sample/ModuleOptions.cmake new file mode 100644 index 000000000..d4d5a9e44 --- /dev/null +++ b/client/Sample/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_CLIENT_NAME "sfreerdp") +set(FREERDP_CLIENT_PLATFORM "Sample") +set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/Windows/CMakeLists.txt b/client/Windows/CMakeLists.txt index f32422cd3..0f2b26d65 100644 --- a/client/Windows/CMakeLists.txt +++ b/client/Windows/CMakeLists.txt @@ -63,10 +63,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) if(WITH_CLIENT_INTERFACE) - if (NOT WITH_WAYK) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) add_subdirectory(cli) - endif() else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client) endif() diff --git a/client/Windows/ModuleOptions.cmake b/client/Windows/ModuleOptions.cmake new file mode 100644 index 000000000..a0fcaec59 --- /dev/null +++ b/client/Windows/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_CLIENT_NAME "wfreerdp") +set(FREERDP_CLIENT_PLATFORM "Windows") +set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/X11/ModuleOptions.cmake b/client/X11/ModuleOptions.cmake new file mode 100644 index 000000000..4fef68a2f --- /dev/null +++ b/client/X11/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_CLIENT_NAME "xfreerdp") +set(FREERDP_CLIENT_PLATFORM "X11") +set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/X11/xf_monitor.h b/client/X11/xf_monitor.h index 9e29eec85..316c5ad0d 100644 --- a/client/X11/xf_monitor.h +++ b/client/X11/xf_monitor.h @@ -20,6 +20,7 @@ #ifndef __XF_MONITOR_H #define __XF_MONITOR_H +#include #include #include @@ -43,8 +44,8 @@ typedef struct _VIRTUAL_SCREEN VIRTUAL_SCREEN; #include "xf_client.h" #include "xfreerdp.h" -int xf_list_monitors(xfContext* xfc); -BOOL xf_detect_monitors(xfContext* xfc, rdpSettings* settings); -void xf_monitors_free(xfContext *xfc, rdpSettings *settings); +FREERDP_API int xf_list_monitors(xfContext* xfc); +FREERDP_API BOOL xf_detect_monitors(xfContext* xfc, rdpSettings* settings); +FREERDP_API void xf_monitors_free(xfContext *xfc, rdpSettings *settings); #endif /* __XF_MONITOR_H */ diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index a7aaa70a2..9cb78b946 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -22,6 +22,8 @@ typedef struct xf_context xfContext; +#include + #include "xf_window.h" #include "xf_monitor.h" #include "xf_channels.h" @@ -215,7 +217,7 @@ void xf_unlock_x11(xfContext* xfc, BOOL display); void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h, BOOL scale); void xf_transform_window(xfContext* xfc); -DWORD xf_exit_code_from_disconnect_reason(DWORD reason); +FREERDP_API DWORD xf_exit_code_from_disconnect_reason(DWORD reason); #endif /* __XFREERDP_H */ diff --git a/client/common/CMakeLists.txt b/client/common/CMakeLists.txt index 2b9841e5f..a5cfd6ef6 100644 --- a/client/common/CMakeLists.txt +++ b/client/common/CMakeLists.txt @@ -52,11 +52,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHI target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) -set_target_properties(${MODULE_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") - -if (NOT WITH_WAYK) - install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) -endif() +install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Common") diff --git a/client/common/compatibility.h b/client/common/compatibility.h index 5d2077d27..358587c93 100644 --- a/client/common/compatibility.h +++ b/client/common/compatibility.h @@ -23,8 +23,8 @@ #include #include -int freerdp_detect_old_command_line_syntax(int argc, char** argv, int* count); -int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSettings* settings); +FREERDP_API int freerdp_detect_old_command_line_syntax(int argc, char** argv, int* count); +FREERDP_API int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSettings* settings); #endif /* FREERDP_CLIENT_COMPATIBILITY */ diff --git a/client/iOS/ModuleOptions.cmake b/client/iOS/ModuleOptions.cmake new file mode 100644 index 000000000..3c4b366bb --- /dev/null +++ b/client/iOS/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_CLIENT_NAME "ifreerdp") +set(FREERDP_CLIENT_PLATFORM "iOS") +set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/cmake/ComplexLibrary.cmake b/cmake/ComplexLibrary.cmake index 1b04f3f20..993fd2c52 100644 --- a/cmake/ComplexLibrary.cmake +++ b/cmake/ComplexLibrary.cmake @@ -1,4 +1,6 @@ + +include(EchoTarget) include(CMakeParseArguments) macro(set_complex_link_libraries) @@ -46,3 +48,32 @@ macro(add_complex_library) endif() endmacro(add_complex_library) + +if(${CMAKE_VERSION} VERSION_GREATER 2.8.8) + set(CMAKE_OBJECT_TARGET_SUPPORT 1) +endif() + +function(create_object_cotarget target) + + set(cotarget "${target}-objects") + + get_target_property(${target}_TYPE ${target} TYPE) + + if(NOT ((${target}_TYPE MATCHES "SHARED_LIBRARY") OR (${target}_TYPE MATCHES "SHARED_LIBRARY"))) + return() + endif() + + get_target_property(${target}_SOURCES ${target} SOURCES) + get_target_property(${target}_LINK_LIBRARIES ${target} LINK_LIBRARIES) + get_target_property(${target}_INCLUDE_DIRECTORIES ${target} INCLUDE_DIRECTORIES) + + add_library(${cotarget} "OBJECT" ${${target}_SOURCES}) + + set_target_properties(${cotarget} PROPERTIES LINK_LIBRARIES "${${target}_LINK_LIBRARIES}") + set_target_properties(${cotarget} PROPERTIES INCLUDE_DIRECTORIES "${${target}_INCLUDE_DIRECTORIES}") + + echo_target(${target}) + echo_target(${cotarget}) + +endfunction() + diff --git a/cmake/EchoTarget.cmake b/cmake/EchoTarget.cmake new file mode 100644 index 000000000..12759256b --- /dev/null +++ b/cmake/EchoTarget.cmake @@ -0,0 +1,178 @@ +function(echo_target_property tgt prop) + # v for value, d for defined, s for set + get_property(v TARGET ${tgt} PROPERTY ${prop}) + get_property(d TARGET ${tgt} PROPERTY ${prop} DEFINED) + get_property(s TARGET ${tgt} PROPERTY ${prop} SET) + + # only produce output for values that are set + if(s) + message("tgt='${tgt}' prop='${prop}'") + message(" value='${v}'") + message(" defined='${d}'") + message(" set='${s}'") + message("") + endif() +endfunction() + +function(echo_target tgt) + if(NOT TARGET ${tgt}) + message("There is no target named '${tgt}'") + return() + endif() + + set(props + DEBUG_OUTPUT_NAME + RELEASE_OUTPUT_NAME + DEBUG_POSTFIX + RELEASE_POSTFIX + ARCHIVE_OUTPUT_DIRECTORY + ARCHIVE_OUTPUT_DIRECTORY_DEBUG + ARCHIVE_OUTPUT_DIRECTORY_RELEASE + ARCHIVE_OUTPUT_NAME + ARCHIVE_OUTPUT_NAME_DEBUG + ARCHIVE_OUTPUT_NAME_RELEASE + AUTOMOC + AUTOMOC_MOC_OPTIONS + BUILD_WITH_INSTALL_RPATH + BUNDLE + BUNDLE_EXTENSION + COMPILE_DEFINITIONS + COMPILE_DEFINITIONS_DEBUG + COMPILE_DEFINITIONS_RELEASE + COMPILE_FLAGS + DEBUG_POSTFIX + DEFINE_SYMBOL + ENABLE_EXPORTS + EXCLUDE_FROM_ALL + EchoString + FOLDER + FRAMEWORK + Fortran_FORMAT + Fortran_MODULE_DIRECTORY + GENERATOR_FILE_NAME + GNUtoMS + HAS_CXX + IMPLICIT_DEPENDS_INCLUDE_TRANSFORM + IMPORTED + IMPORTED_CONFIGURATIONS + IMPORTED_IMPLIB + IMPORTED_IMPLIB_RELEASE + IMPORTED_IMPLIB_RELEASE + IMPORTED_LINK_DEPENDENT_LIBRARIES + IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG + IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE + IMPORTED_LINK_INTERFACE_LANGUAGES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE + IMPORTED_LINK_INTERFACE_LIBRARIES + IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG + IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE + IMPORTED_LINK_INTERFACE_MULTIPLICITY + IMPORTED_LINK_INTERFACE_MULTIPLICITY_DEBUG + IMPORTED_LINK_INTERFACE_MULTIPLICITY_RELEASE + IMPORTED_LOCATION + IMPORTED_LOCATION_DEBUG + IMPORTED_LOCATION_RELEASE + IMPORTED_NO_SONAME + IMPORTED_NO_SONAME_DEBUG + IMPORTED_NO_SONAME_RELEASE + IMPORTED_SONAME + IMPORTED_SONAME_DEBUG + IMPORTED_SONAME_RELEASE + IMPORT_PREFIX + IMPORT_SUFFIX + INCLUDE_DIRECTORIES + INSTALL_NAME_DIR + INSTALL_RPATH + INSTALL_RPATH_USE_LINK_PATH + INTERPROCEDURAL_OPTIMIZATION + INTERPROCEDURAL_OPTIMIZATION_DEBUG + INTERPROCEDURAL_OPTIMIZATION_RELEASE + LABELS + LIBRARY_OUTPUT_DIRECTORY + LIBRARY_OUTPUT_DIRECTORY_DEBUG + LIBRARY_OUTPUT_DIRECTORY_RELEASE + LIBRARY_OUTPUT_NAME + LIBRARY_OUTPUT_NAME_DEBUG + LIBRARY_OUTPUT_NAME_RELEASE + LINKER_LANGUAGE + LINK_DEPENDS + LINK_LIBRARIES + LINK_FLAGS + LINK_FLAGS_DEBUG + LINK_FLAGS_RELEASE + LINK_INTERFACE_LIBRARIES + LINK_INTERFACE_LIBRARIES_DEBUG + LINK_INTERFACE_LIBRARIES_RELEASE + LINK_INTERFACE_MULTIPLICITY + LINK_INTERFACE_MULTIPLICITY_DEBUG + LINK_INTERFACE_MULTIPLICITY_RELEASE + LINK_SEARCH_END_STATIC + LINK_SEARCH_START_STATIC + LOCATION + LOCATION_DEBUG + LOCATION_RELEASE + MACOSX_BUNDLE + MACOSX_BUNDLE_INFO_PLIST + MACOSX_FRAMEWORK_INFO_PLIST + MAP_IMPORTED_CONFIG_DEBUG + MAP_IMPORTED_CONFIG_RELEASE + OSX_ARCHITECTURES + OSX_ARCHITECTURES_DEBUG + OSX_ARCHITECTURES_RELEASE + OUTPUT_NAME + OUTPUT_NAME_DEBUG + OUTPUT_NAME_RELEASE + POST_INSTALL_SCRIPT + PREFIX + PRE_INSTALL_SCRIPT + PRIVATE_HEADER + PROJECT_LABEL + PUBLIC_HEADER + RESOURCE + RULE_LAUNCH_COMPILE + RULE_LAUNCH_CUSTOM + RULE_LAUNCH_LINK + RUNTIME_OUTPUT_DIRECTORY + RUNTIME_OUTPUT_DIRECTORY_DEBUG + RUNTIME_OUTPUT_DIRECTORY_RELEASE + RUNTIME_OUTPUT_NAME + RUNTIME_OUTPUT_NAME_DEBUG + RUNTIME_OUTPUT_NAME_RELEASE + SKIP_BUILD_RPATH + SOURCES + SOVERSION + STATIC_LIBRARY_FLAGS + STATIC_LIBRARY_FLAGS_DEBUG + STATIC_LIBRARY_FLAGS_RELEASE + SUFFIX + TYPE + VERSION + VS_DOTNET_REFERENCES + VS_GLOBAL_KEYWORD + VS_GLOBAL_PROJECT_TYPES + VS_KEYWORD + VS_SCC_AUXPATH + VS_SCC_LOCALPATH + VS_SCC_PROJECTNAME + VS_SCC_PROVIDER + VS_WINRT_EXTENSIONS + VS_WINRT_REFERENCES + WIN32_EXECUTABLE + ) + + message("======================== ${tgt} ========================") + foreach(p ${props}) + echo_target_property("${tgt}" "${p}") + endforeach() + message("") + +endfunction() + +function(echo_targets) + set(tgts ${ARGV}) + foreach(t ${tgts}) + echo_target("${t}") + endforeach() +endfunction() + diff --git a/cmake/MergeStaticLibs.cmake b/cmake/MergeStaticLibs.cmake index a0673fa7e..4fa5dad9c 100644 --- a/cmake/MergeStaticLibs.cmake +++ b/cmake/MergeStaticLibs.cmake @@ -12,16 +12,19 @@ # You should have received a copy of the FMILIB_License.txt file # along with this program. If not, contact Modelon AB . -# Merge_static_libs(outlib lib1 lib2 ... libn) merges a number of static +# Merge_static_libs(output_library lib1 lib2 ... libn) merges a number of static # libs into a single static library -function(merge_static_libs outlib) +function(merge_static_libs output_library) + set(output_target "${output_library}") + string(REGEX REPLACE "-" "_" output_library ${output_library}) set(libs ${ARGV}) list(REMOVE_AT libs 0) -# Create a dummy file that the target will depend on - set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/${outlib}_dummy.c) + + # Create a dummy file that the target will depend on + set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/${output_library}_dummy.c) file(WRITE ${dummyfile} "const char * dummy = \"${dummyfile}\";") - add_library(${outlib} STATIC ${dummyfile}) + add_library(${output_target} STATIC ${dummyfile}) if("${CMAKE_CFG_INTDIR}" STREQUAL ".") set(multiconfig FALSE) @@ -29,7 +32,7 @@ function(merge_static_libs outlib) set(multiconfig TRUE) endif() -# First get the file names of the libraries to be merged + # First get the file names of the libraries to be merged foreach(lib ${libs}) get_target_property(libtype ${lib} TYPE) if(NOT libtype STREQUAL "STATIC_LIBRARY") @@ -45,8 +48,8 @@ function(merge_static_libs outlib) list(APPEND libfiles "${libfile}") endif(multiconfig) endforeach() - #message(STATUS "will be merging ${libfiles}") -# Just to be sure: cleanup from duplicates + + # Just to be sure: cleanup from duplicates if(multiconfig) foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES}) list(REMOVE_DUPLICATES libfiles_${CONFIG_TYPE}) @@ -55,7 +58,7 @@ function(merge_static_libs outlib) endif() list(REMOVE_DUPLICATES libfiles) -# Now the easy part for MSVC and for MAC + # Now the easy part for MSVC and for MAC if(MSVC) # lib.exe does the merging of libraries just need to conver the list into string foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES}) @@ -64,7 +67,7 @@ function(merge_static_libs outlib) set(flags "${flags} ${lib}") endforeach() string(TOUPPER "STATIC_LIBRARY_FLAGS_${CONFIG_TYPE}" PROPNAME) - set_target_properties(${outlib} PROPERTIES ${PROPNAME} "${flags}") + set_target_properties(${output_target} PROPERTIES ${PROPNAME} "${flags}") endforeach() elseif(APPLE) @@ -72,8 +75,8 @@ function(merge_static_libs outlib) if(multiconfig) message(FATAL_ERROR "Multiple configurations are not supported") endif() - get_target_property(outfile ${outlib} LOCATION) - add_custom_command(TARGET ${outlib} POST_BUILD + get_target_property(outfile ${output_target} LOCATION) + add_custom_command(TARGET ${output_target} POST_BUILD COMMAND rm ${outfile} COMMAND /usr/bin/libtool -static -o ${outfile} ${libfiles} @@ -83,48 +86,66 @@ function(merge_static_libs outlib) if(multiconfig) message(FATAL_ERROR "Multiple configurations are not supported") endif() - get_target_property(outfile ${outlib} LOCATION) - message(STATUS "outfile location is ${outfile}") + get_target_property(outfile ${output_target} LOCATION) + message(STATUS "output file location is ${outfile}") foreach(lib ${libfiles}) -# objlistfile will contain the list of object files for the library + # objlistfile will contain the list of object files for the library set(objlistfile ${lib}.objlist) set(objdir ${lib}.objdir) set(objlistcmake ${objlistfile}.cmake) -# we only need to extract files once + get_filename_component(libname ${lib} NAME_WE) + if(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cmake.check_cache IS_NEWER_THAN ${objlistcmake}) -#--------------------------------- - FILE(WRITE ${objlistcmake} -"# Extract object files from the library -message(STATUS \"Extracting object files from ${lib}\") -EXECUTE_PROCESS(COMMAND ${CMAKE_AR} -x ${lib} - WORKING_DIRECTORY ${objdir}) -# save the list of object files -EXECUTE_PROCESS(COMMAND ls . - OUTPUT_FILE ${objlistfile} - WORKING_DIRECTORY ${objdir})") -#--------------------------------- + + file(WRITE ${objlistcmake} " + # delete previous object files + message(STATUS \"Removing previous object files from ${lib}\") + EXECUTE_PROCESS(COMMAND ls . + WORKING_DIRECTORY ${objdir} + COMMAND xargs -I {} rm {} + WORKING_DIRECTORY ${objdir}) + # Extract object files from the library + message(STATUS \"Extracting object files from ${lib}\") + EXECUTE_PROCESS(COMMAND ${CMAKE_AR} -x ${lib} + WORKING_DIRECTORY ${objdir}) + # Prefixing object files to avoid conflicts + message(STATUS \"Prefixing object files to avoid conflicts\") + EXECUTE_PROCESS(COMMAND ls . + WORKING_DIRECTORY ${objdir} + COMMAND xargs -I {} mv {} ${libname}_{} + WORKING_DIRECTORY ${objdir}) + # save the list of object files + EXECUTE_PROCESS(COMMAND ls . + OUTPUT_FILE ${objlistfile} + WORKING_DIRECTORY ${objdir}) + ") + file(MAKE_DIRECTORY ${objdir}) + add_custom_command( OUTPUT ${objlistfile} COMMAND ${CMAKE_COMMAND} -P ${objlistcmake} DEPENDS ${lib}) + endif() + list(APPEND extrafiles "${objlistfile}") # relative path is needed by ar under MSYS file(RELATIVE_PATH objlistfilerpath ${objdir} ${objlistfile}) - add_custom_command(TARGET ${outlib} POST_BUILD + add_custom_command(TARGET ${output_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo "Running: ${CMAKE_AR} ru ${outfile} @${objlistfilerpath}" COMMAND ${CMAKE_AR} ru "${outfile}" @"${objlistfilerpath}" - WORKING_DIRECTORY ${objdir}) + #COMMAND ld -r -static -o "${outfile}" --whole-archive @"${objlistfilerpath}" + WORKING_DIRECTORY ${objdir}) endforeach() - add_custom_command(TARGET ${outlib} POST_BUILD + add_custom_command(TARGET ${output_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo "Running: ${CMAKE_RANLIB} ${outfile}" COMMAND ${CMAKE_RANLIB} ${outfile}) endif() - file(WRITE ${dummyfile}.base "const char* ${outlib}_sublibs=\"${libs}\";") + file(WRITE ${dummyfile}.base "const char* ${output_library}_sublibs=\"${libs}\";") add_custom_command( - OUTPUT ${dummyfile} - COMMAND ${CMAKE_COMMAND} -E copy ${dummyfile}.base ${dummyfile} + OUTPUT ${dummyfile} + COMMAND ${CMAKE_COMMAND} -E copy ${dummyfile}.base ${dummyfile} DEPENDS ${libs} ${extrafiles}) endfunction() diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index bbc714b15..3a167bcf5 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -59,11 +59,7 @@ if(MONOLITHIC_BUILD) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) - if(NOT WITH_WAYK) - install(TARGETS ${MODULE_NAME} - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT libraries) - endif() + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") endif() diff --git a/libfreerdp/core/CMakeLists.txt b/libfreerdp/core/CMakeLists.txt index 9cf9ed8c2..b04b1f79a 100644 --- a/libfreerdp/core/CMakeLists.txt +++ b/libfreerdp/core/CMakeLists.txt @@ -136,7 +136,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE winpr - MODULES winpr-registry winpr-utils winpr-interlocked winpr-dsparse winpr-sspi winpr-rpc winpr-crt) + MODULES winpr-registry winpr-utils winpr-interlocked winpr-dsparse winpr-sspi winpr-rpc winpr-handle winpr-crt) if(MONOLITHIC_BUILD) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) diff --git a/libfreerdp/dummy.c b/libfreerdp/dummy.c index b959f9be3..fb941c948 100644 --- a/libfreerdp/dummy.c +++ b/libfreerdp/dummy.c @@ -1,5 +1,5 @@ -int dummy() +int freerdp_dummy() { return 0; } diff --git a/libfreerdp/gdi/gdi.c b/libfreerdp/gdi/gdi.c index 566a12d13..f72f6b2e0 100644 --- a/libfreerdp/gdi/gdi.c +++ b/libfreerdp/gdi/gdi.c @@ -917,10 +917,20 @@ void gdi_register_update_callbacks(rdpUpdate* update) void gdi_init_primary(rdpGdi* gdi) { - gdi->primary = gdi_bitmap_new_ex(gdi, gdi->width, gdi->height, gdi->dstBpp, gdi->primary_buffer); + gdi->primary = (gdiBitmap*) malloc(sizeof(gdiBitmap)); + gdi->primary->hdc = gdi_CreateCompatibleDC(gdi->hdc); + + if (!gdi->primary_buffer) + gdi->primary->bitmap = gdi_CreateCompatibleBitmap(gdi->hdc, gdi->width, gdi->height); + else + gdi->primary->bitmap = gdi_CreateBitmap(gdi->width, gdi->height, gdi->dstBpp, gdi->primary_buffer); + + gdi_SelectObject(gdi->primary->hdc, (HGDIOBJECT) gdi->primary->bitmap); + gdi->primary->org_bitmap = NULL; + gdi->primary_buffer = gdi->primary->bitmap->data; - if (gdi->drawing == NULL) + if (!gdi->drawing) gdi->drawing = gdi->primary; gdi->primary->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND)); diff --git a/libfreerdp/utils/svc_plugin.c b/libfreerdp/utils/svc_plugin.c index f0869a6c6..de7c895de 100644 --- a/libfreerdp/utils/svc_plugin.c +++ b/libfreerdp/utils/svc_plugin.c @@ -133,6 +133,7 @@ static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, UINT3 } plugin->data_in = NULL; + Stream_SealLength(data_in); Stream_SetPosition(data_in, 0); MessageQueue_Post(plugin->MsgPipe->In, NULL, 0, (void*) data_in, NULL); diff --git a/server/.gitignore b/server/.gitignore index e8786806f..b5581fbbc 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -1,3 +1,7 @@ -WaykServer -xrdp-ng - +/* +!/common +!/Mac +!/Sample +!/Windows +!/X11 +!/CmakeLists.txt diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index fed64d78c..a7c3ec233 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -35,13 +35,28 @@ else() add_subdirectory(Windows) endif() -if(WITH_WAYK) - if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/WaykServer") - add_subdirectory(WaykServer) - endif() -endif() - if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/xrdp-ng") add_subdirectory("xrdp-ng") endif() +# Pick up other clients + +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" FREERDP_SERVER ${FILEPATH}) + set(FREERDP_SERVER_ENABLED 0) + include(${FILEPATH}) + if(FREERDP_SERVER_ENABLED) + if(NOT (${FREERDP_SERVER_VENDOR} MATCHES "FreeRDP")) + list(APPEND FREERDP_EXTRA_SERVERS ${FREERDP_SERVER}) + endif() + endif() + endif() +endforeach() + +foreach(FREERDP_SERVER ${FREERDP_EXTRA_SERVERS}) + add_subdirectory(${FREERDP_SERVER}) +endforeach() diff --git a/server/Mac/ModuleOptions.cmake b/server/Mac/ModuleOptions.cmake new file mode 100644 index 000000000..bfd36cbbf --- /dev/null +++ b/server/Mac/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_SERVER_NAME "mfreerdp-server") +set(FREERDP_SERVER_PLATFORM "X11") +set(FREERDP_SERVER_VENDOR "FreeRDP") diff --git a/server/Sample/ModuleOptions.cmake b/server/Sample/ModuleOptions.cmake new file mode 100644 index 000000000..5621f6d78 --- /dev/null +++ b/server/Sample/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_SERVER_NAME "sfreerdp-server") +set(FREERDP_SERVER_PLATFORM "Sample") +set(FREERDP_SERVER_VENDOR "FreeRDP") diff --git a/server/Windows/ModuleOptions.cmake b/server/Windows/ModuleOptions.cmake new file mode 100644 index 000000000..69d759661 --- /dev/null +++ b/server/Windows/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_SERVER_NAME "wfreerdp-server") +set(FREERDP_SERVER_PLATFORM "Windows") +set(FREERDP_SERVER_VENDOR "FreeRDP") diff --git a/server/X11/ModuleOptions.cmake b/server/X11/ModuleOptions.cmake new file mode 100644 index 000000000..fcba05934 --- /dev/null +++ b/server/X11/ModuleOptions.cmake @@ -0,0 +1,4 @@ + +set(FREERDP_SERVER_NAME "xfreerdp-server") +set(FREERDP_SERVER_PLATFORM "X11") +set(FREERDP_SERVER_VENDOR "FreeRDP") diff --git a/server/common/CMakeLists.txt b/server/common/CMakeLists.txt index f33fb1b15..d0fc89f59 100644 --- a/server/common/CMakeLists.txt +++ b/server/common/CMakeLists.txt @@ -38,7 +38,6 @@ 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/winpr/libwinpr/dummy.c b/winpr/libwinpr/dummy.c index b959f9be3..bd2de4583 100644 --- a/winpr/libwinpr/dummy.c +++ b/winpr/libwinpr/dummy.c @@ -1,5 +1,5 @@ -int dummy() +int winpr_dummy() { return 0; } diff --git a/winpr/libwinpr/path/CMakeLists.txt b/winpr/libwinpr/path/CMakeLists.txt index 59eaf6875..ecd9b0bca 100644 --- a/winpr/libwinpr/path/CMakeLists.txt +++ b/winpr/libwinpr/path/CMakeLists.txt @@ -28,10 +28,15 @@ add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT" set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") +set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS + MONOLITHIC ${MONOLITHIC_BUILD} INTERNAL + MODULE winpr + MODULES winpr-crt winpr-heap winpr-environment) + if(MONOLITHIC_BUILD) - + else() - target_link_libraries(${MODULE_NAME} winpr-crt winpr-heap winpr-environment) + target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif()