Add drivers selection to CMake build. Fix Issue 70

This commit is contained in:
Romuald Conty 2010-04-20 08:45:31 +00:00
parent be3f152d3c
commit 778ac87b37
2 changed files with 30 additions and 12 deletions

View file

@ -30,9 +30,8 @@ SET(top_srcdir "${CMAKE_SOURCE_DIR}")
INCLUDE(UseDoxygen)
SET(LIBNFC_DEBUG_OUTPUT OFF CACHE BOOL "Debug output of communication with the NFC chip")
SET(LIBNFC_PCSC ON CACHE BOOL "Enable PC/SC support (ACR122)")
SET(LIBNFC_USB ON CACHE BOOL "Enable direct USB communication support (PN531 and PN533)")
SET(LIBNFC_SERIAL_AUTOPROBE_ENABLED OFF CACHE BOOL "Allow serial ports to be probed (can seriously disturb connected serial devices)")
INCLUDE(LibnfcDrivers)
IF(DEFINED CMAKE_INSTALL_LIBDIR)
SET(libdir ${CMAKE_INSTALL_LIBDIR})
@ -76,24 +75,18 @@ IF(NOT MSVC)
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(exec_prefix ${CMAKE_INSTALL_PREFIX})
SET(PACKAGE "libnfc")
IF(LIBNFC_USB)
IF(LIBNFC_DRIVER_PN531_USB OR LIBNFC_DRIVER_PN533_USB)
SET(PKG_REQ ${PKG_REQ} "libusb")
ENDIF(LIBNFC_USB)
IF(LIBNFC_PCSC)
ENDIF(LIBNFC_DRIVER_PN531_USB OR LIBNFC_DRIVER_PN533_USB)
IF(LIBNFC_DRIVER_ACR122)
SET(PKG_REQ ${PKG_REQ} "libpcsclite")
ENDIF(LIBNFC_PCSC)
ENDIF(LIBNFC_DRIVER_ACR122)
# 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)
ADD_DEFINITIONS(-DDRIVER_ACR122_ENABLED)
ADD_DEFINITIONS(-DDRIVER_PN531_USB_ENABLED)
ADD_DEFINITIONS(-DDRIVER_PN533_USB_ENABLED)
ADD_DEFINITIONS(-DDRIVER_ARYGON_ENABLED)
#ADD_DEFINITIONS(-DDRIVER_PN532_UART_ENABLED)
ADD_SUBDIRECTORY(libnfc)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(examples)

View file

@ -0,0 +1,25 @@
SET(LIBNFC_DRIVER_ACR122 ON CACHE BOOL "Enable ACR122 support (Depends on PC/SC)")
SET(LIBNFC_DRIVER_PN531_USB ON CACHE BOOL "Enable PN531_USB support (Depends on libusb)")
SET(LIBNFC_DRIVER_PN533_USB ON CACHE BOOL "Enable PN533_USB support (Depends on libusb)")
SET(LIBNFC_DRIVER_ARYGON ON CACHE BOOL "Enable ARYGON support (Use serial port)")
SET(LIBNFC_DRIVER_PN532_UART OFF CACHE BOOL "Enable PN533_USB support (Use serial port)")
IF(LIBNFC_DRIVER_ACR122)
ADD_DEFINITIONS("-DDRIVER_ACR122_ENABLED")
ENDIF(LIBNFC_DRIVER_ACR122)
IF(LIBNFC_DRIVER_PN531_USB)
ADD_DEFINITIONS("-DDRIVER_PN531_USB_ENABLED")
ENDIF(LIBNFC_DRIVER_PN531_USB)
IF(LIBNFC_DRIVER_PN533_USB)
ADD_DEFINITIONS("-DDRIVER_PN533_USB_ENABLED")
ENDIF(LIBNFC_DRIVER_PN533_USB)
IF(LIBNFC_DRIVER_ARYGON)
ADD_DEFINITIONS("-DDRIVER_ARYGON_ENABLED")
ENDIF(LIBNFC_DRIVER_ARYGON)
IF(LIBNFC_DRIVER_PN532_UART)
ADD_DEFINITIONS("-DDRIVER_PN532_UART_ENABLED")
ENDIF(LIBNFC_DRIVER_PN532_UART)