diff options
| author | ruki <[email protected]> | 2015-05-12 23:02:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-05-12 23:02:30 +0800 |
| commit | 905e90debb2a79993b16d5761c2eced8fdfad4cc (patch) | |
| tree | bc482ff7c9659ee89d0ed20ef7ddb9d403d46f3e /core/src | |
| parent | 97e6e62e5061f029b1195784671dea9d19211782 (diff) | |
auto-configure plat and arch
Diffstat (limited to 'core/src')
| -rwxr-xr-x | core/src/xmake/machine.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c index 3149daba8..659eb8afe 100755 --- a/core/src/xmake/machine.c +++ b/core/src/xmake/machine.c @@ -210,6 +210,34 @@ xm_machine_ref_t xm_machine_init() // bind string functions luaL_register(impl->lua, "string", g_string_functions); + // init platform +#if defined(TB_CONFIG_OS_WINDOWS) + lua_pushstring(impl->lua, "windows"); +#elif defined(TB_CONFIG_OS_MAC) + lua_pushstring(impl->lua, "macosx"); +#elif defined(TB_CONFIG_OS_LINUX) + lua_pushstring(impl->lua, "linux"); +#elif defined(TB_CONFIG_OS_IOS) + lua_pushstring(impl->lua, "ios"); +#elif defined(TB_CONFIG_OS_ANDROID) + lua_pushstring(impl->lua, "android"); +#elif defined(TB_CONFIG_OS_LIKE_UNIX) + lua_pushstring(impl->lua, "unix"); +#else + lua_pushstring(impl->lua, "unknown"); +#endif + lua_setglobal(impl->lua, "_PLAT"); + + // init architecture +#if defined(TB_ARCH_x86) || defined(TB_CONFIG_OS_WINDOWS) + lua_pushstring(impl->lua, "x86"); +#elif defined(TB_ARCH_x64) + lua_pushstring(impl->lua, "x64"); +#else + lua_pushstring(impl->lua, TB_ARCH_STRING); +#endif + lua_setglobal(impl->lua, "_ARCH"); + // init namespace: xmake lua_newtable(impl->lua); lua_setglobal(impl->lua, "xmake"); |
