Merge pull request #3844
bdf5a3a
Fix PCSC compilation under windows (cslashm)f17383a
Fix CMAKE config for PCSC in order to avoid msys DLL dependencies (cslashm)
This commit is contained in:
commit
61f3916b4a
|
@ -467,9 +467,12 @@ link_directories(${LIBUNWIND_LIBRARY_DIRS})
|
||||||
|
|
||||||
# Final setup for libpcsc
|
# Final setup for libpcsc
|
||||||
if (PCSC_FOUND)
|
if (PCSC_FOUND)
|
||||||
|
message(STATUS "Using PCSC include dir at ${PCSC_INCLUDE_DIR}")
|
||||||
add_definitions(-DHAVE_PCSC)
|
add_definitions(-DHAVE_PCSC)
|
||||||
include_directories(${PCSC_INCLUDE_DIR})
|
include_directories(${PCSC_INCLUDE_DIR})
|
||||||
link_directories(${LIBPCSC_LIBRARY_DIRS})
|
link_directories(${LIBPCSC_LIBRARY_DIRS})
|
||||||
|
else (PCSC_FOUND)
|
||||||
|
message(STATUS "Could not find PCSC")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
|
|
@ -14,9 +14,8 @@ ENDIF (PCSC_INCLUDE_DIR AND PCSC_LIBRARIES)
|
||||||
IF (NOT WIN32)
|
IF (NOT WIN32)
|
||||||
FIND_PACKAGE(PkgConfig)
|
FIND_PACKAGE(PkgConfig)
|
||||||
PKG_CHECK_MODULES(PC_PCSC libpcsclite)
|
PKG_CHECK_MODULES(PC_PCSC libpcsclite)
|
||||||
ENDIF (NOT WIN32)
|
|
||||||
|
|
||||||
FIND_PATH(PCSC_INCLUDE_DIR winscard.h
|
FIND_PATH(PCSC_INCLUDE_DIR winscard.h
|
||||||
HINTS
|
HINTS
|
||||||
/usr/include/PCSC
|
/usr/include/PCSC
|
||||||
${PC_PCSC_INCLUDEDIR}
|
${PC_PCSC_INCLUDEDIR}
|
||||||
|
@ -24,12 +23,22 @@ FIND_PATH(PCSC_INCLUDE_DIR winscard.h
|
||||||
PATH_SUFFIXES PCSC
|
PATH_SUFFIXES PCSC
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(PCSC_LIBRARY NAMES pcsclite libpcsclite WinSCard PCSC
|
FIND_LIBRARY(PCSC_LIBRARY NAMES pcsclite libpcsclite PCSC
|
||||||
HINTS
|
HINTS
|
||||||
${PC_PCSC_LIBDIR}
|
${PC_PCSC_LIBDIR}
|
||||||
${PC_PCSC_LIBRARY_DIRS}
|
${PC_PCSC_LIBRARY_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ELSE (NOT WIN32)
|
||||||
|
IF(BUILD_64 STREQUAL "ON")
|
||||||
|
set(PCSC_INCLUDE_DIR /mingw64/x86_64-w64-mingw32/include)
|
||||||
|
set(PCSC_LIBRARY /mingw64/x86_64-w64-mingw32/lib/libwinscard.a)
|
||||||
|
ELSE(BUILD_64 STREQUAL "ON")
|
||||||
|
set(PCSC_INCLUDE_DIR /mingw32/i686-w64-mingw32/include)
|
||||||
|
set(PCSC_LIBRARY /mingw32/i686-w64-mingw32/lib/libwinscard.a)
|
||||||
|
ENDIF(BUILD_64 STREQUAL "ON")
|
||||||
|
ENDIF (NOT WIN32)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set PCSC_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set PCSC_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
|
|
@ -48,6 +48,15 @@ namespace hw {
|
||||||
/* ===================================================================== */
|
/* ===================================================================== */
|
||||||
/* === Debug ==== */
|
/* === Debug ==== */
|
||||||
/* ===================================================================== */
|
/* ===================================================================== */
|
||||||
|
#ifdef WIN32
|
||||||
|
static char *pcsc_stringify_error(LONG rv) {
|
||||||
|
static __thread char out[20];
|
||||||
|
sprintf_s(out, sizeof(out), "0x%08lX", rv);
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void set_apdu_verbose(bool verbose) {
|
void set_apdu_verbose(bool verbose) {
|
||||||
apdu_verbose = verbose;
|
apdu_verbose = verbose;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,13 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "device.hpp"
|
#include "device.hpp"
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <winscard.h>
|
||||||
|
#define MAX_ATR_SIZE 33
|
||||||
|
#else
|
||||||
#include <PCSC/winscard.h>
|
#include <PCSC/winscard.h>
|
||||||
#include <PCSC/wintypes.h>
|
#include <PCSC/wintypes.h>
|
||||||
|
#endif
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/thread/recursive_mutex.hpp>
|
#include <boost/thread/recursive_mutex.hpp>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue