From d99bcb79faf4a27cfe937dd02e09ad37b7698403 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 15 Jun 2013 00:41:20 +0200 Subject: [PATCH] I2C: add i2c support to CMake --- cmake/modules/LibnfcDrivers.cmake | 8 ++++++++ libnfc/CMakeLists.txt | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/cmake/modules/LibnfcDrivers.cmake b/cmake/modules/LibnfcDrivers.cmake index a186739..7a2a11d 100644 --- a/cmake/modules/LibnfcDrivers.cmake +++ b/cmake/modules/LibnfcDrivers.cmake @@ -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") diff --git a/libnfc/CMakeLists.txt b/libnfc/CMakeLists.txt index 4925d35..66d2124 100644 --- a/libnfc/CMakeLists.txt +++ b/libnfc/CMakeLists.txt @@ -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