Fix CMake pkg-config generation: "Requires:" is now dynamic.
Fix devices.h, #endif should not be followed by the name of the block. Fix CMake libnfc_usb compilation. Rename tools to examples in CMake file. (This patch comes from Fkooman, thanks !)
This commit is contained in:
parent
e2dc2c133a
commit
0977dd1c0b
3 changed files with 21 additions and 13 deletions
|
@ -11,11 +11,6 @@ SET(LIBNFC_PCSC ON CACHE BOOL "Enable PC/SC support (PN532)")
|
|||
SET(LIBNFC_USB OFF CACHE BOOL "Enable direct USB communication support (PN531 and PN533)")
|
||||
SET(LIBNFC_DISABLE_SERIAL_AUTOPROBE OFF CACHE BOOL "Disable serial autoprobe")
|
||||
|
||||
# Set some pkg-config variables
|
||||
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
SET(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||
SET(PACKAGE "libnfc")
|
||||
|
||||
IF(DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
SET(libdir ${CMAKE_INSTALL_LIBDIR})
|
||||
ELSE(DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
|
@ -35,7 +30,18 @@ IF(NOT DEFINED SHARE_INSTALL_PREFIX)
|
|||
ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
|
||||
|
||||
IF(NOT MSVC)
|
||||
#INCLUDE(FindPkgConfig)
|
||||
# Set some pkg-config variables
|
||||
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
SET(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||
SET(PACKAGE "libnfc")
|
||||
IF(LIBNFC_USB)
|
||||
SET(PKG_REQ ${PKG_REQ} "libusb")
|
||||
ENDIF(LIBNFC_USB)
|
||||
IF(LIBNFC_PCSC)
|
||||
SET(PKG_REQ ${PKG_REQ} "libpcsclite")
|
||||
ENDIF(LIBNFC_PCSC)
|
||||
# CMake lists are separated by a semi colon, replace with colon
|
||||
STRING(REPLACE ";" "," PKG_CONFIG_REQUIRES "${PKG_REQ}")
|
||||
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)
|
||||
ENDIF(NOT MSVC)
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
SET(LIBRARY-SOURCES libnfc rs232 bitutils dev_arygon)
|
||||
SET(TOOLS-SOURCES list mftool mfultool initiator target anticol emulate relay)
|
||||
SET(EXAMPLES-SOURCES list mftool mfultool initiator target anticol emulate relay)
|
||||
|
||||
# find PCSC library and headers
|
||||
IF(LIBNFC_PCSC)
|
||||
FIND_PACKAGE(PCSC REQUIRED)
|
||||
ADD_DEFINITIONS("-DHAVE_PCSC_LITE=1")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PCSC_CFLAGS_OTHER}")
|
||||
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_acr122")
|
||||
ENDIF(LIBNFC_PCSC)
|
||||
|
||||
|
@ -12,7 +13,8 @@ ENDIF(LIBNFC_PCSC)
|
|||
IF(LIBNFC_USB)
|
||||
FIND_PACKAGE(LIBUSB REQUIRED)
|
||||
ADD_DEFINITIONS("-DHAVE_LIBUSB=1")
|
||||
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_pn531 dev_pn533")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS_OTHER}")
|
||||
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_pn531" "dev_pn533")
|
||||
ENDIF(LIBNFC_USB)
|
||||
|
||||
IF(LIBNFC_VERBOSE_OUTPUT)
|
||||
|
@ -64,7 +66,7 @@ IF(MSVC)
|
|||
ENDIF(MSVC)
|
||||
|
||||
# Examples
|
||||
FOREACH(source ${TOOLS-SOURCES})
|
||||
FOREACH(source ${EXAMPLES-SOURCES})
|
||||
ADD_EXECUTABLE(nfc-${source} ${source}.c)
|
||||
TARGET_LINK_LIBRARIES(nfc-${source} nfc)
|
||||
INSTALL(TARGETS nfc-${source} RUNTIME DESTINATION bin COMPONENT examples)
|
||||
|
|
|
@ -25,22 +25,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|||
#include "types.h"
|
||||
#ifdef HAVE_PCSC_LITE
|
||||
#include "dev_acr122.h"
|
||||
#endif
|
||||
#endif /* HAVE_PCSC_LITE */
|
||||
#ifdef HAVE_LIBUSB
|
||||
#include "dev_pn531.h"
|
||||
#include "dev_pn533.h"
|
||||
#endif HAVE_LIBUSB
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#include "dev_arygon.h"
|
||||
|
||||
const static struct dev_callbacks dev_callbacks_list[] = {
|
||||
// Driver Name Connect Transceive Disconnect
|
||||
#ifdef HAVE_PCSC_LITE
|
||||
{ "ACR122", dev_acr122_connect, dev_acr122_transceive, dev_acr122_disconnect },
|
||||
#endif
|
||||
#endif /* HAVE_PCSC_LITE */
|
||||
#ifdef HAVE_LIBUSB
|
||||
{ "PN531USB", dev_pn531_connect, dev_pn531_transceive, dev_pn531_disconnect },
|
||||
{ "PN533USB", dev_pn533_connect, dev_pn533_transceive, dev_pn533_disconnect },
|
||||
#endif HAVE_LIBUSB
|
||||
#endif /* HAVE_LIBUSB */
|
||||
{ "ARYGON", dev_arygon_connect, dev_arygon_transceive, dev_arygon_disconnect }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue