Android NDK incremental build
Asked Answered
S

1

14

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

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.

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

Thanks in advance

Sidestroke answered 1/12, 2010 at 19:40 Comment(1)
I am not aware of anything that does this. I would love to know if there is a solution. I have been looking for oneSeriema
V
11

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.

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.

(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)

Vincevincelette answered 1/12, 2010 at 20:29 Comment(2)
If possible, please share some more info about the process of building our own makefile and how to handle the Android specific macros etc..Tophus
@Tophus - run the ndk make script with the V=1 option for verbose output. Copy the result into an editor and start splitting it up into traditional categories for makefile variables.Vincevincelette

© 2022 - 2024 — McMap. All rights reserved.