Skip to content

Commit 7546e5a

Browse files
committed
Added meta fields like VERSION, BRANCH, URL
1 parent 29f9fd0 commit 7546e5a

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ if(NOT DEFINED GIT_BRANCH)
3333
)
3434
endif()
3535

36+
file(STRINGS "VERSION" ASYNC_POSTGRES_VERSION)
3637
project(gmsv_async_postgres
37-
VERSION 1.0.0
38+
VERSION ${ASYNC_POSTGRES_VERSION}
3839
LANGUAGES C CXX
3940
HOMEPAGE_URL "https://github.com/Pika-Software/gmsv_async_postgres"
4041
)

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

source/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ target_include_directories(async_postgres PRIVATE
2323

2424
set_gmod_suffix_prefix(async_postgres)
2525

26+
# Set version
27+
add_definitions(-DASYNC_POSTGRES_VERSION="${CMAKE_PROJECT_VERSION}" -DASYNC_POSTGRES_BRANCH="${GIT_BRANCH}")
28+
2629
# Autoinstall
2730
set(AUTOINSTALL "" CACHE PATH "Autoinstall path")
2831
if(IS_DIRECTORY ${AUTOINSTALL})

source/async_postgres.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include "safe_pg.hpp"
1717

18+
#define LUA_API_VERSION 1
19+
1820
namespace GLua = GarrysMod::Lua;
1921

2022
#define lua_interface() \

source/main.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,21 @@ void make_global_table(GLua::ILuaInterface* lua) {
301301

302302
async_postgres::register_enums(lua);
303303

304+
lua->PushNumber(LUA_API_VERSION);
305+
lua->SetField(-2, "LUA_API_VERSION");
306+
307+
lua->PushNumber(PQlibVersion());
308+
lua->SetField(-2, "PQ_VERSION");
309+
310+
lua->PushString(ASYNC_POSTGRES_VERSION);
311+
lua->SetField(-2, "VERSION");
312+
313+
lua->PushString(ASYNC_POSTGRES_BRANCH);
314+
lua->SetField(-2, "BRANCH");
315+
316+
lua->PushString("https://github.com/Pika-Software/gmsv_async_postgres");
317+
lua->SetField(-2, "URL");
318+
304319
lua->SetField(GLua::INDEX_GLOBAL, "async_postgres");
305320
}
306321

0 commit comments

Comments
 (0)