Add version stuff
This commit is contained in:
parent
85598b898b
commit
6a26407bd7
55
buildbot/Versioning
Normal file
55
buildbot/Versioning
Normal file
@ -0,0 +1,55 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from ambuild.cache import Cache
|
||||
import ambuild.command as command
|
||||
|
||||
#Quickly try to ascertain the current repository revision
|
||||
def GetVersion():
|
||||
args = ['hg', 'parent', '-R', AMBuild.sourceFolder]
|
||||
p = command.RunDirectCommand(AMBuild, args)
|
||||
m = re.match('changeset:\s+(\d+):(.+)', p.stdoutText)
|
||||
if m == None:
|
||||
raise Exception('Could not determine repository version')
|
||||
return m.groups()
|
||||
|
||||
def PerformReversioning():
|
||||
rev, cset = GetVersion()
|
||||
cacheFile = os.path.join(AMBuild.outputFolder, '.ambuild', 'hgcache')
|
||||
cache = Cache(cacheFile)
|
||||
if os.path.isfile(cacheFile):
|
||||
cache.LoadCache()
|
||||
if cache.HasVariable('cset') and cache['cset'] == cset:
|
||||
return False
|
||||
cache.CacheVariable('cset', cset)
|
||||
|
||||
productFile = open(os.path.join(AMBuild.sourceFolder, 'buildbot', 'product.version'), 'r')
|
||||
productContents = productFile.read()
|
||||
productFile.close()
|
||||
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents)
|
||||
if m == None:
|
||||
raise Exception('Could not detremine product version')
|
||||
major, minor, release, tag = m.groups()
|
||||
|
||||
incFolder = os.path.join(AMBuild.sourceFolder)
|
||||
incFile = open(os.path.join(incFolder, 'version_auto.h'), 'w')
|
||||
incFile.write("""
|
||||
#ifndef _AUTO_VERSION_INFORMATION_H_
|
||||
#define _AUTO_VERSION_INFORMATION_H_
|
||||
|
||||
#define SM_BUILD_TAG \"{0}\"
|
||||
#define SM_BUILD_UNIQUEID \"{1}:{2}\" SM_BUILD_TAG
|
||||
#define SM_VERSION \"{3}.{4}.{5}\"
|
||||
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
|
||||
#define SM_FILE_VERSION {6},{7},{8},0
|
||||
|
||||
#endif /* _AUTO_VERSION_INFORMATION_H_ */
|
||||
|
||||
""".format(tag, rev, cset, major, minor, release, major, minor, release))
|
||||
incFile.close()
|
||||
cache.WriteCache()
|
||||
|
||||
PerformReversioning()
|
||||
|
||||
|
27
version.h
Normal file
27
version.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _INCLUDE_VERSION_INFORMATION_H_
|
||||
#define _INCLUDE_VERSION_INFORMATION_H_
|
||||
|
||||
/**
|
||||
* @file Contains version information.
|
||||
* @brief This file will redirect to an autogenerated version if being compiled via
|
||||
* the build scripts.
|
||||
*/
|
||||
|
||||
#if defined SM_GENERATED_BUILD
|
||||
#include "version_auto.h"
|
||||
#else
|
||||
|
||||
#ifndef SM_GENERATED_BUILD
|
||||
#undef BINARY_NAME
|
||||
#define BINARY_NAME "dhooks.ext.dll\0"
|
||||
#endif
|
||||
|
||||
#define SM_BUILD_TAG "-manual"
|
||||
#define SM_BUILD_UNIQUEID "[MANUAL BUILD]"
|
||||
#define SM_VERSION "2.0.0"
|
||||
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
|
||||
#define SM_FILE_VERSION 1,0,0,0
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE_VERSION_INFORMATION_H_ */
|
45
version.rc
Normal file
45
version.rc
Normal file
@ -0,0 +1,45 @@
|
||||
#include "winres.h"
|
||||
|
||||
#include <version.h>
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif
|
||||
|
||||
#ifndef SM_GENERATED_BUILD
|
||||
#define BINARY_NAME "vphysics.ext.dll\0"
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION SM_FILE_VERSION
|
||||
PRODUCTVERSION SM_FILE_VERSION
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "DHooks Extension"
|
||||
VALUE "FileDescription", "Dynamic Hooks"
|
||||
VALUE "FileVersion", SM_BUILD_UNIQUEID
|
||||
VALUE "InternalName", "DHooks"
|
||||
VALUE "LegalCopyright", ""
|
||||
VALUE "OriginalFilename", BINARY_NAME
|
||||
VALUE "ProductName", "DHooks Extension"
|
||||
VALUE "ProductVersion", SM_FULL_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 0x04B0
|
||||
END
|
||||
END
|
Loading…
Reference in New Issue
Block a user