diff options
author | FormerLurker <hochgebe@gmail.com> | 2020-11-08 21:38:27 +0300 |
---|---|---|
committer | FormerLurker <hochgebe@gmail.com> | 2020-11-08 21:38:27 +0300 |
commit | 2ce62496fc67d131d65bcfddb550156f6cd4c438 (patch) | |
tree | 5c9349827fa08439e6adf12a40fc851acd591a04 | |
parent | 5eb4453aed430b3c5f336030c9a6eeb6e8ed18eb (diff) |
Add git tag to version.h, improve version display in console apps.
-rw-r--r-- | ArcWelderConsole/ArcWelderConsole.cpp | 5 | ||||
-rw-r--r-- | ArcWelderInverseProcessor/ArcWelderInverseProcessor.cpp | 5 | ||||
-rw-r--r-- | GcodeProcessorLib/CMakeLists.txt | 10 | ||||
-rw-r--r-- | GcodeProcessorLib/version.generated.h.in | 1 | ||||
-rw-r--r-- | GcodeProcessorLib/version.h | 1 |
5 files changed, 17 insertions, 5 deletions
diff --git a/ArcWelderConsole/ArcWelderConsole.cpp b/ArcWelderConsole/ArcWelderConsole.cpp index e19324e..0299028 100644 --- a/ArcWelderConsole/ArcWelderConsole.cpp +++ b/ArcWelderConsole/ArcWelderConsole.cpp @@ -51,8 +51,9 @@ int main(int argc, char* argv[]) // Add info about the application std::string info = "Arc Welder: Anti-Stutter - Reduces the number of gcodes per second sent to a 3D printer that supports arc commands (G2 G3)."; // Add the current vesion information - info.append("\nVersion: ").append(GIT_TAGGED_VERSION).append(" (branch:").append(GIT_BRANCH).append(", hash: )").append(GIT_COMMIT_HASH); - info.append("\nBuilt on ").append(BUILD_DATE); + info.append("\nVersion: ").append(GIT_TAGGED_VERSION); + info.append(", Branch: ").append(GIT_BRANCH); + info.append(", BuildDate: ").append(BUILD_DATE); info.append("\n").append("Copyright(C) ").append(COPYRIGHT_DATE).append(" - ").append(AUTHOR); std::stringstream arg_description_stream; diff --git a/ArcWelderInverseProcessor/ArcWelderInverseProcessor.cpp b/ArcWelderInverseProcessor/ArcWelderInverseProcessor.cpp index 752f129..62a3a07 100644 --- a/ArcWelderInverseProcessor/ArcWelderInverseProcessor.cpp +++ b/ArcWelderInverseProcessor/ArcWelderInverseProcessor.cpp @@ -43,8 +43,9 @@ int main(int argc, char* argv[]) { std::string info = "Arc Straightener - Converts G2/G3 commands to G1/G2 commands.."; - info.append("\nVersion: ").append(GIT_TAGGED_VERSION).append(" (branch:").append(GIT_BRANCH).append(", hash: )").append(GIT_COMMIT_HASH); - info.append("\nBuilt on ").append(BUILD_DATE); + info.append("\nVersion: ").append(GIT_TAGGED_VERSION); + info.append(", Branch: ").append(GIT_BRANCH); + info.append(", BuildDate: ").append(BUILD_DATE); info.append("\n").append("Copyright(C) ").append(COPYRIGHT_DATE).append(" - ").append(AUTHOR); std::stringstream arg_description_stream; diff --git a/GcodeProcessorLib/CMakeLists.txt b/GcodeProcessorLib/CMakeLists.txt index fbfdd1a..1dfca4e 100644 --- a/GcodeProcessorLib/CMakeLists.txt +++ b/GcodeProcessorLib/CMakeLists.txt @@ -59,12 +59,20 @@ execute_process( # get the most recent tagged version execute_process( - COMMAND git describe --tags + COMMAND git describe WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_TAGGED_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) +# get the tag for the current branch +execute_process( + COMMAND git describe --abbrev=0 + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_TAG + OUTPUT_STRIP_TRAILING_WHITESPACE +) + # get the build date string(TIMESTAMP BUILD_DATE "%Y-%m-%dT%H:%M:%SZ" UTC) # get the copyright date diff --git a/GcodeProcessorLib/version.generated.h.in b/GcodeProcessorLib/version.generated.h.in index 1b20014..ec3cd38 100644 --- a/GcodeProcessorLib/version.generated.h.in +++ b/GcodeProcessorLib/version.generated.h.in @@ -5,6 +5,7 @@ #define GIT_BRANCH "@GIT_BRANCH@" #define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@" #define GIT_TAGGED_VERSION "@GIT_TAGGED_VERSION@" +#define GIT_TAG "@GIT_TAG@" #define BUILD_DATE "@BUILD_DATE@" #define COPYRIGHT_DATE "@BUILD_YEAR@" #define AUTHOR "Brad Hochgesang" diff --git a/GcodeProcessorLib/version.h b/GcodeProcessorLib/version.h index 5195b4c..9226f12 100644 --- a/GcodeProcessorLib/version.h +++ b/GcodeProcessorLib/version.h @@ -4,6 +4,7 @@ #define GIT_BRANCH "Unknown" #define GIT_COMMIT_HASH "Unknown" #define GIT_TAGGED_VERSION "Unknown" + #define GIT_TAG "Unknown" #define BUILD_DATE "Unknown" #define COPYRIGHT_DATE "2020" #define AUTHOR "Brad Hochgesang" |