From ce5e52ba6f20c355d89d91dd4afffd0d84875a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Fri, 18 Jan 2013 20:47:18 -0500 Subject: [PATCH] libfreerdp-primitives: fix build on Windows --- libfreerdp/core/orders.c | 16 +++--- libfreerdp/primitives/CMakeLists.txt | 63 +++++++++++------------ libfreerdp/primitives/test/CMakeLists.txt | 2 + libfreerdp/primitives/test/measure.h | 4 ++ libfreerdp/primitives/test/prim_test.c | 9 ++++ libfreerdp/primitives/test/prim_test.h | 2 + 6 files changed, 54 insertions(+), 42 deletions(-) diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index 4232a5c67..4be63fdf4 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -502,7 +502,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int if (orderInfo->fieldFlags & (1 << (NO-1))) \ { \ if (stream_get_left(s) < 1) {\ - printf("%s: error reading %s\n", __func__, #TARGET); \ + printf("%s: error reading %s\n", __FUNCTION__, #TARGET); \ return FALSE; \ } \ stream_read_BYTE(s, TARGET); \ @@ -514,7 +514,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int if (orderInfo->fieldFlags & (1 << (NO-1))) \ { \ if (stream_get_left(s) < 2) { \ - printf("%s: error reading %s or %s\n", __func__, #TARGET1, #TARGET2); \ + printf("%s: error reading %s or %s\n", __FUNCTION__, #TARGET1, #TARGET2); \ return FALSE; \ } \ stream_read_BYTE(s, TARGET1); \ @@ -527,7 +527,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int if (orderInfo->fieldFlags & (1 << (NO-1))) \ { \ if (stream_get_left(s) < 2) { \ - printf("%s: error reading %s\n", __func__, #TARGET); \ + printf("%s: error reading %s\n", __FUNCTION__, #TARGET); \ return FALSE; \ } \ stream_read_UINT16(s, TARGET); \ @@ -538,7 +538,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int if (orderInfo->fieldFlags & (1 << (NO-1))) \ { \ if (stream_get_left(s) < 4) { \ - printf("%s: error reading %s\n", __func__, #TARGET); \ + printf("%s: error reading %s\n", __FUNCTION__, #TARGET); \ return FALSE; \ } \ stream_read_UINT32(s, TARGET); \ @@ -548,14 +548,14 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int #define ORDER_FIELD_COORD(NO, TARGET) \ do { \ if ((orderInfo->fieldFlags & (1 << (NO-1))) && !update_read_coord(s, &TARGET, orderInfo->deltaCoordinates)) { \ - printf("%s: error reading %s\n", __func__, #TARGET); \ + printf("%s: error reading %s\n", __FUNCTION__, #TARGET); \ return FALSE; \ } \ } while(0) #define ORDER_FIELD_COLOR(NO, TARGET) \ do { \ if ((orderInfo->fieldFlags & (1 << (NO-1))) && !update_read_color(s, &TARGET)) { \ - printf("%s: error reading %s\n", __func__, #TARGET); \ + printf("%s: error reading %s\n", __FUNCTION__, #TARGET); \ return FALSE; \ } \ } while(0) @@ -564,12 +564,12 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int #define FIELD_SKIP_BUFFER16(s, TARGET_LEN) \ do { \ if (stream_get_left(s) < 2) {\ - printf("%s: error reading length %s\n", __func__, #TARGET_LEN); \ + printf("%s: error reading length %s\n", __FUNCTION__, #TARGET_LEN); \ return FALSE; \ }\ stream_read_UINT16(s, TARGET_LEN); \ if (!stream_skip(s, TARGET_LEN)) { \ - printf("%s: error skipping %d bytes\n", __func__, TARGET_LEN); \ + printf("%s: error skipping %d bytes\n", __FUNCTION__, TARGET_LEN); \ return FALSE; \ } \ } while(0) diff --git a/libfreerdp/primitives/CMakeLists.txt b/libfreerdp/primitives/CMakeLists.txt index 92f495e72..873ed2cbf 100644 --- a/libfreerdp/primitives/CMakeLists.txt +++ b/libfreerdp/primitives/CMakeLists.txt @@ -13,24 +13,20 @@ # and limitations under the License. # -set(FREERDP_PRIMITIVE_CFILES - prim_add.c - prim_andor.c - prim_alphaComp.c - prim_colors.c - prim_copy.c - prim_set.c - prim_shift.c - prim_sign.c +set(MODULE_NAME "freerdp-primitives") +set(MODULE_PREFIX "FREERDP_PRIMITIVES") + +set(${MODULE_PREFIX}_SRCS + prim_add.c + prim_andor.c + prim_alphaComp.c + prim_colors.c + prim_copy.c + prim_set.c + prim_shift.c + prim_sign.c primitives.c - ) -set(FREERDP_PRIMITIVE_HEADERS - prim_internal.h - ) -set(FREERDP_PRIMITIVE_SRCS - ${FREERDP_PRIMITIVE_CFILES} - ${FREERDP_PRIMITIVE_HEADERS} - ) + prim_internal.h) add_definitions(-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) @@ -53,29 +49,28 @@ if(WITH_SSE2) endif() elseif(WITH_NEON) if(CMAKE_COMPILER_IS_GNUCC) - set(OPTIMZATION "${OPTIMIZATION} -mfpu=neon -mfloat-abi=softfp") + set(OPTIMIZATION "${OPTIMIZATION} -mfpu=neon -mfloat-abi=softfp") endif() # TODO: Add MSVC equivalent endif() -set_property(SOURCE ${FREERDP_PRIMITIVE_CFILES} PROPERTY COMPILE_FLAGS ${OPTIMIZATION}) -if(WITH_MONOLITHIC_BUILD) - add_library(freerdp-primitives OBJECT ${FREERDP_PRIMITIVE_SRCS}) +set_property(SOURCE ${${MODULE_PREFIX}_SRCS} PROPERTY COMPILE_FLAGS ${OPTIMIZATION}) + +add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT" + MONOLITHIC ${MONOLITHIC_BUILD} + SOURCES ${${MODULE_PREFIX}_SRCS}) + +set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") + +if(MONOLITHIC_BUILD) + set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() - add_library(freerdp-primitives ${FREERDP_PRIMITIVE_SRCS}) + target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_target_properties(freerdp-primitives PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") -#set(FREERDP_PRIMITIVE_LIBS, rt) - -if(WITH_MONOLITHIC_BUILD) - set(FREERDP_LIBS ${FREERDP_LIBS} ${FREERDP_PRIMITIVE_LIBS} PARENT_SCOPE) -else() - target_link_libraries(freerdp-primitives ${FREERDP_PRIMITIVE_LIBS}) - install(TARGETS freerdp-primitives DESTINATION ${CMAKE_INSTALL_LIBDIR}) -endif() - -if(BUILD_TESTING) +if(BUILD_TESTING AND (NOT WIN32)) add_subdirectory(test) -endif(BUILD_TESTING) +endif() diff --git a/libfreerdp/primitives/test/CMakeLists.txt b/libfreerdp/primitives/test/CMakeLists.txt index 71d23b018..c1987c180 100644 --- a/libfreerdp/primitives/test/CMakeLists.txt +++ b/libfreerdp/primitives/test/CMakeLists.txt @@ -137,3 +137,5 @@ if(NOT TESTING_OUTPUT_DIRECTORY) set(TESTING_OUTPUT_DIRECTORY .) endif() add_test(prim_test ${TESTING_OUTPUT_DIRECTORY}/prim_test functionality) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Test") diff --git a/libfreerdp/primitives/test/measure.h b/libfreerdp/primitives/test/measure.h index 7f8d383db..ba2909c00 100644 --- a/libfreerdp/primitives/test/measure.h +++ b/libfreerdp/primitives/test/measure.h @@ -30,7 +30,11 @@ #define __MEASURE_H_INCLUDED__ #include + +#ifndef _WIN32 #include +#endif + #include #include #include diff --git a/libfreerdp/primitives/test/prim_test.c b/libfreerdp/primitives/test/prim_test.c index 82740e191..b074a7d06 100644 --- a/libfreerdp/primitives/test/prim_test.c +++ b/libfreerdp/primitives/test/prim_test.c @@ -12,11 +12,20 @@ * permissions and limitations under the License. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "prim_test.h" + #include #include #include + +#ifdef HAVE_UNISTD_H #include +#endif + #include #include diff --git a/libfreerdp/primitives/test/prim_test.h b/libfreerdp/primitives/test/prim_test.h index 289fe03f8..335c845c9 100644 --- a/libfreerdp/primitives/test/prim_test.h +++ b/libfreerdp/primitives/test/prim_test.h @@ -27,7 +27,9 @@ #include #include #include + #include + #ifdef WITH_IPP #include #include