Make a note for the usage of my version.hpp.
I can not only get the string of version from LIB_VERSION but also get major/minor/patch versions separately.
I can not only get the string of version from LIB_VERSION but also get major/minor/patch versions separately.
#pragma once
// A *string*, LIB_VERSION, in the form "x.y.[z]"
// where x is the major version number,
// y is the minor version number,
// and z is the patch level
#define LIB_VERSION_MAJOR 0
#define LIB_VERSION_MINOR 4
#define LIB_VERSION_PATCH 12
#define AUX_STR_EXP(__A) #__A
#define AUX_STR(__A) AUX_STR_EXP(__A)
#define LIB_VERSION AUX_STR(LIB_VERSION_MAJOR) "."
\ AUX_STR(LIB_VERSION_MINOR) "."
\ AUX_STR(LIB_VERSION_PATCH)
Besides, I wrote a python script to update the patch.
REG_VERSION_LINE = r"ASUS_VISION_LIB_VERSION_PATCH. +([0-9:]+)"
def changeSoVersion(versionFile):
# Read in the file
filedata = None
with open(versionFile, 'r') as file:
filedata = file.read()
matches = re.finditer(REG_VERSION_LINE, filedata)
for matchNum, match in enumerate(matches):
oldVersion = match.group(1)
newVersion = str(int(match.group(1)) + 1)
print oldVersion
print newVersion
if len(oldVersion) > 0 and len(newVersion) > 0:
filedata = filedata.replace(oldVersion, newVersion)
# Write the file out again
with open(versionFile, 'w') as file:
file.write(filedata)
No comments:
Post a Comment