From 9c19c7361f4a62f675af7c43a29f192e45d73d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 9 Jan 2019 09:30:31 +0100 Subject: [PATCH 1/7] Support Unix Makefiles --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ecad9444..9d0e71d60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -482,7 +482,7 @@ if(WIN32) add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) set(CMAKE_USE_RELATIVE_PATH ON) - if (${CMAKE_GENERATOR} MATCHES "NMake Makefile*" OR ${CMAKE_GENERATOR} MATCHES "Ninja*") + if (${CMAKE_GENERATOR} MATCHES "NMake Makefile*" OR ${CMAKE_GENERATOR} MATCHES "Ninja*" OR ${CMAKE_GENERATOR} MATCHES "Unix Makefiles") set(CMAKE_PDB_BINARY_DIR ${CMAKE_BINARY_DIR}) elseif (${CMAKE_GENERATOR} MATCHES "Visual Studio*") set(CMAKE_PDB_BINARY_DIR "${CMAKE_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}") From 30cd1ba1abef9aa1d5924b918e9215b5d1fdc901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 9 Jan 2019 09:36:28 +0100 Subject: [PATCH 2/7] Use lowercase for includes and libs Makes build possible on case sensitive systems such as MinGW on Linux. --- channels/audin/client/winmm/audin_winmm.c | 4 ++-- channels/rdpsnd/client/winmm/rdpsnd_winmm.c | 4 ++-- client/Windows/wf_cliprdr.c | 10 +++++----- winpr/include/winpr/path.h | 2 +- winpr/libwinpr/CMakeLists.txt | 2 +- winpr/libwinpr/path/shell.c | 2 +- winpr/libwinpr/utils/CMakeLists.txt | 2 +- winpr/libwinpr/utils/debug.c | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/channels/audin/client/winmm/audin_winmm.c b/channels/audin/client/winmm/audin_winmm.c index 5e210055f..00f098d80 100644 --- a/channels/audin/client/winmm/audin_winmm.c +++ b/channels/audin/client/winmm/audin_winmm.c @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c index c61e02c03..b9a46e875 100644 --- a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c +++ b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/client/Windows/wf_cliprdr.c b/client/Windows/wf_cliprdr.c index 0d65ee21e..a2be14cd8 100644 --- a/client/Windows/wf_cliprdr.c +++ b/client/Windows/wf_cliprdr.c @@ -27,10 +27,10 @@ #define CINTERFACE #define COBJMACROS -#include -#include -#include -#include +#include +#include +#include +#include #include @@ -41,7 +41,7 @@ #include #include -#include +#include #include "wf_cliprdr.h" diff --git a/winpr/include/winpr/path.h b/winpr/include/winpr/path.h index 2e1902ebf..8f9a9d0d6 100644 --- a/winpr/include/winpr/path.h +++ b/winpr/include/winpr/path.h @@ -309,7 +309,7 @@ WINPR_API BOOL PathIsDirectoryEmptyW(LPCWSTR pszPath); #endif #ifdef _WIN32 -#include +#include #endif #endif /* WINPR_PATH_H */ diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index 078f774f6..ff29801f0 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -121,7 +121,7 @@ if (WIN32) @ONLY) set (WINPR_SRCS ${WINPR_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - list(APPEND WINPR_LIBS "Shlwapi") + list(APPEND WINPR_LIBS "shlwapi") endif() add_library(${MODULE_NAME} ${WINPR_SRCS}) diff --git a/winpr/libwinpr/path/shell.c b/winpr/libwinpr/path/shell.c index d8b9456ba..ecdd67134 100644 --- a/winpr/libwinpr/path/shell.c +++ b/winpr/libwinpr/path/shell.c @@ -41,7 +41,7 @@ #endif #if defined(WIN32) -#include +#include #else #include #include diff --git a/winpr/libwinpr/utils/CMakeLists.txt b/winpr/libwinpr/utils/CMakeLists.txt index b0e828819..335958d9a 100644 --- a/winpr/libwinpr/utils/CMakeLists.txt +++ b/winpr/libwinpr/utils/CMakeLists.txt @@ -147,7 +147,7 @@ if((FREEBSD) AND (NOT KFREEBSD)) endif() if(WIN32) - winpr_library_add(Dbghelp) + winpr_library_add(dbghelp) endif() if(BUILD_TESTING) diff --git a/winpr/libwinpr/utils/debug.c b/winpr/libwinpr/utils/debug.c index ae199231a..e344e3aef 100644 --- a/winpr/libwinpr/utils/debug.c +++ b/winpr/libwinpr/utils/debug.c @@ -36,8 +36,8 @@ #if defined(_WIN32) || defined(_WIN64) #include -#include -#include +#include +#include #define write _write #endif From fcf59b9c4f936a96d28250ba88d0c48ace1f4e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 9 Jan 2019 09:52:27 +0100 Subject: [PATCH 3/7] Add msimg32 library through CMake MinGW does not support libs through #pragma comments. --- client/Windows/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/client/Windows/CMakeLists.txt b/client/Windows/CMakeLists.txt index c645baf81..627457198 100644 --- a/client/Windows/CMakeLists.txt +++ b/client/Windows/CMakeLists.txt @@ -78,6 +78,7 @@ endif() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr freerdp) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} msimg32) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) if(WITH_CLIENT_INTERFACE) From 6619de070ab0da8e4586f7c70b0d82437004169c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 9 Jan 2019 09:54:31 +0100 Subject: [PATCH 4/7] freerdp_client_set_window_size should not be static Avoid GCC error, since it is not static according to wf_client.h. --- client/Windows/wf_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/Windows/wf_client.c b/client/Windows/wf_client.c index 3cd396d0f..b14ada157 100644 --- a/client/Windows/wf_client.c +++ b/client/Windows/wf_client.c @@ -783,7 +783,7 @@ static int freerdp_client_focus_out(wfContext* wfc) return 0; } -static int freerdp_client_set_window_size(wfContext* wfc, int width, int height) +int freerdp_client_set_window_size(wfContext* wfc, int width, int height) { WLog_DBG(TAG, "freerdp_client_set_window_size %d, %d", width, height); From ea35e2387dd74867642e199ba70b12adf46bc616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 9 Jan 2019 10:01:44 +0100 Subject: [PATCH 5/7] Check MSVC_RUNTIME only if MSVC is defined On MinGW, WIN32 is set but not MSVC --- cmake/FindOpenSSL.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FindOpenSSL.cmake b/cmake/FindOpenSSL.cmake index 35af2e50e..11874e085 100644 --- a/cmake/FindOpenSSL.cmake +++ b/cmake/FindOpenSSL.cmake @@ -63,13 +63,13 @@ FIND_PATH(OPENSSL_INCLUDE_DIR include ) -IF(WIN32) +IF(MSVC) if(${MSVC_RUNTIME} STREQUAL "static") set(MSVC_RUNTIME_SUFFIX "MT") else() set(MSVC_RUNTIME_SUFFIX "MD") endif() -ENDIF(WIN32) +ENDIF(MSVC) IF(ANDROID) FIND_LIBRARY(OPENSSL_LIBRARIES From 32ba90ec0ac315624117a05f82b4b028ee857774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 9 Jan 2019 10:04:38 +0100 Subject: [PATCH 6/7] Avoid building POSIX clipboard if WIN32 MinGW has unistd.h. --- winpr/libwinpr/clipboard/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winpr/libwinpr/clipboard/CMakeLists.txt b/winpr/libwinpr/clipboard/CMakeLists.txt index 1383fcc18..8c5520000 100644 --- a/winpr/libwinpr/clipboard/CMakeLists.txt +++ b/winpr/libwinpr/clipboard/CMakeLists.txt @@ -20,7 +20,8 @@ winpr_module_add( clipboard.c clipboard.h) -if(HAVE_UNISTD_H) +# MinGW has unistd.h +if(HAVE_UNISTD_H AND NOT WIN32) winpr_definition_add(-DWITH_WCLIPBOARD_POSIX) winpr_module_add( posix.h From a7f4b90f361b04e9b035bee340d5853239ce55b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 9 Jan 2019 11:13:38 +0100 Subject: [PATCH 7/7] Pointer arithmetics require lvalue (type *)x evaluates to a temporary. Fixed build with GCC. --- winpr/libwinpr/wtsapi/wtsapi_win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winpr/libwinpr/wtsapi/wtsapi_win32.c b/winpr/libwinpr/wtsapi/wtsapi_win32.c index 5c85d1235..8b12a3ed6 100644 --- a/winpr/libwinpr/wtsapi/wtsapi_win32.c +++ b/winpr/libwinpr/wtsapi/wtsapi_win32.c @@ -413,7 +413,7 @@ BOOL WINAPI Win32_WTSVirtualChannelRead_Static(WTSAPI_CHANNEL* pChannel, DWORD d CopyMemory(lpBuffer, pChannel->chunk, numBytesToRead); *lpNumberOfBytesTransferred += numBytesToRead; - ((BYTE*) lpBuffer) += numBytesToRead; + lpBuffer = (BYTE*)lpBuffer + numBytesToRead; nNumberOfBytesToRead -= numBytesToRead; pChannel->readOffset += numBytesToRead; @@ -524,7 +524,7 @@ BOOL WINAPI Win32_WTSVirtualChannelRead_Dynamic(WTSAPI_CHANNEL* pChannel, DWORD CopyMemory(lpBuffer, pChannel->header, numBytesRead); *lpNumberOfBytesTransferred += numBytesRead; - ((BYTE*) lpBuffer) += numBytesRead; + lpBuffer = (BYTE*)lpBuffer + numBytesRead; nNumberOfBytesToRead -= numBytesRead; }