libfreerdp-primitives: fix build on Windows

This commit is contained in:
Marc-André Moreau 2013-01-18 20:47:18 -05:00
parent 3df754e0bb
commit ce5e52ba6f
6 changed files with 54 additions and 42 deletions

View File

@ -502,7 +502,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int
if (orderInfo->fieldFlags & (1 << (NO-1))) \ if (orderInfo->fieldFlags & (1 << (NO-1))) \
{ \ { \
if (stream_get_left(s) < 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; \ return FALSE; \
} \ } \
stream_read_BYTE(s, TARGET); \ 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 (orderInfo->fieldFlags & (1 << (NO-1))) \
{ \ { \
if (stream_get_left(s) < 2) { \ 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; \ return FALSE; \
} \ } \
stream_read_BYTE(s, TARGET1); \ 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 (orderInfo->fieldFlags & (1 << (NO-1))) \
{ \ { \
if (stream_get_left(s) < 2) { \ if (stream_get_left(s) < 2) { \
printf("%s: error reading %s\n", __func__, #TARGET); \ printf("%s: error reading %s\n", __FUNCTION__, #TARGET); \
return FALSE; \ return FALSE; \
} \ } \
stream_read_UINT16(s, TARGET); \ 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 (orderInfo->fieldFlags & (1 << (NO-1))) \
{ \ { \
if (stream_get_left(s) < 4) { \ if (stream_get_left(s) < 4) { \
printf("%s: error reading %s\n", __func__, #TARGET); \ printf("%s: error reading %s\n", __FUNCTION__, #TARGET); \
return FALSE; \ return FALSE; \
} \ } \
stream_read_UINT32(s, TARGET); \ 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) \ #define ORDER_FIELD_COORD(NO, TARGET) \
do { \ do { \
if ((orderInfo->fieldFlags & (1 << (NO-1))) && !update_read_coord(s, &TARGET, orderInfo->deltaCoordinates)) { \ 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; \ return FALSE; \
} \ } \
} while(0) } while(0)
#define ORDER_FIELD_COLOR(NO, TARGET) \ #define ORDER_FIELD_COLOR(NO, TARGET) \
do { \ do { \
if ((orderInfo->fieldFlags & (1 << (NO-1))) && !update_read_color(s, &TARGET)) { \ 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; \ return FALSE; \
} \ } \
} while(0) } 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) \ #define FIELD_SKIP_BUFFER16(s, TARGET_LEN) \
do { \ do { \
if (stream_get_left(s) < 2) {\ 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; \ return FALSE; \
}\ }\
stream_read_UINT16(s, TARGET_LEN); \ stream_read_UINT16(s, TARGET_LEN); \
if (!stream_skip(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; \ return FALSE; \
} \ } \
} while(0) } while(0)

View File

@ -13,7 +13,10 @@
# and limitations under the License. # and limitations under the License.
# #
set(FREERDP_PRIMITIVE_CFILES set(MODULE_NAME "freerdp-primitives")
set(MODULE_PREFIX "FREERDP_PRIMITIVES")
set(${MODULE_PREFIX}_SRCS
prim_add.c prim_add.c
prim_andor.c prim_andor.c
prim_alphaComp.c prim_alphaComp.c
@ -23,14 +26,7 @@ set(FREERDP_PRIMITIVE_CFILES
prim_shift.c prim_shift.c
prim_sign.c prim_sign.c
primitives.c primitives.c
) prim_internal.h)
set(FREERDP_PRIMITIVE_HEADERS
prim_internal.h
)
set(FREERDP_PRIMITIVE_SRCS
${FREERDP_PRIMITIVE_CFILES}
${FREERDP_PRIMITIVE_HEADERS}
)
add_definitions(-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) add_definitions(-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
@ -53,29 +49,28 @@ if(WITH_SSE2)
endif() endif()
elseif(WITH_NEON) elseif(WITH_NEON)
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
set(OPTIMZATION "${OPTIMIZATION} -mfpu=neon -mfloat-abi=softfp") set(OPTIMIZATION "${OPTIMIZATION} -mfpu=neon -mfloat-abi=softfp")
endif() endif()
# TODO: Add MSVC equivalent # TODO: Add MSVC equivalent
endif() endif()
set_property(SOURCE ${FREERDP_PRIMITIVE_CFILES} PROPERTY COMPILE_FLAGS ${OPTIMIZATION})
if(WITH_MONOLITHIC_BUILD) set_property(SOURCE ${${MODULE_PREFIX}_SRCS} PROPERTY COMPILE_FLAGS ${OPTIMIZATION})
add_library(freerdp-primitives OBJECT ${FREERDP_PRIMITIVE_SRCS})
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() 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() 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(BUILD_TESTING AND (NOT WIN32))
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)
add_subdirectory(test) add_subdirectory(test)
endif(BUILD_TESTING) endif()

View File

@ -137,3 +137,5 @@ if(NOT TESTING_OUTPUT_DIRECTORY)
set(TESTING_OUTPUT_DIRECTORY .) set(TESTING_OUTPUT_DIRECTORY .)
endif() endif()
add_test(prim_test ${TESTING_OUTPUT_DIRECTORY}/prim_test functionality) add_test(prim_test ${TESTING_OUTPUT_DIRECTORY}/prim_test functionality)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Test")

View File

@ -30,7 +30,11 @@
#define __MEASURE_H_INCLUDED__ #define __MEASURE_H_INCLUDED__
#include <time.h> #include <time.h>
#ifndef _WIN32
#include <sys/param.h> #include <sys/param.h>
#endif
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -12,11 +12,20 @@
* permissions and limitations under the License. * permissions and limitations under the License.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "prim_test.h" #include "prim_test.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>

View File

@ -27,7 +27,9 @@
#include <measure.h> #include <measure.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <freerdp/primitives.h> #include <freerdp/primitives.h>
#ifdef WITH_IPP #ifdef WITH_IPP
#include <ipps.h> #include <ipps.h>
#include <ippi.h> #include <ippi.h>