summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2015-11-26 09:29:26 +0800
committerruki <[email protected]>2015-11-26 09:29:26 +0800
commit834f71c6e70e62c719060d0cf5bed34fe715fb16 (patch)
tree544bcde42984f1a7dfd3676d5e84bfcdbc2ba67a
parente22f1e2d6f637f388db226c94ac185f6f5f8bbcc (diff)
modify version
-rwxr-xr-xcore/src/xmake/machine.c11
-rw-r--r--xmake/scripts/_xmake_main.lua2
2 files changed, 12 insertions, 1 deletions
diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c
index b32a05dfa..7e5cae462 100755
--- a/core/src/xmake/machine.c
+++ b/core/src/xmake/machine.c
@@ -286,6 +286,17 @@ xm_machine_ref_t xm_machine_init()
#endif
lua_setglobal(impl->lua, "_NULDEV");
+ // init version
+ tb_version_t const* version = xm_version();
+ if (version)
+ {
+ tb_char_t version_cstr[256] = {0};
+ tb_snprintf(version_cstr, sizeof(version_cstr), "XMake v%u.%u.%u.%llu", version->major, version->minor, version->alter, version->build);
+ lua_pushstring(impl->lua, version_cstr);
+ }
+ else lua_pushstring(impl->lua, "XMake");
+ lua_setglobal(impl->lua, "_VERSION");
+
// init namespace: xmake
lua_newtable(impl->lua);
lua_setglobal(impl->lua, "xmake");
diff --git a/xmake/scripts/_xmake_main.lua b/xmake/scripts/_xmake_main.lua
index cdc2cf016..c8ca48589 100644
--- a/xmake/scripts/_xmake_main.lua
+++ b/xmake/scripts/_xmake_main.lua
@@ -26,7 +26,7 @@ xmake._ARGV = _ARGV
xmake._HOST = _HOST
xmake._ARCH = _ARCH
xmake._NULDEV = _NULDEV
-xmake._VERSION = "XMake v1.0.1"
+xmake._VERSION = _VERSION
xmake._PROGRAM_DIR = _PROGRAM_DIR
xmake._PROJECT_DIR = _PROJECT_DIR
xmake._SCRIPTS_DIR = _PROGRAM_DIR .. "/scripts"