Make it compile under MSVC2017.
This commit is contained in:
parent
66d3560608
commit
82f23c411d
5 changed files with 22 additions and 8 deletions
|
@ -48,7 +48,9 @@
|
||||||
# define ENOTSUP WSAEOPNOTSUPP
|
# define ENOTSUP WSAEOPNOTSUPP
|
||||||
# define ECONNABORTED WSAECONNABORTED
|
# define ECONNABORTED WSAECONNABORTED
|
||||||
# else
|
# else
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER < 1910) // VS2017 don't like snprintf macro
|
||||||
# define snprintf sprintf_s
|
# define snprintf sprintf_s
|
||||||
|
#endif
|
||||||
# define strdup _strdup
|
# define strdup _strdup
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@ IF(WIN32)
|
||||||
|
|
||||||
# Add in the rc for version information in the dll
|
# Add in the rc for version information in the dll
|
||||||
LIST(APPEND WINDOWS_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/../windows/libnfc.rc)
|
LIST(APPEND WINDOWS_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/../windows/libnfc.rc)
|
||||||
|
IF (NOT MINGW)
|
||||||
|
LIST(APPEND WINDOWS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/nfc_msvc.def)
|
||||||
|
ENDIF()
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
# Library's chips
|
# Library's chips
|
||||||
|
@ -88,13 +91,16 @@ SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 6 VERSION 6.0.0)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
# Libraries that are windows specific
|
# Libraries that are windows specific
|
||||||
TARGET_LINK_LIBRARIES(nfc wsock32)
|
TARGET_LINK_LIBRARIES(nfc wsock32)
|
||||||
|
IF(MINGW)
|
||||||
ADD_CUSTOM_COMMAND(
|
ADD_CUSTOM_COMMAND(
|
||||||
OUTPUT libnfc.lib
|
OUTPUT libnfc.lib
|
||||||
COMMAND ${DLLTOOL} -d ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/nfc.def -l ${CMAKE_CURRENT_BINARY_DIR}/libnfc.lib ${CMAKE_CURRENT_BINARY_DIR}/libnfc.dll
|
COMMAND ${DLLTOOL} -d ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/nfc.def -l ${CMAKE_CURRENT_BINARY_DIR}/libnfc.lib ${CMAKE_CURRENT_BINARY_DIR}/libnfc.dll
|
||||||
DEPENDS nfc ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/nfc.def
|
DEPENDS nfc ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/nfc.def
|
||||||
)
|
)
|
||||||
ADD_CUSTOM_TARGET(win32lib ALL DEPENDS libnfc.lib)
|
ADD_CUSTOM_TARGET(win32lib ALL DEPENDS libnfc.lib)
|
||||||
|
ELSE()
|
||||||
|
ADD_LIBRARY(win32lib ALIAS nfc)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# On Windows the shared (runtime) library should be either in the same
|
# On Windows the shared (runtime) library should be either in the same
|
||||||
# directory as the excutables or in the path, we add it to same directory
|
# directory as the excutables or in the path, we add it to same directory
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#ifndef __NFC_BUS_UART_H__
|
#ifndef __NFC_BUS_UART_H__
|
||||||
# define __NFC_BUS_UART_H__
|
# define __NFC_BUS_UART_H__
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "nfc/nfc.h"
|
#include "nfc/nfc.h"
|
||||||
|
|
||||||
|
|
|
@ -565,7 +565,7 @@ nfc_initiator_select_passive_target(nfc_device *pnd,
|
||||||
nfc_target *pnt)
|
nfc_target *pnt)
|
||||||
{
|
{
|
||||||
uint8_t *abtInit = NULL;
|
uint8_t *abtInit = NULL;
|
||||||
uint8_t abtTmpInit[MAX(12, szInitData)];
|
uint8_t *abtTmpInit = malloc(MAX(12, szInitData));
|
||||||
size_t szInit = 0;
|
size_t szInit = 0;
|
||||||
int res;
|
int res;
|
||||||
if ((res = nfc_device_validate_modulation(pnd, N_INITIATOR, &nm)) != NFC_SUCCESS)
|
if ((res = nfc_device_validate_modulation(pnd, N_INITIATOR, &nm)) != NFC_SUCCESS)
|
||||||
|
@ -583,6 +583,8 @@ nfc_initiator_select_passive_target(nfc_device *pnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
HAL(initiator_select_passive_target, pnd, nm, abtInit, szInit, pnt);
|
HAL(initiator_select_passive_target, pnd, nm, abtInit, szInit, pnt);
|
||||||
|
|
||||||
|
free(abtTmpInit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @ingroup initiator
|
/** @ingroup initiator
|
||||||
|
|
Loading…
Reference in a new issue