git commit and depth in version, android now allows upgrading
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled

This commit is contained in:
Green Sky 2025-04-10 10:51:48 +02:00
parent b10e1ed99a
commit e5498a36ba
No known key found for this signature in database
GPG Key ID: DBE05085D874AB4A
4 changed files with 49 additions and 3 deletions

View File

@ -93,6 +93,42 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
endif() endif()
endif() endif()
# TODO: move to cmake include (maybe function)
set(TOMATO_GIT_DEPTH 0)
set(TOMATO_GIT_COMMIT "UNK")
find_package(Git QUIET)
if(NOT Git_FOUND)
find_program(GIT_EXECUTABLE NAMES git git.exe)
if(GIT_EXECUTABLE)
set(Git_FOUND TRUE)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
endif()
endif()
if(Git_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HEAD
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RES
)
if (RES EQUAL 0)
set(TOMATO_GIT_COMMIT ${GIT_HEAD})
endif()
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DEPTH
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RES
)
if (RES EQUAL 0)
set(TOMATO_GIT_DEPTH ${GIT_DEPTH})
endif()
endif()
# cmake setup end # cmake setup end
add_subdirectory(./src) add_subdirectory(./src)

View File

@ -4,8 +4,8 @@
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.libsdl.app.tomato" package="org.libsdl.app.tomato"
android:versionCode="1" android:versionCode="@TOMATO_GIT_DEPTH@"
android:versionName="@tomato_VERSION_MAJOR@.@tomato_VERSION_MINOR@.@tomato_VERSION_PATCH@" android:versionName="@tomato_VERSION_MAJOR@.@tomato_VERSION_MINOR@.@tomato_VERSION_PATCH@-@TOMATO_GIT_DEPTH@+git.@TOMATO_GIT_COMMIT@"
android:installLocation="auto"> android:installLocation="auto">
<!-- OpenGL ES 2.0 --> <!-- OpenGL ES 2.0 -->

View File

@ -29,7 +29,14 @@
int main(int argc, char** argv) { int main(int argc, char** argv) {
runSysCheck(); runSysCheck();
std::cout << "tomato " TOMATO_VERSION_STR "\n"; std::cout << "tomato " TOMATO_VERSION_STR;
if (TOMATO_GIT_DEPTH != 0) {
std::cout << "-" << TOMATO_GIT_DEPTH;
}
if (std::string_view{TOMATO_GIT_COMMIT} != "UNK") {
std::cout << "+git." << TOMATO_GIT_COMMIT;
}
std::cout << "\n";
#ifdef TOMATO_BREAKPAD #ifdef TOMATO_BREAKPAD
// TODO: maybe run before sys check? // TODO: maybe run before sys check?

View File

@ -4,5 +4,8 @@
#define TOMATO_VERSION_MINOR @tomato_VERSION_MINOR@ #define TOMATO_VERSION_MINOR @tomato_VERSION_MINOR@
#define TOMATO_VERSION_PATCH @tomato_VERSION_PATCH@ #define TOMATO_VERSION_PATCH @tomato_VERSION_PATCH@
#define TOMATO_GIT_COMMIT "@TOMATO_GIT_COMMIT@"
#define TOMATO_GIT_DEPTH @TOMATO_GIT_DEPTH@
#define TOMATO_VERSION_STR "@tomato_VERSION_MAJOR@.@tomato_VERSION_MINOR@.@tomato_VERSION_PATCH@" #define TOMATO_VERSION_STR "@tomato_VERSION_MAJOR@.@tomato_VERSION_MINOR@.@tomato_VERSION_PATCH@"