Display Commit ID Used for Build in AboutDialog (#6516)

* Display commit ID used for build in AboutDialog

* Dynamically check for snapshots

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
ElectricalBoy 2025-01-03 01:38:25 +09:00 committed by GitHub
parent 02438e25bc
commit 091ab68811
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 0 deletions

View file

@ -22,6 +22,28 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
endif()
find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
# Check if Orca is on a tag
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --exact-match --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE GIT_TAG_CHECK
)
if(NOT GIT_TAG_CHECK EQUAL 0)
add_definitions("-DSNAPSHOT_BUILD=1")
endif()
# Check current Git commit hash
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
endif()
if(DEFINED ENV{SLIC3R_STATIC})
set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
else()