From d1282541591a2a3737112478bd45cf00780bf9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Tue, 16 Aug 2011 20:49:46 -0400 Subject: [PATCH] windows: fix most compilation errors, linker errors and warnings left --- CMakeLists.txt | 1 + client/test/freerdp.c | 11 +++++++---- libfreerdp-core/crypto.h | 2 +- libfreerdp-core/tcp.c | 1 - libfreerdp-core/tcp.h | 3 ++- libfreerdp-rail/CMakeLists.txt | 2 ++ libfreerdp-utils/CMakeLists.txt | 4 ++++ libfreerdp-utils/registry.c | 4 ++++ 8 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 74c920c13..cb152640b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ if(CMAKE_COMPILER_IS_GNUCC) endif() if(MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_X86_") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN") diff --git a/client/test/freerdp.c b/client/test/freerdp.c index cbc39021f..a5ba6d4ee 100644 --- a/client/test/freerdp.c +++ b/client/test/freerdp.c @@ -17,12 +17,15 @@ * limitations under the License. */ -#include -#include -#include +#ifndef _WIN32 #include -#include +#include #include +#endif + +#include +#include +#include #include #include #include diff --git a/libfreerdp-core/crypto.h b/libfreerdp-core/crypto.h index ebff96289..5a8746790 100644 --- a/libfreerdp-core/crypto.h +++ b/libfreerdp-core/crypto.h @@ -21,7 +21,7 @@ #define __CRYPTO_H #ifdef _WIN32 -#include +#include "tcp.h" #endif #include diff --git a/libfreerdp-core/tcp.c b/libfreerdp-core/tcp.c index a0c6200ee..ae724ebf0 100644 --- a/libfreerdp-core/tcp.c +++ b/libfreerdp-core/tcp.c @@ -32,7 +32,6 @@ #include #include #else -#define socklen_t int #define close(_fd) closesocket(_fd) #endif diff --git a/libfreerdp-core/tcp.h b/libfreerdp-core/tcp.h index dec673dbf..b9277ff12 100644 --- a/libfreerdp-core/tcp.h +++ b/libfreerdp-core/tcp.h @@ -23,7 +23,8 @@ #ifdef _WIN32 #include -#include +#include +#include #endif #include diff --git a/libfreerdp-rail/CMakeLists.txt b/libfreerdp-rail/CMakeLists.txt index b4140fc8c..fcd907912 100644 --- a/libfreerdp-rail/CMakeLists.txt +++ b/libfreerdp-rail/CMakeLists.txt @@ -26,4 +26,6 @@ add_library(freerdp-rail SHARED ${FREERDP_RAIL_SRCS}) set_target_properties(freerdp-rail PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION}) +target_link_libraries(freerdp-rail freerdp-utils) + install(TARGETS freerdp-rail DESTINATION lib) diff --git a/libfreerdp-utils/CMakeLists.txt b/libfreerdp-utils/CMakeLists.txt index 938ba8187..2ab3bcdf1 100644 --- a/libfreerdp-utils/CMakeLists.txt +++ b/libfreerdp-utils/CMakeLists.txt @@ -50,4 +50,8 @@ set_target_properties(freerdp-utils PROPERTIES VERSION ${FREERDP_VERSION_FULL} S target_link_libraries(freerdp-utils ${CMAKE_THREAD_LIBS_INIT}) +if(WIN32) + target_link_libraries(freerdp-utils ws2_32) +endif() + install(TARGETS freerdp-utils DESTINATION lib) diff --git a/libfreerdp-utils/registry.c b/libfreerdp-utils/registry.c index f7322c7d2..ab426cbb1 100644 --- a/libfreerdp-utils/registry.c +++ b/libfreerdp-utils/registry.c @@ -19,6 +19,10 @@ #include +#ifdef _WIN32 +#include +#endif + static char registry_dir[] = "freerdp"; static char registry_file[] = "config.txt";