mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-12-06 18:08:31 +00:00
meson: add support for building versionlib
This commit is contained in:
parent
557121ce4e
commit
a6de4efe6e
6
meson.build
Normal file
6
meson.build
Normal file
@ -0,0 +1,6 @@
|
||||
project('metamod', 'c', 'cpp')
|
||||
|
||||
public_inc = include_directories('public')
|
||||
|
||||
subdir('versionlib')
|
||||
|
||||
26
meson_options.txt
Normal file
26
meson_options.txt
Normal file
@ -0,0 +1,26 @@
|
||||
option('sdks', type: 'array', choices: [
|
||||
'csgo',
|
||||
'hl2dm',
|
||||
'nucleardawn',
|
||||
'l4d2',
|
||||
'dods',
|
||||
'l4d',
|
||||
'css',
|
||||
'tf2',
|
||||
'insurgency',
|
||||
'sdk2013',
|
||||
'dota',
|
||||
'doi',
|
||||
'orangebox',
|
||||
'blade',
|
||||
'episode1',
|
||||
'bms',
|
||||
'pvkii',
|
||||
'mcv',
|
||||
'darkm',
|
||||
'swarm',
|
||||
'bgt',
|
||||
'eye',
|
||||
'contagion',
|
||||
'cs2',
|
||||
])
|
||||
46
versionlib/meson.build
Normal file
46
versionlib/meson.build
Normal file
@ -0,0 +1,46 @@
|
||||
fs = import('fs')
|
||||
metamod_version_string = fs.read('../product.version').strip()
|
||||
|
||||
version_tag = metamod_version_string.split('-')
|
||||
|
||||
version = version_tag[0].split('.')
|
||||
major = version[0]
|
||||
minor = version[1]
|
||||
release = version[2]
|
||||
|
||||
tag = version_tag[1]
|
||||
|
||||
revision = run_command('git', 'rev-list', '--count', 'HEAD', check: true).stdout().strip()
|
||||
shorthash = run_command('git', 'log', '--pretty=format:%h', '-n', '1', check: true).stdout().strip()
|
||||
product = '.'.join(major, minor, release)
|
||||
|
||||
if tag != ''
|
||||
product += '-' + tag
|
||||
if tag == 'dev'
|
||||
product += '+' + revision
|
||||
endif
|
||||
endif
|
||||
|
||||
metamod_version_config = configuration_data({
|
||||
'tag': tag,
|
||||
'shorthash': shorthash,
|
||||
'major': major,
|
||||
'minor': minor,
|
||||
'release': release,
|
||||
'product': product,
|
||||
'revision': revision,
|
||||
})
|
||||
|
||||
configure_file(
|
||||
input: 'metamod_version_auto.h.in',
|
||||
output: 'metamod_version_auto.h',
|
||||
configuration: metamod_version_config
|
||||
)
|
||||
|
||||
versionlib = static_library(
|
||||
'version',
|
||||
'versionlib.cpp',
|
||||
include_directories: [
|
||||
public_inc,
|
||||
]
|
||||
)
|
||||
16
versionlib/metamod_version_auto.h.in
Normal file
16
versionlib/metamod_version_auto.h.in
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef _METAMOD_AUTO_VERSION_INFORMATION_H_
|
||||
#define _METAMOD_AUTO_VERSION_INFORMATION_H_
|
||||
|
||||
#define MMS_BUILD_TAG "@tag@"
|
||||
#define MMS_BUILD_CSET "@shorthash@"
|
||||
#define MMS_BUILD_MAJOR "@major@"
|
||||
#define MMS_BUILD_MINOR "@minor@"
|
||||
#define MMS_BUILD_RELEASE "@release@"
|
||||
#define MMS_BUILD_LOCAL_REV "@revision@"
|
||||
|
||||
#define MMS_BUILD_UNIQUEID "@revision@:" MMS_BUILD_CSET
|
||||
|
||||
#define MMS_VERSION_STRING "@product@"
|
||||
#define MMS_VERSION_FILE @major@,@minor@,@release@,0
|
||||
|
||||
#endif /* _METAMOD_AUTO_VERSION_INFORMATION_H_ */
|
||||
Loading…
Reference in New Issue
Block a user