Add function to return library version at execute time. Fix Issue 39. Thanks to Zuck for his contribution.
Remove compilation warning due to missing includes in examples.
This commit is contained in:
parent
edec0ae3da
commit
39a1e1fd11
5 changed files with 34 additions and 5 deletions
|
@ -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")
|
||||
|
|
3
config.h.cmake
Normal file
3
config.h.cmake
Normal file
|
@ -0,0 +1,3 @@
|
|||
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
|
||||
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
|
@ -31,7 +31,9 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include "libnfc.h"
|
||||
|
||||
#include "mifaretag.h"
|
||||
#include "bitutils.h"
|
||||
|
||||
static dev_info* pdi;
|
||||
static tag_info ti;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue