Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print version info from git describe #30

Merged
merged 6 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: lukka/get-cmake@latest

- name: CMake Configure
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# drp022521 - reduced from 3.14 to 3.8 for VS2017 support
# dbl051923 - capture git describe for banner

cmake_minimum_required (VERSION 3.8)

set(CMAKE_CXX_STANDARD 14)
Expand All @@ -7,6 +9,15 @@ set(CMAKE_CXX_EXTENSIONS OFF)

project(bmai)

# Get the latest git tag and short commit hash
execute_process(
COMMAND git describe --dirty --always --tags
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DGIT_DESCRIBE=\"${GIT_DESCRIBE}\"")

# to collect only needed source files
set(SOURCE ./src/bmai.cpp ./src/bmai_ai.cpp ./src/player.cpp ./src/stats.cpp)

Expand Down
2 changes: 1 addition & 1 deletion src/bmai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4114,7 +4114,7 @@ int main(int argc, char *argv[])
//g_ai.SetQAI(&g_ai_mode0);

// banner
printf("BMAI: the Button Men AI\nCopyright (c) 2001-2023, Denis Papp.\nFor information, contact Denis Papp, denis@accessdenied.net\n");
printf("BMAI: the Button Men AI\nCopyright (c) 2001-2023, Denis Papp.\nFor information, contact Denis Papp, denis@accessdenied.net\nVersion: %s\n", GIT_DESCRIBE);

//g_parser.SetupTestGame();
if (argc>1)
Expand Down
5 changes: 5 additions & 0 deletions src/bmai.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ typedef float F32;
// special types
typedef std::vector<float> BMC_FloatVector;

// version number
#ifndef GIT_DESCRIBE
#define GIT_DESCRIBE "n/a"
#endif

// assert
#define BM_ASSERT assert
#define BM_ERROR(check) { if (!(check)) { BMF_Error(#check); } }
Expand Down