File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,3 +93,6 @@ lib/astc-encoder
9393lib /shaderc
9494
9595.DS_Store
96+
97+ # Auto-generated files
98+ src /utils /version.hpp
Original file line number Diff line number Diff line change @@ -9,12 +9,22 @@ execute_process(
99
1010# Get the latest abbreviated commit hash of the working branch
1111execute_process (
12- COMMAND git --no-pager describe --tags --always --dirty
12+ COMMAND git --no-pager describe --tags --always --exclude "preview" --exclude "ign-*" -- dirty
1313 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
14- OUTPUT_VARIABLE GIT_COMMIT_HASH
14+ OUTPUT_VARIABLE GIT_VERSION
1515 OUTPUT_STRIP_TRAILING_WHITESPACE
1616)
1717
18+ message (STATUS "Configuring file from: ${CMAKE_SOURCE_DIR} /src/utils/version.hpp.in" )
19+ message (STATUS "Output file: ${CMAKE_SOURCE_DIR} /src/utils/version.hpp" )
20+
21+ configure_file (
22+ ${CMAKE_SOURCE_DIR} /src/utils/version.hpp.in
23+ ${CMAKE_SOURCE_DIR} /src/utils/version.hpp
24+ @ONLY )
25+
26+ include_directories (${CMAKE_BINARY_DIR} /generated )
27+
1828# root CMakeLists for the SuperTuxKart project
1929project (SuperTuxKart)
2030set (PROJECT_VERSION "git" )
@@ -655,9 +665,6 @@ else()
655665 endif()
656666endif()
657667
658- target_compile_definitions(supertuxkart PRIVATE " -DGIT_BRANCH= \"${GIT_BRANCH} \" " )
659- target_compile_definitions (supertuxkart PRIVATE "-DGIT_VERSION=\" ${GIT_COMMIT_HASH} \" " )
660-
661668# check if linking against libatomic is required
662669include(CheckCXXSourceCompiles)
663670check_cxx_source_compiles("
Original file line number Diff line number Diff line change 5050#include " utils/string_utils.hpp"
5151#include " utils/team_manager.hpp"
5252#include " utils/tournament.hpp"
53+ #include " utils/version.hpp"
5354
5455#include < algorithm>
5556#include < fstream>
@@ -623,13 +624,12 @@ void CommandManager::initCommands()
623624
624625 addTextResponse (" description" , getSettings ()->getMotd ());
625626 addTextResponse (" moreinfo" , getSettings ()->getHelpMessage ());
626- std::string version = " 1.3 k 210fff beta" ;
627- #ifdef GIT_VERSION
628- version = std::string (GIT_VERSION);
629- #ifdef GIT_BRANCH
630- version += " , branch " + std::string (GIT_BRANCH);
631- #endif
632- #endif
627+
628+ std::string version = Version::version ();
629+ std::string branch = Version::branch ();
630+ if (!branch.empty ())
631+ version += " , branch " + branch;
632+
633633 addTextResponse (" version" , version);
634634 addTextResponse (" clear" , std::string (30 , ' \n ' ));
635635
You can’t perform that action at this time.
0 commit comments