From 6e82236113129013babfe9926a6e897b64e3d9f7 Mon Sep 17 00:00:00 2001 From: dominic Date: Wed, 25 Oct 2023 12:59:04 +0200 Subject: [PATCH] added cmake version info and git hash. --- CMakeLists.txt | 9 ++++++++- src/main.cpp | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af4bfac9..2d801155 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_PROJECT_TOP_LEVEL_INCLUDE set(CMAKE_TOOLCHAIN_FILE "${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake") -project("OmniscopeGui") +project("OmniscopeGui" VERSION 0.5.1) if(MSVC) add_compile_options( @@ -27,11 +27,18 @@ endif() include(cmake_helpers/BuildOptions.cmake) +include(cmake_helpers/FindOrFetch.cmake) add_executable(OmniView src/main.cpp) target_add_default_build_options(OmniView PUBLIC) +find_or_fetch_package( + cmake_git_version 0.1 GIT_REPOSITORY + https://github.com/dominicpoeschko/cmake_git_version.git GIT_TAG master) + +target_add_version_headers(OmniView ${CMAKE_BUILD_TYPE}) + add_subdirectory(ImGuiInstance) target_link_libraries(OmniView PUBLIC imgui_instance::imgui_instance) diff --git a/src/main.cpp b/src/main.cpp index 07563643..2f36e6c6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,6 +20,7 @@ #include #include #include +#include // clang-format off #include // clang-format on @@ -348,6 +349,11 @@ int main() { captureData.clear(); flagPaused = true; } + + if (ImGui::MenuItem( + fmt::format("Version: {}", CMakeGitVersion::VersionWithGit) + .c_str())) { + } ImGui::EndMenu(); } /* @@ -676,8 +682,12 @@ int main() { ImGui::PopStyleColor(7); }; - ImGuiInstance window{1920, 1080, load_json(config, "title")}; + ImGuiInstance window{1920, 1080, + fmt::format("{} {}", + CMakeGitVersion::Target::Name + , CMakeGitVersion::Project::Version)}; + while (window.run(render)) { } return 0; -} \ No newline at end of file +}