Windows support contribution:

- Move CMake modules from cmake_modules/ to cmake/modules/
 - CMake now use cmake/config_windows.h.cmake to create config.h on Windows platform
 - contrib/windows.h header is automagically included by config.h
 - Put missing NFC_EXPORT macro on front of emulation API
 - nfc-mfclassic and nfc-mfcultralight examples are now compiled under Windows
Many thanks to Glenn Ergeerts which provide the initial patch.
This commit is contained in:
Romuald Conty 2011-03-31 13:38:49 +00:00
parent b471f56c52
commit 5db8be908b
20 changed files with 37 additions and 31 deletions

View file

@ -1,5 +1,5 @@
SET(EXAMPLES-SOURCES nfc-anticol nfc-dep-initiator nfc-dep-target nfc-emulate-forum-tag4 nfc-emulate-tag nfc-emulate-uid nfc-list nfc-poll nfc-relay nfc-relay-picc)
#TODO nfc-mfclassic nfc-mfultralight pn53x-diagnose pn53x-sam pn53x-tamashell
SET(EXAMPLES-SOURCES nfc-anticol nfc-dep-initiator nfc-dep-target nfc-emulate-forum-tag4 nfc-emulate-tag nfc-emulate-uid nfc-list nfc-poll nfc-relay nfc-relay-picc nfc-mfclassic nfc-mfultralight)
#TODO pn53x-diagnose pn53x-sam pn53x-tamashell
# XXX: Examples should not use private API!
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libnfc)
@ -8,19 +8,19 @@ INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS} ${PCSC_LIBRARY_DIRS})
ADD_LIBRARY(nfc-utils nfc-utils)
#ADD_LIBRARY(mifare mifare)
# Examples
FOREACH(source ${EXAMPLES-SOURCES})
ADD_EXECUTABLE(${source} ${source}.c)
IF((${source} MATCHES "nfc-mfultralight") OR (${source} MATCHES "nfc-mfclassic"))
ADD_EXECUTABLE(${source} ${source}.c mifare)
ELSE()
ADD_EXECUTABLE(${source} ${source}.c)
ENDIF((${source} MATCHES "nfc-mfultralight") OR (${source} MATCHES "nfc-mfclassic"))
TARGET_LINK_LIBRARIES(${source} nfc)
TARGET_LINK_LIBRARIES(${source} nfc-utils)
INSTALL(TARGETS ${source} RUNTIME DESTINATION bin COMPONENT examples)
ENDFOREACH(source)
#TARGET_LINK_LIBRARIES(nfc-mfclassic mifare)
#TARGET_LINK_LIBRARIES(nfc-mfultralight mifare)
IF(NOT WIN32)
# Manuals for the examples
FILE(GLOB manuals "${CMAKE_CURRENT_SOURCE_DIR}/*.1")

View file

@ -52,6 +52,7 @@
#include "nfc-utils.h"
// TODO Move this Windows conditional code in contrib/win32/ or contrib/windows.h
#ifndef _WIN32
// Needed by sleep() under Unix
# include <unistd.h>
@ -59,7 +60,6 @@
# define SUSP_TIME 1 // secs.
#else
// Needed by Sleep() under Windows
# include "../contrib/windows.h"
# include <winbase.h>
# define sleep Sleep
# define SUSP_TIME 1000 // msecs.

View file

@ -47,7 +47,6 @@
# define SUSP_TIME 1 // secs.
#else
// Needed by Sleep() under Windows
# include "../contrib/windows.h"
# include <winbase.h>
# define sleep Sleep
# define SUSP_TIME 1000 // msecs.