提交 48100781 编写于 作者: M Megvii Engine Team

fix(mgb): support rc version

GitOrigin-RevId: aa5fe5198db14df6bdebebc18d571819aec0b7b8
上级 f00741da
......@@ -27,6 +27,9 @@ set (MGE_VER_MINOR ${CMAKE_MATCH_1})
string (REGEX MATCH "MGE_PATCH *([0-9]+)" _ ${content})
set (MGE_VER_PATCH ${CMAKE_MATCH_1})
string (REGEX MATCH "MGE_EXTRA_NAME *\"(.*)\"" _ ${content})
set (MGE_EXTRA_NAME ${CMAKE_MATCH_1})
if (MGB_FORCE_DEV_VERSION)
set (MGB_IS_DEV 1)
else()
......
......@@ -79,9 +79,15 @@ if(DEFINED MGB_VER_MAJOR)
set(IS_INTERNAL "--internal")
else()
set(IS_INTERNAL "")
endif()
endif(DEFINED MGB_VER_MAJOR)
if(DEFINED MGE_EXTRA_NAME)
set(RC_NAME "--rc=${MGE_EXTRA_NAME}")
else()
set(RC_NAME "")
endif(DEFINED MGE_EXTRA_NAME)
add_custom_command(
TARGET ${MODULE_NAME} POST_BUILD
COMMAND "${PYTHON_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/python/gen_version.py --output ${CMAKE_CURRENT_BINARY_DIR}/python/megengine/version.py --major ${MGE_VER_MAJOR} --minor ${MGE_VER_MINOR} --patch ${MGE_VER_PATCH} ${IS_INTERNAL}
COMMAND "${PYTHON_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/python/gen_version.py --output ${CMAKE_CURRENT_BINARY_DIR}/python/megengine/version.py --major ${MGE_VER_MAJOR} --minor ${MGE_VER_MINOR} --patch ${MGE_VER_PATCH} ${RC_NAME} ${IS_INTERNAL}
)
......@@ -20,11 +20,14 @@ if __name__ == "__main__":
parser.add_argument("--major", type=int, required=True)
parser.add_argument("--minor", type=int, required=True)
parser.add_argument("--patch", type=int, required=True)
parser.add_argument("--rc", type=str, required=False)
parser.add_argument("--internal", action='store_true')
args = parser.parse_args()
python_dir = os.path.dirname(__file__)
commit_id = get_git_commit(python_dir)
mge_ver = str(args.major) + "." + str(args.minor) + "." + str(args.patch)
if args.rc is not None:
mge_ver += args.rc
with open(args.output, 'w') as f:
f.write("__version__ = '{}'\n".format(mge_ver))
f.write("git_version = {}\n".format(repr(commit_id)))
......
......@@ -17,6 +17,9 @@
#define MGE_MINOR 7
#define MGE_PATCH 0
// for rc version, could be like "rc1", "rc2", etc
#define MGE_EXTRA_NAME ""
//! whether it is development version
#ifndef MGB_IS_DEV
#define MGB_IS_DEV 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册