android Studio项目中CMake和NDK-build之间的区别 [英] Difference between CMake and NDK-build in android studio project

查看:607
本文介绍了android Studio项目中CMake和NDK-build之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android Studio项目中构建的CMakeNDK之间的实际区别是什么?我已经看过Google文档,但是这个概念还不清楚.根据Google文档:

What is the actual difference between CMake and NDK build in android studio project. I already went through google documentation but the concept is not clear yet. As per google documentation:

Android Native Development Kit(NDK):一个工具集,可让您 在Android上使用C和C ++代码,并提供平台库 允许您管理本地活动并访问物理设备 组件,例如传感器和触摸输入.

The Android Native Development Kit (NDK): a toolset that allows you to use C and C++ code with Android, and provides platform libraries that allow you to manage native activities and access the physical device components, such as sensors and touch input.

CMake::与Gradle一起使用的外部构建工具 您的本机库.如果您仅计划,则不需要此组件 使用ndk-build.

CMake: an external build tool that works alongside Gradle to build your native library. You do not need this component if you only plan to use ndk-build.

当我们需要使用什么东西时,有人可以通过示例更好地解释吗?

Can anyone has a better explanation with an example when we need to use what?

推荐答案

此处要消除一些混乱:ndk-build是NDK中包含的构建系统.它使用Android.mk文件. NDK本身是编译Android所需的C/C ++代码所需的编译器和库的集合. ndk-build和cmake都使用NDK.

To clear up some confusion here: ndk-build is a build system included in the NDK. It uses Android.mk files. The NDK itself is a collection of compilers and libraries that are needed to build C/C++ code for Android. ndk-build and cmake both use the NDK.

在android studio项目中CMake和NDK构建之间的实际区别是什么.

What is the actual difference between CMake and NDK build in android studio project.

他们使用另一种语言(自定义makefile与cmake)来描述构建.理想情况下,相同描述的构建在输出上没有区别,但这并不意味着没有任何错误.

They use a different language (custom makefiles vs cmake) to describe builds. Ideally there is no difference in output for identically described builds, but that doesn't mean there aren't any bugs.

当我们需要使用什么东西时,有人可以通过示例更好地解释吗?

Can anyone has a better explanation with an example when we need to use what?

通常,使用您喜欢的任何系统.

In general, use whichever system you prefer.

CMake的主要优点是您可以为所有目标(Android,Linux,Windows,iOS等)使用一组构建文件.如果您的项目是跨平台的,则CMake应该使您最容易做到这一点.它在Android开发人员之外也广为人知,因此,刚接触Android的人将有更多的机会来了解它.

CMake's main advantage is that you can use one set of build files for all your targets (Android, Linux, Windows, iOS, etc). If your project is cross platform, CMake should make that easiest on you. It also is widely known outside Android developers, so people new to Android will have a better chance of understanding it.

ndk-build.

ndk-build should be preferred if you're building a project that already uses Android.mk files for its build system (legacy projects).

如果您要编写新代码,请使用任何您愿意使用的代码.如果您都不熟悉,cmake可能是更好的选择,因为如果您选择这样做,它将使将来的跨平台工作变得更容易.

If you're writing new code, use whatever you're comfortable with. If you're not familiar with either, cmake is probably the better choice because it will make cross-platform work easier in the future if you choose to do so.

这篇关于android Studio项目中CMake和NDK-build之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆