diff --git a/cmake_modules/LibnfcDrivers.cmake b/cmake_modules/LibnfcDrivers.cmake index efad11e..47c0e73 100644 --- a/cmake_modules/LibnfcDrivers.cmake +++ b/cmake_modules/LibnfcDrivers.cmake @@ -5,21 +5,32 @@ 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) + FIND_PACKAGE(PCSC REQUIRED) ADD_DEFINITIONS("-DDRIVER_ACR122_ENABLED") + SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/acr122") ENDIF(LIBNFC_DRIVER_ACR122) IF(LIBNFC_DRIVER_PN531_USB) + FIND_PACKAGE(LIBUSB REQUIRED) ADD_DEFINITIONS("-DDRIVER_PN531_USB_ENABLED") + SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn531_usb" "drivers/pn53x_usb.c") ENDIF(LIBNFC_DRIVER_PN531_USB) IF(LIBNFC_DRIVER_PN533_USB) - ADD_DEFINITIONS("-DDRIVER_PN533_USB_ENABLED") + FIND_PACKAGE(LIBUSB REQUIRED) + ADD_DEFINITIONS("-DDRIVER_PN533_USB_ENABLED") + SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn533_usb" "drivers/pn53x_usb.c") ENDIF(LIBNFC_DRIVER_PN533_USB) IF(LIBNFC_DRIVER_ARYGON) ADD_DEFINITIONS("-DDRIVER_ARYGON_ENABLED") + SET(DRIVERS_SOURCES drivers/arygon) ENDIF(LIBNFC_DRIVER_ARYGON) IF(LIBNFC_DRIVER_PN532_UART) ADD_DEFINITIONS("-DDRIVER_PN532_UART_ENABLED") + SET(DRIVERS_SOURCES drivers/pn532_uart) ENDIF(LIBNFC_DRIVER_PN532_UART) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/drivers) + diff --git a/libnfc/CMakeLists.txt b/libnfc/CMakeLists.txt index 81b11cb..8d727b0 100644 --- a/libnfc/CMakeLists.txt +++ b/libnfc/CMakeLists.txt @@ -7,24 +7,12 @@ SET(BUSES_SOURCES buses/uart) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/buses) # Library's drivers -SET(DRIVERS_SOURCES drivers/arygon drivers/pn532_uart) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/drivers) +SET(LIBNFC_SERIAL_AUTOPROBE_ENABLED OFF CACHE BOOL "Allow serial ports to be probed (can seriously disturb connected serial devices)") +IF(LIBNFC_SERIAL_AUTOPROBE_ENABLED) + ADD_DEFINITIONS("-DSERIAL_AUTOPROBE_ENABLED") +ENDIF(LIBNFC_SERIAL_AUTOPROBE_ENABLED) -## 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(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/acr122") -ENDIF(LIBNFC_PCSC) - -## find libusb library and headers -IF(LIBNFC_USB) - FIND_PACKAGE(LIBUSB REQUIRED) - ADD_DEFINITIONS("-DHAVE_LIBUSB=1") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS_OTHER}") - SET(DRIVERS_SOURCES ${DRIVERS_SOURCES} "drivers/pn531_usb" "drivers/pn533_usb" "drivers/pn53x_usb.c") -ENDIF(LIBNFC_USB) +INCLUDE(LibnfcDrivers) INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS}) LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS} ${PCSC_LIBRARY_DIRS})