Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FormerLurker/ArcWelderLib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFormerLurker <hochgebe@gmail.com>2020-11-08 21:27:34 +0300
committerFormerLurker <hochgebe@gmail.com>2020-11-08 21:27:34 +0300
commit5eb4453aed430b3c5f336030c9a6eeb6e8ed18eb (patch)
treef23df828a2b018b66571d8404b933c5f2f940b12 /GcodeProcessorLib
parent8bc8b43506c2601823cad652a33da84389381c99 (diff)
Code cleanup. Rename exe files for console and inverse processor app. Implement #15 and #16.
Diffstat (limited to 'GcodeProcessorLib')
-rw-r--r--GcodeProcessorLib/CMakeLists.txt78
-rw-r--r--GcodeProcessorLib/GcodeProcessorLib.vcxproj2
-rw-r--r--GcodeProcessorLib/GcodeProcessorLib.vcxproj.filters4
-rw-r--r--GcodeProcessorLib/sourcelist.cmake2
-rw-r--r--GcodeProcessorLib/version.generated.h.in11
-rw-r--r--GcodeProcessorLib/version.h13
6 files changed, 110 insertions, 0 deletions
diff --git a/GcodeProcessorLib/CMakeLists.txt b/GcodeProcessorLib/CMakeLists.txt
index a6143eb..fbfdd1a 100644
--- a/GcodeProcessorLib/CMakeLists.txt
+++ b/GcodeProcessorLib/CMakeLists.txt
@@ -2,6 +2,84 @@ cmake_minimum_required (VERSION "3.13")
project(GcodeProcessorLib C CXX)
+# create a version information header - version.h
+# First get the current branch and store to GIT_BRANCH variable
+execute_process(
+ COMMAND git rev-parse --abbrev-ref HEAD
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_BRANCH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# get the current commit version
+execute_process(
+ COMMAND git log -1 --format=%h
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_COMMIT_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# get the most recent tagged version
+execute_process(
+ COMMAND git describe --tags
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_TAGGED_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# get the build date
+string(TIMESTAMP BUILD_DATE "%Y-%m-%dT%H:%M:%SZ" UTC)
+# get the copyright date
+string(TIMESTAMP BUILD_YEAR "%Y" UTC)
+
+# add a definition so our libraries know that the version info is available
+add_definitions("-DHAS_GENERATED_VERSION")
+
+# Generate version.h CMAKE_BINARY_DIR
+configure_file(
+ "${PROJECT_SOURCE_DIR}/version.generated.h.in"
+ "${CMAKE_BINARY_DIR}/version.generated.h"
+)
+# create a version information header - version.h
+# First get the current branch and store to GIT_BRANCH variable
+execute_process(
+ COMMAND git rev-parse --abbrev-ref HEAD
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_BRANCH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# get the current commit version
+execute_process(
+ COMMAND git log -1 --format=%h
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_COMMIT_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# get the most recent tagged version
+execute_process(
+ COMMAND git describe --tags
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_TAGGED_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# get the build date
+string(TIMESTAMP BUILD_DATE "%Y-%m-%dT%H:%M:%SZ" UTC)
+# get the copyright date
+string(TIMESTAMP BUILD_YEAR "%Y" UTC)
+
+# add a definition so our libraries know that the version info is available
+add_definitions("-DHAS_GENERATED_VERSION")
+
+# Generate version.h CMAKE_BINARY_DIR
+configure_file(
+ "${PROJECT_SOURCE_DIR}/version.generated.h.in"
+ "${CMAKE_BINARY_DIR}/GcodeProcessorLib/generated/version.generated.h"
+)
+include_directories("${CMAKE_BINARY_DIR}/GcodeProcessorLib/generated/")
+
option(USE_CXX_EXCEPTIONS "Enable C++ exception support" ON)
# include sourcelist.cmake, which contains our source list and exposes it as the
diff --git a/GcodeProcessorLib/GcodeProcessorLib.vcxproj b/GcodeProcessorLib/GcodeProcessorLib.vcxproj
index 0457545..12aa788 100644
--- a/GcodeProcessorLib/GcodeProcessorLib.vcxproj
+++ b/GcodeProcessorLib/GcodeProcessorLib.vcxproj
@@ -205,6 +205,7 @@
<ClInclude Include="parsed_command_parameter.h" />
<ClInclude Include="position.h" />
<ClInclude Include="utilities.h" />
+ <ClInclude Include="version.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="array_list.cpp" />
@@ -224,6 +225,7 @@
</ItemGroup>
<ItemGroup>
<None Include="sourcelist.cmake" />
+ <None Include="version.generated.h.in" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/GcodeProcessorLib/GcodeProcessorLib.vcxproj.filters b/GcodeProcessorLib/GcodeProcessorLib.vcxproj.filters
index 869d7ff..3989cb0 100644
--- a/GcodeProcessorLib/GcodeProcessorLib.vcxproj.filters
+++ b/GcodeProcessorLib/GcodeProcessorLib.vcxproj.filters
@@ -48,6 +48,9 @@
<ClInclude Include="utilities.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="array_list.cpp">
@@ -89,5 +92,6 @@
</ItemGroup>
<ItemGroup>
<None Include="sourcelist.cmake" />
+ <None Include="version.generated.h.in" />
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/GcodeProcessorLib/sourcelist.cmake b/GcodeProcessorLib/sourcelist.cmake
index ca1a9e7..ec1786b 100644
--- a/GcodeProcessorLib/sourcelist.cmake
+++ b/GcodeProcessorLib/sourcelist.cmake
@@ -21,4 +21,6 @@ set(GcodeProcessorLibSources ${GcodeProcessorLibSources}
position.h
utilities.cpp
utilities.h
+ version.generated.h
+ version.h
) \ No newline at end of file
diff --git a/GcodeProcessorLib/version.generated.h.in b/GcodeProcessorLib/version.generated.h.in
new file mode 100644
index 0000000..1b20014
--- /dev/null
+++ b/GcodeProcessorLib/version.generated.h.in
@@ -0,0 +1,11 @@
+#ifndef VERSION_GENERATED_H
+#define VERSION_GENERATED_H
+#endif
+
+#define GIT_BRANCH "@GIT_BRANCH@"
+#define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@"
+#define GIT_TAGGED_VERSION "@GIT_TAGGED_VERSION@"
+#define BUILD_DATE "@BUILD_DATE@"
+#define COPYRIGHT_DATE "@BUILD_YEAR@"
+#define AUTHOR "Brad Hochgesang"
+
diff --git a/GcodeProcessorLib/version.h b/GcodeProcessorLib/version.h
new file mode 100644
index 0000000..5195b4c
--- /dev/null
+++ b/GcodeProcessorLib/version.h
@@ -0,0 +1,13 @@
+#ifndef VERSION_H
+#define VERSION_H
+ #ifndef HAS_GENERATED_VERSION
+ #define GIT_BRANCH "Unknown"
+ #define GIT_COMMIT_HASH "Unknown"
+ #define GIT_TAGGED_VERSION "Unknown"
+ #define BUILD_DATE "Unknown"
+ #define COPYRIGHT_DATE "2020"
+ #define AUTHOR "Brad Hochgesang"
+ #else
+ #include "version.generated.h"
+ #endif
+#endif \ No newline at end of file