It cow compile using CMake.

This commit is contained in:
Romuald Conty 2009-11-04 12:03:49 +00:00
parent 06a76f6470
commit c9689c74fb
5 changed files with 30 additions and 26 deletions

View file

@ -19,4 +19,5 @@ ENDIF(MSVC)
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS} ${PCSC_INCLUDE_DIRS})
ADD_SUBDIRECTORY(lib examples)
ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(examples)

View file

@ -1,6 +1,6 @@
SET(EXAMPLES-SOURCES nfc-list nfc-mfclassic nfc-mfultralight nfcip-initiator nfcip-target nfc-anticol nfc-emulate nfc-relay)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../lib)
# Examples
FOREACH(source ${EXAMPLES-SOURCES})

View file

@ -1,7 +1,32 @@
SET(LIBRARY-SOURCES nfc bitutils)
# Library's buses
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)
## 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" "drivers/pn533")
ENDIF(LIBNFC_USB)
# Library
ADD_LIBRARY(nfc SHARED ${LIBRARY-SOURCES})
SET(LIBRARY_SOURCES nfc bitutils ${DRIVERS_SOURCES} ${BUSES_SOURCES})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
ADD_LIBRARY(nfc SHARED ${LIBRARY_SOURCES})
TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES} ${PCSC_LIBRARIES})
SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 0 VERSION 0.0.0)
@ -28,4 +53,3 @@ IF(MSVC)
ENDIF(MSVC)
ADD_SUBDIRECTORY(buses drivers)

View file

@ -1,2 +0,0 @@
SET(LIBRARY-SOURCES uart)

View file

@ -1,19 +0,0 @@
SET(LIBRARY-SOURCES arygon pn532_uart)
# 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} "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(LIBRARY-SOURCES ${LIBRARY-SOURCES} "pn531" "pn533")
ENDIF(LIBNFC_USB)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/lib)