lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Le 27 déc. 2013 à 18:05, Artem Metra <Artem.Metra@gmx.de> a écrit :

> I have searched for a solution to get LUA lib build for iOS up to arm64 but haven't found a good one.
> Does anybody know how to get LUA build for iOS? Or is there a prebuild library available somewhere?
> 

I'm not sure of what you're exactly searching for in order to compile your lib for iOS, but you'll need at least to do some adaptations to luaconf.h, as iOS differs from Mac OS X in the supported features set.
More specifically, two flags shall be deactivated for iOS (compared to Mac OS X):
- LUA_USE_DLOPEN, as iOS does not support dynamic libraries
- LUA_USE_POPEN, as iOS apps can not fork processes.

My recommended way of putting this in luaconf.h is to add a new compilation flag LUA_USE_IOS, with the following actions:

#if defined(LUA_USE_IOS)
#define LUA_USE_POSIX
#define LUA_USE_STRTODHEX	/* assume 'strtod' handles hexa formats */
#define LUA_USE_AFORMAT		/* assume 'printf' handles 'aA' specifiers */
#define LUA_USE_LONGLONG	/* assume support for long long */
#define LUA_USE_ASSERT      /* lua_assert uses assert */
#endif

and, after << #if defined(LUA_USE_POSIX) [...] #endif>>

#if defined(LUA_USE_IOS)
#undef LUA_USE_POPEN  /* no popen support on iOS */
#endif

Then you'll just need to compile Lua with "-DLUA_USE_IOS" passed to the C compiler.

Hope this helps

Jean-Luc