Skip to content

Commit

Permalink
descriptors: fetch product version from tag (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
vk2seb authored Jan 19, 2025
1 parent 41ace43 commit eac5b47
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,21 @@ endif()
# Add the compile definition
add_compile_definitions(TILIQUA_HW_MAJOR=${TILIQUA_HW_MAJOR})

# Add executable. Default name is the project name, version 0.1
execute_process(
COMMAND git describe --tags --dirty
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

configure_file(
${CMAKE_SOURCE_DIR}/version.h.in
${CMAKE_BINARY_DIR}/version.h
@ONLY
)

# Add executable. Default name is the project name, version 0.1
add_executable(dirtyJtag
dirtyJtag.c
usb_descriptors.c
Expand Down
7 changes: 4 additions & 3 deletions usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "dirtyJtagConfig.h"
#include "tusb.h"
#include "version.h"
#include "get_serial.h"

#if ( USB_CDC_UART_BRIDGE )
Expand Down Expand Up @@ -124,11 +125,11 @@ char const *string_desc_arr[] =
(const char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
"apf.audio", // 1: Manufacturer
#if (TILIQUA_HW_MAJOR == 2)
"Tiliqua R2 (dbg)",
"Tiliqua R2 " GIT_VERSION,
#elif (TILIQUA_HW_MAJOR == 3)
"Tiliqua R3 (dbg)",
"Tiliqua R3 " GIT_VERSION,
#elif (TILIQUA_HW_MAJOR == 4)
"Tiliqua R4 (dbg)",
"Tiliqua R4 " GIT_VERSION,
#else
#error "Unknown TILIQUA_HW_MAJOR"
#endif
Expand Down
1 change: 1 addition & 0 deletions version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define GIT_VERSION "@GIT_DESCRIBE@"

0 comments on commit eac5b47

Please sign in to comment.