From 241c6c2f8e02006cb16b240bb43863cd0e450b60 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 9 Apr 2025 23:18:18 +0200 Subject: [PATCH] add version follows versioning similar to SDL odd patch is dev version --- CMakeLists.txt | 5 ++++- android/CMakeLists.txt | 5 +++-- .../app/{AndroidManifest.xml => AndroidManifest.xml.in} | 2 +- src/CMakeLists.txt | 3 +++ src/main.cpp | 6 +++++- src/version.hpp.in | 8 ++++++++ 6 files changed, 24 insertions(+), 5 deletions(-) rename android/app/{AndroidManifest.xml => AndroidManifest.xml.in} (97%) create mode 100644 src/version.hpp.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 13697e9..c74048e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,10 @@ cmake_minimum_required(VERSION 3.14...3.24 FATAL_ERROR) # cmake setup begin -project(tomato) +project(tomato + VERSION 0.3.1 + HOMEPAGE_URL https://github.com/Green-Sky/tomato +) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index e6f92ed..f2f0bad 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -17,7 +17,8 @@ if(SdlAndroid_FOUND) set(ANDROID_MANIFEST_PACKAGE "org.libsdl.app.tomato") - #set(generated_manifest_path "${CMAKE_CURRENT_BINARY_DIR}/android/${TEST}-src/AndroidManifest.xml") + set(generated_manifest_path "${CMAKE_CURRENT_BINARY_DIR}/android/app/AndroidManifest.xml") + configure_file("app/AndroidManifest.xml.in" generated_manifest_path @ONLY) string(REPLACE "." "/" JAVA_PACKAGE_DIR "${ANDROID_MANIFEST_PACKAGE}") #set(GENERATED_SRC_FOLDER "${CMAKE_CURRENT_BINARY_DIR}/android/${TEST}-src") #set(GENERATED_RES_FOLDER "${GENERATED_SRC_FOLDER}/res") @@ -25,7 +26,7 @@ if(SdlAndroid_FOUND) set(JAVA_PACKAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/app/java/${JAVA_PACKAGE_DIR}") sdl_android_link_resources(tomato-apk-linked - MANIFEST "app/AndroidManifest.xml" + MANIFEST ${generated_manifest_path} PACKAGE ${ANDROID_MANIFEST_PACKAGE} RES_TARGETS tomato-resources TARGET_SDK_VERSION 31 diff --git a/android/app/AndroidManifest.xml b/android/app/AndroidManifest.xml.in similarity index 97% rename from android/app/AndroidManifest.xml rename to android/app/AndroidManifest.xml.in index 28dd22b..fb564d6 100644 --- a/android/app/AndroidManifest.xml +++ b/android/app/AndroidManifest.xml.in @@ -5,7 +5,7 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0df7589..707915d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -169,6 +169,9 @@ if (TOMATO_TOX_AV) target_compile_definitions(tomato PUBLIC TOMATO_TOX_AV) endif() +configure_file(./version.hpp.in version.hpp @ONLY) +target_include_directories(tomato PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") + target_compile_features(tomato PUBLIC cxx_std_17) target_link_libraries(tomato PUBLIC solanaceae_util diff --git a/src/main.cpp b/src/main.cpp index 334fed8..19fa58f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,8 @@ #include #include +#include "version.hpp" + #include "./theme.hpp" #include "./chat_gui/theme.hpp" @@ -27,6 +29,8 @@ int main(int argc, char** argv) { runSysCheck(); + std::cout << "tomato " TOMATO_VERSION_STR "\n"; + #ifdef TOMATO_BREAKPAD // TODO: maybe run before sys check? BREAKPAD_MAIN_INIT; @@ -40,7 +44,7 @@ int main(int argc, char** argv) { } - SDL_SetAppMetadata("tomato", "0.0.4-wip", nullptr); + SDL_SetAppMetadata("tomato", TOMATO_VERSION_STR, nullptr); #ifdef __ANDROID__ // change current working dir to internal storage diff --git a/src/version.hpp.in b/src/version.hpp.in new file mode 100644 index 0000000..4b4ceb5 --- /dev/null +++ b/src/version.hpp.in @@ -0,0 +1,8 @@ +#pragma once + +#define TOMATO_VERSION_MAJOR @tomato_VERSION_MAJOR@ +#define TOMATO_VERSION_MINOR @tomato_VERSION_MINOR@ +#define TOMATO_VERSION_PATCH @tomato_VERSION_PATCH@ + +#define TOMATO_VERSION_STR "@tomato_VERSION_MAJOR@.@tomato_VERSION_MINOR@.@tomato_VERSION_PATCH@" +