Skip to content

Commit 5cd0b94

Browse files
author
Simon Inns
committed
Fix --version number output and add -dirty suffix as required
1 parent e61dec5 commit 5cd0b94

21 files changed

Lines changed: 32 additions & 34 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ execute_process(
131131
OUTPUT_STRIP_TRAILING_WHITESPACE
132132
)
133133

134+
# Check if there are uncommitted changes
135+
execute_process(
136+
COMMAND git diff-index --quiet HEAD --
137+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
138+
RESULT_VARIABLE GIT_DIRTY
139+
)
140+
141+
# Add -dirty suffix if there are uncommitted changes
142+
if(GIT_DIRTY)
143+
set(GIT_COMMIT_HASH "${GIT_COMMIT_HASH}-dirty")
144+
endif()
145+
134146
add_compile_definitions(APP_BRANCH=\"${GIT_BRANCH}\")
135147
add_compile_definitions(APP_COMMIT=\"${GIT_COMMIT_HASH}\")
136148

src/efm-decoder/CMakeLists.txt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,7 @@ project(efm-tools)
55

66
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
77

8-
# Get the Git branch and revision
9-
execute_process(
10-
COMMAND git rev-parse --abbrev-ref HEAD
11-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
12-
OUTPUT_VARIABLE GIT_BRANCH
13-
OUTPUT_STRIP_TRAILING_WHITESPACE
14-
)
15-
execute_process(
16-
COMMAND git log -1 --format=%h
17-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
18-
OUTPUT_VARIABLE GIT_COMMIT_HASH
19-
OUTPUT_STRIP_TRAILING_WHITESPACE
20-
)
21-
add_compile_definitions(APP_BRANCH=\"${GIT_BRANCH}\")
22-
add_compile_definitions(APP_COMMIT=\"${GIT_COMMIT_HASH}\")
8+
# Git branch and commit are defined in the parent CMakeLists.txt
239

2410
# Add subdirectories
2511
add_subdirectory(libs/efm)

src/efm-decoder/tools/efm-decoder-audio/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
4646
// Set application name and version
4747
QCoreApplication::setApplicationName("efm-decoder-audio");
4848
QCoreApplication::setApplicationVersion(
49-
QString("Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
49+
QString("ld-decode-tools - Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
5050
QCoreApplication::setOrganizationDomain("domesday86.com");
5151

5252
// Set up the command line parser

src/efm-decoder/tools/efm-decoder-d24/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
4646
// Set application name and version
4747
QCoreApplication::setApplicationName("efm-decoder-d24");
4848
QCoreApplication::setApplicationVersion(
49-
QString("Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
49+
QString("ld-decode-tools - Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
5050
QCoreApplication::setOrganizationDomain("domesday86.com");
5151

5252
// Set up the command line parser

src/efm-decoder/tools/efm-decoder-data/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
4646
// Set application name and version
4747
QCoreApplication::setApplicationName("efm-decoder-data");
4848
QCoreApplication::setApplicationVersion(
49-
QString("Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
49+
QString("ld-decode-tools - Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
5050
QCoreApplication::setOrganizationDomain("domesday86.com");
5151

5252
// Set up the command line parser

src/efm-decoder/tools/efm-decoder-f2/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
4646
// Set application name and version
4747
QCoreApplication::setApplicationName("efm-decoder-f2");
4848
QCoreApplication::setApplicationVersion(
49-
QString("Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
49+
QString("ld-decode-tools - Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
5050
QCoreApplication::setOrganizationDomain("domesday86.com");
5151

5252
// Set up the command line parser

src/efm-decoder/tools/efm-stacker-f2/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
5151
// Set application name and version
5252
QCoreApplication::setApplicationName("efm-stacker-f2");
5353
QCoreApplication::setApplicationVersion(
54-
QString("Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
54+
QString("ld-decode-tools - Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
5555
QCoreApplication::setOrganizationDomain("domesday86.com");
5656

5757
// Set up the command line parser

src/efm-decoder/tools/vfs-verifier/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
5050
// Set application name and version
5151
QCoreApplication::setApplicationName("vfs-verifier");
5252
QCoreApplication::setApplicationVersion(
53-
QString("Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
53+
QString("ld-decode-tools - Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
5454
QCoreApplication::setOrganizationDomain("domesday86.com");
5555

5656
// Set up the command line parser

src/ld-analyse/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
106106

107107
// Set application name and version
108108
QCoreApplication::setApplicationName("ld-analyse");
109-
QCoreApplication::setApplicationVersion(QString("Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
109+
QCoreApplication::setApplicationVersion(QString("ld-decode-tools - Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
110110
QCoreApplication::setOrganizationDomain("domesday86.com");
111111

112112
// Set desktop file name for proper GNOME integration

src/ld-chroma-decoder/encoder/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
4949

5050
// Set application name and version
5151
QCoreApplication::setApplicationName("ld-chroma-encoder");
52-
QCoreApplication::setApplicationVersion(QString("Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
52+
QCoreApplication::setApplicationVersion(QString("ld-decode-tools - Branch: %1 / Commit: %2").arg(APP_BRANCH, APP_COMMIT));
5353
QCoreApplication::setOrganizationDomain("domesday86.com");
5454

5555
// Set up the command line parser

0 commit comments

Comments
 (0)