Add printable libhackrf and hackrf tools version strings
This commit is contained in:
@ -3,6 +3,24 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project (hackrf_all)
|
||||
|
||||
#set(RELEASE "")
|
||||
|
||||
if(NOT DEFINED RELEASE)
|
||||
execute_process(
|
||||
COMMAND git log -n 1 --format=%h
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE GIT_VERSION_FOUND
|
||||
ERROR_QUIET
|
||||
OUTPUT_VARIABLE GIT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if (GIT_VERSION_FOUND)
|
||||
set(RELEASE "unknown")
|
||||
else (GIT_VERSION_FOUND)
|
||||
set(RELEASE "git-${GIT_VERSION}")
|
||||
endif (GIT_VERSION_FOUND)
|
||||
endif()
|
||||
|
||||
add_subdirectory(libhackrf)
|
||||
add_subdirectory(hackrf-tools)
|
||||
|
||||
|
@ -23,11 +23,8 @@
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project(hackrf-tools C)
|
||||
set(MAJOR_VERSION 0)
|
||||
set(MINOR_VERSION 5)
|
||||
set(PACKAGE hackrf-tools)
|
||||
set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
|
||||
set(VERSION ${VERSION_STRING})
|
||||
add_definitions(-DTOOL_RELEASE="${RELEASE}")
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake/modules)
|
||||
|
||||
if(MSVC)
|
||||
|
@ -45,6 +45,10 @@ int main(void)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("hackrf_info version: %s\n", TOOL_RELEASE);
|
||||
printf("libhackrf version: %s (%s)\n", hackrf_library_release(),
|
||||
hackrf_library_version());
|
||||
|
||||
list = hackrf_device_list();
|
||||
|
||||
if (list->devicecount < 1 ) {
|
||||
|
@ -24,10 +24,12 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project(libhackrf C)
|
||||
set(MAJOR_VERSION 0)
|
||||
set(MINOR_VERSION 4)
|
||||
set(MINOR_VERSION 5)
|
||||
set(PACKAGE libhackrf)
|
||||
set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
|
||||
set(VERSION ${VERSION_STRING})
|
||||
add_definitions(-DLIBRARY_VERSION="${VERSION_STRING}")
|
||||
add_definitions(-DLIBRARY_RELEASE="${RELEASE}")
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake/modules)
|
||||
|
||||
if(MSVC)
|
||||
|
@ -365,6 +365,22 @@ int ADDCALL hackrf_exit(void)
|
||||
return HACKRF_SUCCESS;
|
||||
}
|
||||
|
||||
#ifndef LIBRARY_VERSION
|
||||
#define LIBRARY_VERSION "unknown"
|
||||
#endif
|
||||
const char* ADDCALL hackrf_library_version()
|
||||
{
|
||||
return LIBRARY_VERSION;
|
||||
}
|
||||
|
||||
#ifndef LIBRARY_RELEASE
|
||||
#define LIBRARY_RELEASE "unknown"
|
||||
#endif
|
||||
const char* ADDCALL hackrf_library_release()
|
||||
{
|
||||
return LIBRARY_RELEASE;
|
||||
}
|
||||
|
||||
hackrf_device_list_t* ADDCALL hackrf_device_list()
|
||||
{
|
||||
ssize_t i;
|
||||
|
@ -133,6 +133,9 @@ extern "C"
|
||||
extern ADDAPI int ADDCALL hackrf_init();
|
||||
extern ADDAPI int ADDCALL hackrf_exit();
|
||||
|
||||
extern ADDAPI const char* ADDCALL hackrf_library_version();
|
||||
extern ADDAPI const char* ADDCALL hackrf_library_release();
|
||||
|
||||
extern ADDAPI hackrf_device_list_t* ADDCALL hackrf_device_list();
|
||||
extern ADDAPI int ADDCALL hackrf_device_list_open(hackrf_device_list_t *list, int idx, hackrf_device** device);
|
||||
extern ADDAPI void ADDCALL hackrf_device_list_free(hackrf_device_list_t *list);
|
||||
|
Reference in New Issue
Block a user