File tree Expand file tree Collapse file tree 5 files changed +47
-0
lines changed Expand file tree Collapse file tree 5 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ Comment: Documents for LuaSTGPlus Danmaku Game Engine
54
54
Copyright: 2022, 9chu.
55
55
License: CC-BY-NC-SA-4.0
56
56
57
+ Files: ./cmake/GenerateVersionHeader.cmake
58
+ Comment: https://github.com/nocnokneo/cmake-git-versioning-example
59
+ Copyright: 2021, Taylor Braun-Jones.
60
+ License: Expat
61
+
57
62
Files: ./include/lstg/Core/Math/Collider2D/IntersectCheck.hpp
58
63
Comment: https://github.com/Xrysnow/lstgx_Math
59
64
Copyright: 2018, Xrysnow.
Original file line number Diff line number Diff line change
1
+ if (GIT_EXECUTABLE )
2
+ get_filename_component (SRC_DIR ${SRC} DIRECTORY )
3
+ # Generate a git-describe version string from Git repository tags
4
+ execute_process (
5
+ COMMAND ${GIT_EXECUTABLE} describe --tags --dirty --match "v*"
6
+ WORKING_DIRECTORY ${SRC_DIR}
7
+ OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
8
+ RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
9
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
10
+ if (NOT GIT_DESCRIBE_ERROR_CODE )
11
+ set (LSTG_VERSION ${GIT_DESCRIBE_VERSION} )
12
+ endif ()
13
+ endif ()
14
+
15
+ # Final fallback: Just use a bogus version string that is semantically older
16
+ # than anything else and spit out a warning to the developer.
17
+ if (NOT DEFINED LSTG_VERSION )
18
+ set (LSTG_VERSION v0.0.0-unknown )
19
+ message (WARNING "Failed to determine LSTG_VERSION from Git tags. Using default version \" ${LSTG_VERSION} \" ." )
20
+ endif ()
21
+
22
+ configure_file (${SRC} ${DST} @ONLY )
Original file line number Diff line number Diff line change
1
+ ### 生成版本号信息
2
+
3
+ find_package (Git )
4
+ add_custom_target (LuaSTGPlus2Version
5
+ ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/Version.hpp.in
6
+ -D DST=${CMAKE_CURRENT_BINARY_DIR}/Version.hpp
7
+ -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
8
+ -P ${CMAKE_CURRENT_SOURCE_DIR} /../../cmake/GenerateVersionHeader.cmake )
9
+
1
10
### 目标
2
11
# Lua 自动封装代码
3
12
file (GLOB_RECURSE LSTG_V2_BRIDGE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR} /../../include/lstg/v2/Bridge/*.hpp )
27
36
endif ()
28
37
target_include_directories (LuaSTGPlus2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} /../../include ${CMAKE_CURRENT_BINARY_DIR} )
29
38
target_link_libraries (LuaSTGPlus2 PUBLIC LuaSTGPlusCore SDL2main cjson imgui implot )
39
+ add_dependencies (LuaSTGPlus2 LuaSTGPlus2Version )
30
40
31
41
#set(LSTG_V2_DEFS_PRIVATE)
32
42
#message("[LSTG-v2] Private compiler definitions: ${LSTG_V2_DEFS_PRIVATE}")
Original file line number Diff line number Diff line change 11
11
#include < lstg/Core/Pal.hpp>
12
12
#include < lstg/Core/Logging.hpp>
13
13
14
+ // 版本信息
15
+ #include < Version.hpp>
16
+
14
17
using namespace std ;
15
18
using namespace lstg ;
16
19
using namespace lstg ::v2;
@@ -23,6 +26,11 @@ SDLMAIN_DECLSPEC int main(int argc, char* argv[])
23
26
24
27
// 强制日志系统初始化
25
28
Logging::GetInstance ();
29
+ #ifdef LSTG_DEVELOPMENT
30
+ LSTG_LOG_INFO (" Version: {} (Development mode)" , LSTG_VERSION);
31
+ #else
32
+ LSTG_LOG_INFO (" Version: {} (Shipping mode)" , LSTG_VERSION);
33
+ #endif
26
34
27
35
// 初始化 GameApp
28
36
#ifdef LSTG_PLATFORM_EMSCRIPTEN
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+ #define LSTG_VERSION "@LSTG_VERSION@"
You can’t perform that action at this time.
0 commit comments