Android NDK 增量构建 [英] Android NDK incremental build

查看:19
本文介绍了Android NDK 增量构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用大量 C++ 代码开发一个大型 Android 应用程序.它编译并运行,到目前为止一切顺利.

I'm currently working on a large Android app using a massive amount of C++ code. It compiles and runs, so far so good.

不幸的是,每次我修改本地源代码结构中的某些内容(添加/删除/重命名/移动文件)时,这种情况经常发生,ndk-build 会重新构建整个源代码,甚至未触及的文件.

Unfortunately, every time I modify something in the structure of my native source (add/delete/rename/move a file), which happens pretty often, ndk-build rebuilds the whole source, even the untouched files.

有谁知道我可以如何设置 Android NDK 以某种方式逐步构建?

Does anyone know how I can set up the Android NDK to build incrementally somehow?

提前致谢

推荐答案

我厌倦了 NDK 构建系统,研究了一下,并编写了自己的 makefile.这并不难.

I got fed up with the NDK build system, studied it for a bit, and wrote my own makefiles. This was not hard.

但是,随后有人向我指出,通过这样做,我将不得不负责跟踪平台的未来变化,例如,如果有必要为其他处理器类型提供二进制文件,我必须修改我自己的构建解决方案来做到这一点.

However, it was then pointed out to me that by doing this, I would have to take responsibility for tracking future changes to the platform, for example if it becomes necessary to ship binaries for additional processor types, I'd have to modify my homegrown build solution to do that too.

在其他情况下,有时我的项目有两个构建系统 - 一个用于快速实验,另一个用于可部署构建.不时更新所花费的时间在日常工作的速度增益中节省了很多倍.如果我必须至少每周或每两周进行一次真正的构建,那么事情的一致性永远不会太差(并且两个构建脚本都在修订控制系统中,因此需要检查历史).可以使用用于调试构建的自定义 makefile 来完成类似的操作,并且仍然使用 NDK 构建系统来部署可部署的包.

In other contexts, I've sometimes had projects with two build systems - one for quick experiments, another for deployable builds. The time spent updating both now and then was saved many times in the speed gain for daily work. Provided I had to do a real build at least every week or two, things never got very far out of consistency (and both build scripts were in the revision control system, so there was history to examine). Something like this could be done with a custom makefile for debug builds and still using the NDK build system for deployable packages.

(在一个在平台允许的范围内进行大量实验的情况下,我实际上让我的 makefile 将更新的 .so 推送到设备上,并为我的应用程序提供了一个不鼓励的硬退出按钮,所以我可以使用更新的本机库重新启动它,甚至无需重新构建和重新安装 apk)

(In one case of doing a lot of experiments at the edge of what the platform permits, I actually had my makefile pushing the updated .so onto the device and gave my application one of the discouraged hard-quit buttons, so I could restart it using an updated native library without even having to rebuild and reinstall the apk)

这篇关于Android NDK 增量构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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