mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-09 03:58:14 +03:00
Added versioning system
This commit is contained in:
parent
19b4ba5db0
commit
c9577629d2
4 changed files with 107 additions and 2 deletions
|
@ -5,6 +5,8 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
|
||||||
cmake_policy(SET CMP0076 NEW)
|
cmake_policy(SET CMP0076 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include("./q_version.cmake")
|
||||||
|
|
||||||
# Shared source files for modules
|
# Shared source files for modules
|
||||||
set(SOURCES_SHARED
|
set(SOURCES_SHARED
|
||||||
"${CMAKE_SOURCE_DIR}/code/qcommon/class.cpp"
|
"${CMAKE_SOURCE_DIR}/code/qcommon/class.cpp"
|
||||||
|
@ -28,8 +30,7 @@ target_compile_definitions(qcommon INTERFACE TARGET_GAME_TYPE=${TARGET_GAME_TYPE
|
||||||
target_include_directories(qcommon INTERFACE "../qcommon" "../script")
|
target_include_directories(qcommon INTERFACE "../qcommon" "../script")
|
||||||
target_compile_features(qcommon INTERFACE cxx_nullptr)
|
target_compile_features(qcommon INTERFACE cxx_nullptr)
|
||||||
target_compile_features(qcommon INTERFACE c_variadic_macros)
|
target_compile_features(qcommon INTERFACE c_variadic_macros)
|
||||||
|
target_link_libraries(qcommon INTERFACE qcommon_version)
|
||||||
include("./q_version.cmake")
|
|
||||||
|
|
||||||
# Source files for standalone executable
|
# Source files for standalone executable
|
||||||
set(SOURCES_COMMON
|
set(SOURCES_COMMON
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
add_library(qcommon_version INTERFACE)
|
||||||
|
|
||||||
|
# Current branch
|
||||||
|
execute_process(
|
||||||
|
COMMAND git branch --show-current
|
||||||
|
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Revision
|
||||||
|
execute_process(
|
||||||
|
COMMAND git show -s --format=%H HEAD
|
||||||
|
OUTPUT_VARIABLE GIT_REVISION_HASH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Commit date
|
||||||
|
execute_process(
|
||||||
|
COMMAND git show -s --format=%ct
|
||||||
|
OUTPUT_VARIABLE GIT_REVISION_DATE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
string(TIMESTAMP GIT_REVISION_DATE UTC)
|
||||||
|
|
||||||
|
set(GIT_REVISION_DATE_HUMAN ${GIT_REVISION_DATE})
|
||||||
|
string(TIMESTAMP GIT_REVISION_DATE_HUMAN "%b %d %Y" UTC)
|
||||||
|
|
||||||
|
configure_file("q_version.generated.h.in" "generated/q_version.generated.h")
|
||||||
|
target_include_directories(qcommon_version INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
28
code/qcommon/q_version.generated.h.in
Normal file
28
code/qcommon/q_version.generated.h.in
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
===========================================================================
|
||||||
|
Copyright (C) 2023 the OpenMoHAA team
|
||||||
|
|
||||||
|
This file is part of OpenMoHAA source code.
|
||||||
|
|
||||||
|
OpenMoHAA source code is free software; you can redistribute it
|
||||||
|
and/or modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the License,
|
||||||
|
or (at your option) any later version.
|
||||||
|
|
||||||
|
OpenMoHAA source code is distributed in the hope that it will be
|
||||||
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenMoHAA source code; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
===========================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// q_version.generated.h -- file versioning
|
||||||
|
|
||||||
|
#define GIT_BRANCH_NAME "${GIT_BRANCH_NAME}"
|
||||||
|
#define GIT_REVISION_HASH "${GIT_REVISION_HASH}"
|
||||||
|
#define GIT_REVISION_DATE "${GIT_REVISION_DATE}"
|
||||||
|
#define GIT_REVISION_DATE_HUMAN "${GIT_REVISION_DATE_HUMAN}"
|
|
@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <q_version.generated.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Version
|
// Version
|
||||||
//
|
//
|
||||||
|
@ -32,3 +34,47 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define PRODUCT_VERSION_MINOR 55
|
#define PRODUCT_VERSION_MINOR 55
|
||||||
#define PRODUCT_VERSION_PATCH 1
|
#define PRODUCT_VERSION_PATCH 1
|
||||||
#define PRODUCT_VERSION_STAGE "alpha"
|
#define PRODUCT_VERSION_STAGE "alpha"
|
||||||
|
|
||||||
|
#ifdef GIT_BRANCH_NAME
|
||||||
|
# define PRODUCT_VERSION_BRANCH GIT_BRANCH_NAME
|
||||||
|
#else
|
||||||
|
# define PRODUCT_VERSION_BRANCH "none"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GIT_REVISION_HASH
|
||||||
|
# define PRODUCT_VERSION_REVISION GIT_REVISION_HASH
|
||||||
|
#else
|
||||||
|
# define PRODUCT_VERSION_REVISION ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GIT_REVISION_DATE_HUMAN
|
||||||
|
# define PRODUCT_VERSION_DATE GIT_REVISION_DATE_HUMAN
|
||||||
|
#else
|
||||||
|
# define PRODUCT_VERSION_DATE __DATE__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PRODUCT_VERSION_FULL PRODUCT_NAME_FULL
|
||||||
|
#define Q3_VERSION PRODUCT_VERSION_FULL
|
||||||
|
|
||||||
|
//
|
||||||
|
// Version display
|
||||||
|
//
|
||||||
|
#define PRODUCT_VERSION_NUMBER_STRING XSTRING(PRODUCT_VERSION_MAJOR) "." XSTRING(PRODUCT_VERSION_MINOR) "." XSTRING(PRODUCT_VERSION_PATCH)
|
||||||
|
#define PRODUCT_VERSION PRODUCT_VERSION_NUMBER_STRING "-" PRODUCT_VERSION_STAGE
|
||||||
|
|
||||||
|
#define PRODUCT_NAME_FULL PRODUCT_NAME " - v" PRODUCT_VERSION " - ext-" PRODUCT_EXTENSION
|
||||||
|
|
||||||
|
/*
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
// These values are the only one that must be set for the version
|
||||||
|
extern const unsigned int PRODUCT_VERISON_MAJOR;
|
||||||
|
extern const unsigned int PRODUCT_VERISON_MINOR;
|
||||||
|
extern const unsigned int PRODUCT_VERISON_PATCH;
|
||||||
|
extern const char* PRODUCT_VERSION_STAGE;
|
||||||
|
|
||||||
|
extern const char* PRODUCT_VERSION_BRANCH;
|
||||||
|
extern const char* PRODUCT_VERSION_REVISION_HASH;
|
||||||
|
extern const char* PRODUCT_VERSION_REVISION_DATE;
|
||||||
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue