Fix CMake pkg-config generation: "Requires:" is now dynamic.

Fix devices.h, #endif should not be followed by the name of the block.
Fix CMake libnfc_usb compilation.
Rename tools to examples in CMake file.
(This patch comes from Fkooman, thanks !)
This commit is contained in:
Romuald Conty 2009-09-14 08:47:31 +00:00
parent e2dc2c133a
commit 0977dd1c0b
3 changed files with 21 additions and 13 deletions

View file

@ -1,10 +1,11 @@
SET(LIBRARY-SOURCES libnfc rs232 bitutils dev_arygon)
SET(TOOLS-SOURCES list mftool mfultool initiator target anticol emulate relay)
SET(EXAMPLES-SOURCES list mftool mfultool initiator target anticol emulate relay)
# 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} "dev_acr122")
ENDIF(LIBNFC_PCSC)
@ -12,7 +13,8 @@ ENDIF(LIBNFC_PCSC)
IF(LIBNFC_USB)
FIND_PACKAGE(LIBUSB REQUIRED)
ADD_DEFINITIONS("-DHAVE_LIBUSB=1")
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_pn531 dev_pn533")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS_OTHER}")
SET(LIBRARY-SOURCES ${LIBRARY-SOURCES} "dev_pn531" "dev_pn533")
ENDIF(LIBNFC_USB)
IF(LIBNFC_VERBOSE_OUTPUT)
@ -64,7 +66,7 @@ IF(MSVC)
ENDIF(MSVC)
# Examples
FOREACH(source ${TOOLS-SOURCES})
FOREACH(source ${EXAMPLES-SOURCES})
ADD_EXECUTABLE(nfc-${source} ${source}.c)
TARGET_LINK_LIBRARIES(nfc-${source} nfc)
INSTALL(TARGETS nfc-${source} RUNTIME DESTINATION bin COMPONENT examples)

View file

@ -25,22 +25,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "types.h"
#ifdef HAVE_PCSC_LITE
#include "dev_acr122.h"
#endif
#endif /* HAVE_PCSC_LITE */
#ifdef HAVE_LIBUSB
#include "dev_pn531.h"
#include "dev_pn533.h"
#endif HAVE_LIBUSB
#endif /* HAVE_LIBUSB */
#include "dev_arygon.h"
const static struct dev_callbacks dev_callbacks_list[] = {
// Driver Name Connect Transceive Disconnect
#ifdef HAVE_PCSC_LITE
{ "ACR122", dev_acr122_connect, dev_acr122_transceive, dev_acr122_disconnect },
#endif
#endif /* HAVE_PCSC_LITE */
#ifdef HAVE_LIBUSB
{ "PN531USB", dev_pn531_connect, dev_pn531_transceive, dev_pn531_disconnect },
{ "PN533USB", dev_pn533_connect, dev_pn533_transceive, dev_pn533_disconnect },
#endif HAVE_LIBUSB
#endif /* HAVE_LIBUSB */
{ "ARYGON", dev_arygon_connect, dev_arygon_transceive, dev_arygon_disconnect }
};