Update CMake files in order to correcly find libraries on Windows 64bits platform. (Thanks to Fkooman)
Add Windows README file. (Thanks to Fkooman)
This commit is contained in:
parent
7924d10fad
commit
831dbd31a4
3 changed files with 52 additions and 24 deletions
|
@ -2,6 +2,9 @@ PROJECT(libnfc C)
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
SET(VERSION "1.2.2")
|
SET(VERSION "1.2.2")
|
||||||
|
|
||||||
|
# make it easy to locate CMake modules for finding libraries
|
||||||
|
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
|
||||||
|
|
||||||
SET(LIBNFC_VERBOSE_OUTPUT OFF CACHE BOOL "Verbose output of communication with the NFC chip")
|
SET(LIBNFC_VERBOSE_OUTPUT OFF CACHE BOOL "Verbose output of communication with the NFC chip")
|
||||||
SET(LIBNFC_LANG_C99 OFF CACHE BOOL "Use C99 language standard (GCC only)")
|
SET(LIBNFC_LANG_C99 OFF CACHE BOOL "Use C99 language standard (GCC only)")
|
||||||
SET(LIBNFC_PCSC ON CACHE BOOL "Enable PC/SC support")
|
SET(LIBNFC_PCSC ON CACHE BOOL "Enable PC/SC support")
|
||||||
|
@ -31,7 +34,7 @@ IF(NOT DEFINED SHARE_INSTALL_PREFIX)
|
||||||
ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
|
ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
|
||||||
|
|
||||||
IF(NOT MSVC)
|
IF(NOT MSVC)
|
||||||
INCLUDE(FindPkgConfig)
|
#INCLUDE(FindPkgConfig)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libnfc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc @ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libnfc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc @ONLY)
|
||||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
ENDIF(NOT MSVC)
|
ENDIF(NOT MSVC)
|
||||||
|
|
41
README-Windows.txt
Normal file
41
README-Windows.txt
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
Requirements
|
||||||
|
============
|
||||||
|
This project uses CMake [1] to create a Visual Studio project from the
|
||||||
|
source files.
|
||||||
|
|
||||||
|
It have been tested with:
|
||||||
|
|
||||||
|
- Microsoft Visual C++ 2008 Express Edition, with SP1 [2]
|
||||||
|
- LibUsb-Win32 0.1.12.2 [3]
|
||||||
|
- NSIS 2.45 (to create Windows installer) [4]
|
||||||
|
|
||||||
|
On Windows XP SP3.
|
||||||
|
|
||||||
|
Compilation
|
||||||
|
===========
|
||||||
|
|
||||||
|
CMake can be used to create MSVC project files, then each MSVC can
|
||||||
|
be used to compile the project, create an installer, etc.
|
||||||
|
|
||||||
|
MSVC project will create a shared library for Windows (nfc.dll), and
|
||||||
|
a library file (nfc.lib) to link your applications against. It will compile
|
||||||
|
examples against this shared library. Installer will install the DLL file
|
||||||
|
in the same directory as the examples if your goal was to be able to
|
||||||
|
run and install libnfc as a standard user. In a system wide installation
|
||||||
|
the DLL should be placed in "windows\system32" or any other directory in
|
||||||
|
Windows PATH.
|
||||||
|
|
||||||
|
If you want your own tools to use libnfc you have to link them with "nfc.lib"
|
||||||
|
which can be found in "lib" subdirectory under the installation root. Headers
|
||||||
|
can be found in "include" subdirectory.
|
||||||
|
|
||||||
|
In a "normal" Windows install this would be:
|
||||||
|
- "C:\Program Files\libnfc-x.x.x\lib"
|
||||||
|
- "C:\Program Files\libnfc-x.x.x\include"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[1] http://www.cmake.org
|
||||||
|
[2] http://www.microsoft.com/express/vc/
|
||||||
|
[3] http://libusb-win32.sourceforge.net/
|
||||||
|
[4] http://nsis.sourceforge.net/Main_Page
|
|
@ -1,11 +1,16 @@
|
||||||
SET(LIBRARY-SOURCES libnfc dev_pn531 dev_pn533 rs232 bitutils dev_arygon)
|
SET(LIBRARY-SOURCES libnfc dev_pn531 dev_pn533 rs232 bitutils dev_arygon)
|
||||||
SET(TOOLS-SOURCES list mftool mfultool initiator target anticol emulate relay)
|
SET(TOOLS-SOURCES list mftool mfultool initiator target anticol emulate relay)
|
||||||
|
|
||||||
|
# find PCSC library and headers
|
||||||
IF(LIBNFC_PCSC)
|
IF(LIBNFC_PCSC)
|
||||||
|
FIND_PACKAGE(PCSC REQUIRED)
|
||||||
ADD_DEFINITIONS("-DHAVE_PCSC_LITE=1")
|
ADD_DEFINITIONS("-DHAVE_PCSC_LITE=1")
|
||||||
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_acr122")
|
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_acr122")
|
||||||
ENDIF(LIBNFC_PCSC)
|
ENDIF(LIBNFC_PCSC)
|
||||||
|
|
||||||
|
# find libusb library and headers
|
||||||
|
FIND_PACKAGE(LIBUSB REQUIRED)
|
||||||
|
|
||||||
IF(LIBNFC_VERBOSE_OUTPUT)
|
IF(LIBNFC_VERBOSE_OUTPUT)
|
||||||
ADD_DEFINITIONS("-DDEBUG")
|
ADD_DEFINITIONS("-DDEBUG")
|
||||||
ENDIF(LIBNFC_VERBOSE_OUTPUT)
|
ENDIF(LIBNFC_VERBOSE_OUTPUT)
|
||||||
|
@ -21,36 +26,15 @@ ENDIF(LIBNFC_LANG_C99 AND NOT MSVC)
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
# Hide some warnings, this should be fixed in the code instead!
|
# Hide some warnings, this should be fixed in the code instead!
|
||||||
ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS")
|
ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS")
|
||||||
ENDIF(MSVC)
|
|
||||||
|
|
||||||
IF(MSVC)
|
|
||||||
# Include the stdint headers, because MSVC does not have them
|
# Include the stdint headers, because MSVC does not have them
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../win32/stdint)
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../win32/stdint)
|
||||||
|
|
||||||
# This is from libusb-win32.sourceforge.net
|
|
||||||
SET(LIBUSB_INCLUDE_DIRS $ENV{ProgramFiles}/LibUSB-Win32/include)
|
|
||||||
SET(LIBUSB_LIBRARIES $ENV{ProgramFiles}/LibUSB-Win32/lib/msvc/libusb.lib)
|
|
||||||
|
|
||||||
IF(LIBNFC_PCSC)
|
|
||||||
# This is included with Visual Studio Express 2008, we should really use
|
|
||||||
# something that finds this library, whatever the MSVC version
|
|
||||||
SET(LIBPCSCLITE_LIBRARIES "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v6.0A/Lib/WinSCard.Lib")
|
|
||||||
# On MSVC we don't need the winscard.h header in the include path because
|
|
||||||
# it already is there...
|
|
||||||
ENDIF(LIBNFC_PCSC)
|
|
||||||
ELSE(MSVC)
|
|
||||||
# On Unix we just use pkg-config
|
|
||||||
PKG_CHECK_MODULES(LIBUSB REQUIRED libusb)
|
|
||||||
IF(LIBNFC_PCSC)
|
|
||||||
PKG_CHECK_MODULES(LIBPCSCLITE REQUIRED libpcsclite)
|
|
||||||
ENDIF(LIBNFC_PCSC)
|
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${LIBPCSCLITE_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS})
|
||||||
|
|
||||||
# Library
|
# Library
|
||||||
ADD_LIBRARY(nfc SHARED ${LIBRARY-SOURCES})
|
ADD_LIBRARY(nfc SHARED ${LIBRARY-SOURCES})
|
||||||
TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES} ${LIBPCSCLITE_LIBRARIES})
|
TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES} ${PCSC_LIBRARIES})
|
||||||
SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 0 VERSION 0.0.0)
|
SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 0 VERSION 0.0.0)
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
|
|
Loading…
Add table
Reference in a new issue