使用Android NDK编译xlua
Table of Contents
请尊重原作者的工作,转载时请务必注明转载自:www.xionggf.com
基本上就是按照参考网页所示的那样子,先后安装好Android Studio,打开【File|Setting】菜单项打开界面,把google的CMake选好。注意这里一定要用google家的CMake,用原生CMake不行
如果google CMake的版本过高的话,会报CMake Error: Could not create named generator Android Gradle - Ninja的错误,较新版本的google CMake会产生这个问题,反而低版本的不会,所以选用3.6.4111459版本的才行。Stack Overflow网站上有人就这个问题做了回答:
Compatibility of CMake version might be an issue, Old NDK (below 13b) is not compatible with the new CMake, so, either update NDK or remove the new CMake (to force older CMake usage). Check your System Setting and version listed under SDK Tools Go to Appearance & Behaviour -> System Settings -> Android SDK Incompatible 3.10.2 Compatible 3.6.4111459
选择合适版本的google CMake如下图所示:
NDK的话,就选择r10e版本的就好,试过用r21e版本的,不行,编译时会出错。
在我的电脑里面,ANDROID_SDK
和ANDROID_NDK
两个系统环境变量是E:\sdk\Android\sdk和
E:\sdk\Android\android-ndk-r10e,实质上就是SDK和NDK的根目录,然后再把Android Studio下的google CMake所在目录添加到系统变量Path
里面即可。
参考网页
在windows上编译PC和Android平台的xlua库(并加入第三方lua库lpeg,sproto,lua-crypt)
CMake Error: Could not create named generator Android Gradle - Ninja
CMake Error: Could not create named generator Visual Studio 11
CMake Error: Could not create named generator Xcode
CMake Error: CMake was unable to find a build program corresponding to “Ninja”. CMAKE_MAKE_PROGRAM