2013-01-27 22:34:58 -05:00
|
|
|
# Windows MinGW workarounds
|
|
|
|
IF(WIN32)
|
2013-01-31 16:09:41 +01:00
|
|
|
SET(WINDOWS_SOURCES ../contrib/win32/stdlib)
|
2013-01-27 22:34:58 -05:00
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32)
|
2013-02-01 10:19:02 -05:00
|
|
|
|
|
|
|
# Add in the rc for version information in the dll
|
|
|
|
LIST(APPEND WINDOWS_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/../windows/libnfc.rc)
|
2013-01-27 22:34:58 -05:00
|
|
|
ENDIF(WIN32)
|
|
|
|
|
2009-11-20 11:27:07 +00:00
|
|
|
# Library's chips
|
|
|
|
SET(CHIPS_SOURCES chips/pn53x)
|
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/chips)
|
|
|
|
|
2009-11-04 12:03:49 +00:00
|
|
|
# Library's buses
|
2013-03-07 08:07:42 +01:00
|
|
|
IF(LIBUSB_FOUND)
|
|
|
|
SET(BUSES_SOURCES buses/uart buses/usbbus)
|
|
|
|
ELSE(LIBUSB_FOUND)
|
|
|
|
SET(BUSES_SOURCES buses/uart)
|
|
|
|
ENDIF(LIBUSB_FOUND)
|
2009-11-04 12:03:49 +00:00
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/buses)
|
|
|
|
|
2010-04-26 13:00:41 +00:00
|
|
|
INCLUDE(LibnfcDrivers)
|
2009-11-04 12:03:49 +00:00
|
|
|
|
2013-01-26 18:43:58 -05:00
|
|
|
IF(WIN32)
|
|
|
|
# Windows now requires regex, so we utilize PCRE
|
|
|
|
# since Windows doesn't get the benefit of finding in CMake
|
|
|
|
# it has to be added manually
|
|
|
|
IF(PCRE_FOUND)
|
|
|
|
INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIRS})
|
|
|
|
LINK_DIRECTORIES(${PCRE_LIBRARY_DIRS})
|
|
|
|
ENDIF(PCRE_FOUND)
|
|
|
|
ENDIF(WIN32)
|
|
|
|
|
2011-10-04 21:43:05 +00:00
|
|
|
IF(PCSC_FOUND)
|
2011-10-01 14:50:53 +00:00
|
|
|
INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS})
|
|
|
|
LINK_DIRECTORIES(${PCSC_LIBRARY_DIRS})
|
2011-10-04 21:43:05 +00:00
|
|
|
ENDIF(PCSC_FOUND)
|
2011-10-01 14:50:53 +00:00
|
|
|
|
2011-10-04 21:43:05 +00:00
|
|
|
IF(LIBUSB_FOUND)
|
2011-10-01 14:50:53 +00:00
|
|
|
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS})
|
|
|
|
LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS})
|
2011-10-04 21:43:05 +00:00
|
|
|
ENDIF(LIBUSB_FOUND)
|
2009-11-04 10:42:53 +00:00
|
|
|
|
|
|
|
# Library
|
2013-01-27 22:34:58 -05:00
|
|
|
SET(LIBRARY_SOURCES nfc nfc-device nfc-emulation nfc-internal conf iso14443-subr mirror-subr target-subr log ${DRIVERS_SOURCES} ${BUSES_SOURCES} ${CHIPS_SOURCES} ${WINDOWS_SOURCES})
|
2009-11-04 12:03:49 +00:00
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
2013-02-01 10:32:15 +01:00
|
|
|
|
|
|
|
IF(LIBNFC_LOG)
|
2013-03-03 17:38:19 -05:00
|
|
|
IF(WIN32)
|
|
|
|
SET(CMAKE_C_FLAGS "-fgnu89-inline ${CMAKE_C_FLAGS}")
|
|
|
|
LIST(APPEND LIBRARY_SOURCES log-printf log_win32)
|
|
|
|
ELSE(WIN32)
|
|
|
|
LIST(APPEND LIBRARY_SOURCES log-printf log_posix)
|
|
|
|
ENDIF(WIN32)
|
2013-02-01 10:32:15 +01:00
|
|
|
ENDIF(LIBNFC_LOG)
|
2009-11-04 12:03:49 +00:00
|
|
|
ADD_LIBRARY(nfc SHARED ${LIBRARY_SOURCES})
|
2011-10-01 14:50:53 +00:00
|
|
|
|
2011-10-04 21:43:05 +00:00
|
|
|
IF(PCSC_FOUND)
|
2011-10-01 14:50:53 +00:00
|
|
|
TARGET_LINK_LIBRARIES(nfc ${PCSC_LIBRARIES})
|
2011-10-04 21:43:05 +00:00
|
|
|
ENDIF(PCSC_FOUND)
|
2011-10-01 14:50:53 +00:00
|
|
|
|
2011-10-04 21:43:05 +00:00
|
|
|
IF(LIBUSB_FOUND)
|
2011-10-01 14:50:53 +00:00
|
|
|
TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES})
|
2011-10-04 21:43:05 +00:00
|
|
|
ENDIF(LIBUSB_FOUND)
|
2011-10-01 14:50:53 +00:00
|
|
|
|
2009-12-01 14:23:00 +00:00
|
|
|
SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 0)
|
2009-11-04 10:42:53 +00:00
|
|
|
|
2010-11-17 08:29:41 +00:00
|
|
|
IF(WIN32)
|
2013-02-01 10:19:02 -05:00
|
|
|
# Libraries that are windows specific
|
|
|
|
TARGET_LINK_LIBRARIES(nfc wsock32)
|
2013-01-26 18:43:58 -05:00
|
|
|
IF(PCRE_FOUND)
|
|
|
|
TARGET_LINK_LIBRARIES(nfc ${PCRE_LIBRARIES})
|
|
|
|
ENDIF(PCRE_FOUND)
|
|
|
|
|
2013-02-01 10:19:02 -05:00
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT libnfc.lib
|
2013-02-05 11:24:23 -05:00
|
|
|
COMMAND dlltool -d ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/nfc.def -l ${CMAKE_CURRENT_BINARY_DIR}/libnfc.lib ${CMAKE_CURRENT_BINARY_DIR}/libnfc.dll
|
|
|
|
DEPENDS nfc ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/win32/nfc.def
|
2013-02-01 10:19:02 -05:00
|
|
|
)
|
|
|
|
ADD_CUSTOM_TARGET(win32lib ALL DEPENDS libnfc.lib)
|
|
|
|
|
2009-11-04 10:42:53 +00:00
|
|
|
# On Windows the shared (runtime) library should be either in the same
|
|
|
|
# directory as the excutables or in the path, we add it to same directory
|
|
|
|
INSTALL(TARGETS nfc RUNTIME DESTINATION bin COMPONENT libraries)
|
|
|
|
|
|
|
|
# At compile time we need the .LIB file, we place it in the lib directory
|
|
|
|
INSTALL(TARGETS nfc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT headers)
|
2010-11-17 08:29:41 +00:00
|
|
|
ELSE(WIN32)
|
2009-11-04 10:42:53 +00:00
|
|
|
INSTALL(TARGETS nfc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
|
2010-11-17 08:29:41 +00:00
|
|
|
ENDIF(WIN32)
|
2009-11-04 10:42:53 +00:00
|
|
|
|