diff --git a/CMakeLists.txt b/CMakeLists.txt index 41ef333..ce8b311 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,15 @@ PROJECT(libnfc C) CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(VERSION "1.3.0") +SET(VERSION_MAJOR "1") +SET(VERSION_MINOR "2") +SET(VERSION_PATCH "1+svn") + +SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") + +SET(PACKAGE_NAME "libnfc") +SET(PACKAGE_VERSION ${VERSION}) +SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) # make it easy to locate CMake modules for finding libraries SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/") @@ -58,10 +67,10 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Near Field Communication (NFC) library") SET(CPACK_PACKAGE_VENDOR "Roel Verdult") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") -SET(CPACK_PACKAGE_INSTALL_DIRECTORY "LibNFC") -SET(CPACK_PACKAGE_VERSION_MAJOR "1") -SET(CPACK_PACKAGE_VERSION_MINOR "3") -SET(CPACK_PACKAGE_VERSION_PATCH "0") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "libnfc") +SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) +SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) +SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "NFC Library") SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Example Applications") SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Development Headers") diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..ebace1a --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,3 @@ +#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" +#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" +#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" diff --git a/src/examples/nfc-mfclassic.c b/src/examples/nfc-mfclassic.c index 5945062..6d06c83 100644 --- a/src/examples/nfc-mfclassic.c +++ b/src/examples/nfc-mfclassic.c @@ -31,7 +31,9 @@ #include #include "libnfc.h" + #include "mifaretag.h" +#include "bitutils.h" static dev_info* pdi; static tag_info ti; diff --git a/src/libnfc.c b/src/libnfc.c index ca913a0..22c3e98 100644 --- a/src/libnfc.c +++ b/src/libnfc.c @@ -32,6 +32,8 @@ #include "bitutils.h" #include "messages.h" +#include "../config.h" + // Registers and symbols masks used to covers parts within a register #define REG_CIU_TX_MODE 0x6302 #define SYMBOL_TX_CRC_ENABLE 0x80 @@ -996,3 +998,9 @@ bool nfc_target_send_dep_bytes(const dev_info* pdi, const byte_t* pbtTx, const s return true; } +const char* nfc_version(void) +{ + return PACKAGE_VERSION; +} + + diff --git a/src/libnfc.h b/src/libnfc.h index 588acf9..df73afe 100644 --- a/src/libnfc.h +++ b/src/libnfc.h @@ -235,6 +235,13 @@ bool nfc_target_send_bytes(const dev_info* pdi, const byte_t* pbtTx, const size_ */ bool nfc_target_send_dep_bytes(const dev_info* pdi, const byte_t* pbtTx, const size_t szTxLen); +/** + * @fn const char* nfc_version(void) + * @brief Returns the library version + * @return Returns a string with the library version + */ +const char* nfc_version(void); + #ifdef __cplusplus } #endif // __cplusplus