I2C: add i2c support to CMake

This commit is contained in:
Philippe Teuwen 2013-06-15 00:41:20 +02:00
parent 5cc3f3551a
commit d99bcb79fa
2 changed files with 18 additions and 0 deletions

View file

@ -3,8 +3,10 @@ SET(LIBNFC_DRIVER_ACR122_USB ON CACHE BOOL "Enable ACR122 support (Direct USB co
SET(LIBNFC_DRIVER_ACR122S ON CACHE BOOL "Enable ACR122S support (Use serial port)")
SET(LIBNFC_DRIVER_ARYGON ON CACHE BOOL "Enable ARYGON support (Use serial port)")
IF(WIN32)
SET(LIBNFC_DRIVER_PN532_I2C OFF CACHE BOOL "Enable PN532 I2C support (Use I2C bus)")
SET(LIBNFC_DRIVER_PN532_SPI OFF CACHE BOOL "Enable PN532 SPI support (Use SPI bus)")
ELSE(WIN32)
SET(LIBNFC_DRIVER_PN532_I2C ON CACHE BOOL "Enable PN532 I2C support (Use I2C bus)")
SET(LIBNFC_DRIVER_PN532_SPI ON CACHE BOOL "Enable PN532 SPI support (Use SPI bus)")
ENDIF(WIN32)
SET(LIBNFC_DRIVER_PN532_UART ON CACHE BOOL "Enable PN532 UART support (Use serial port)")
@ -34,6 +36,12 @@ IF(LIBNFC_DRIVER_ARYGON)
SET(UART_REQUIRED TRUE)
ENDIF(LIBNFC_DRIVER_ARYGON)
IF(LIBNFC_DRIVER_PN532_I2C)
ADD_DEFINITIONS("-DDRIVER_PN532_I2C_ENABLED")
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn532_i2c")
SET(I2C_REQUIRED TRUE)
ENDIF(LIBNFC_DRIVER_PN532_I2C)
IF(LIBNFC_DRIVER_PN532_SPI)
ADD_DEFINITIONS("-DDRIVER_PN532_SPI_ENABLED")
SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn532_spi")

View file

@ -25,6 +25,16 @@ IF(UART_REQUIRED)
ENDIF(WIN32)
ENDIF(UART_REQUIRED)
IF(I2C_REQUIRED)
IF(WIN32)
# Windows is not supported at the moment
#LIST(APPEND BUSES_SOURCES ../contrib/win32/libnfc/buses/i2c)
MESSAGE( FATAL_ERROR "I2C not (yet) supported under Windows!" )
ELSE(WIN32)
LIST(APPEND BUSES_SOURCES buses/i2c)
ENDIF(WIN32)
ENDIF(I2C_REQUIRED)
IF(SPI_REQUIRED)
IF(WIN32)
# Windows is not supported at the moment