Gradle:如何自动安装CMAKE
我正在使用cmake
构建的Android Native项目。 在我的build.gradle
我指定:
if(project.hasProperty("native")) {
externalNativeBuild {
cmake {
path file('jni/CMakeLists.txt')
version '3.18.1+'
}
}
}
我想从自动化构建服务器上的命令行调用externalNativeBuild
任务。 但是,我会遇到此错误:
CMake '3.18.1' or higher was not found in SDK, PATH, or by cmake.dir property.
当我在Android Studio
通常下载并安装cmake
时,但它不是从命令行发生的。 有没有办法从命令行进行操作?
I am working on an Android native project which builds using CMake
.
In my build.gradle
I specify :
if(project.hasProperty("native")) {
externalNativeBuild {
cmake {
path file('jni/CMakeLists.txt')
version '3.18.1+'
}
}
}
I want to invoke externalNativeBuild
task from command-line only on an automated build server.
However I am getting this error:
CMake '3.18.1' or higher was not found in SDK, PATH, or by cmake.dir property.
When I build it inside Android Studio
normally, It downloads and install CMake
but it is not happening from command-line.
Is there a way to do it from command-line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Android Studio将自动创建一个
local.properties
文件,其中包含cmake.dir
属性。当您在构建服务器上构建时,您的源很有可能没有
local.properties
文件,因为该文件通常不会被检查到代码存储库中。您要么需要创建此文件,要么修改path
环境变量以包括cmake
二进制。当然,这假定您在构建服务器上安装了CMAKE。您可以使用.zip/.tarball手动执行此操作,或者如果您可以访问构建服务器上的SDK,则可以使用build Tools -> 如何在命令上安装Android SDK构建工具行?Android studio will automatically create a
local.properties
file which contains thecmake.dir
property.When you build on the build server, it's more than likely that you your source doesn't have a
local.properties
file as that file is not normally checked into code repositories. You'll either need to create this file or modify thePATH
environment variable to include thecmake
binary. This of course presumes that you have CMake installed on the build server. You can do this manually with a .zip/.tarball or if you have access to the SDK on the build server, you can install with the build tools -> How to install Android SDK Build Tools on the command line?