在Android NDK项目中从命令行运行CMake [英] Running CMake from command line within an Android NDK project
问题描述
一个人如何独立于Android项目的其余部分(最好是从命令行开始,而不是Android Studio外部)运行NDK Cmake构建?
How might one run an NDK Cmake build independently from the rest of an Android project, ideally from the command line, external to Android Studio?
等效于从jni目录运行ndk-build
,用于较旧的Android NDK项目.
The equivalent of running ndk-build
from the jni directory for slightly older Android NDK projects.
我需要确切调查对编译器的调用是什么样子,并且在Android Studio中构建整个项目时似乎无法获得此信息
I need to investigate exactly what the calls to the compiler look like, and I can't seem to get this information when building the whole project from within Android Studio
我的第一次尝试只是从包含CMakeLists.txt
的project/app
目录中运行cmake,但这通知我未安装cmake
-那么Android Studio如何设法构建它?
My first attempt was just to run cmake from the project/app
directory containing CMakeLists.txt
, but this informs me that cmake
is not installed - so how is Android Studio managing to build it then?
推荐答案
如果您的目标是仅从命令行运行(而不是尝试准确地做graem所做的事情),像往常一样使用cmake:
If your goal is to just run from the command line (as opposed to trying to do exactly what gradle is doing), just use cmake the way you normally would:
$ cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=whatever $YOUR_SOURCE_DIR
或者,您也可以从命令行运行./gradlew
.
Alternatively, you can just run ./gradlew
from the command line.
这篇关于在Android NDK项目中从命令行运行CMake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!