cmake: match Soong global native defines#3
Conversation
f2f1822 to
a3af87b
Compare
|
@Biswa96 this is very cool, do you see how this seems to match this code in Soong? https://android.googlesource.com/platform/build/soong/+/master/cc/config/global.go/#107 does this fix the problem for you? |
|
Thank you for the solution. Is it required to add the |
|
@FuPeiJiang by default, without intervention, the CMake integration of the termux-packages build scripts in GitHub Actions will set |
so far, the events suggest that upstream Android developers probably develop |
|
Given that My only reason for considering a build-system change was that someone did trip over the default/no-build-type CMake behavior, so making CMake mirror Soong's global So I will close this PR for now. The practical takeaway is that release-style CMake builds should be used for these tools, and non- |
|
@Biswa96 after the resolution of this concern, if your tests are now working with |
|
Which tag style would be nice for this project? e.g. |
|
I also prefer I would use the plain converted AOSP version for the first tag for that AOSP base: If a follow-up android-build-tools-only fix is needed while still staying on the same AOSP base, then add another numeric component: That keeps tags distro-friendly, sortable, and avoids letters/underscores. |

Summary
Soong applies common native compiler flags globally. In
build/soong/cc/config/global.go, those flags include:The CMake port was only applying
NDEBUGad hoc tolibandroidfw, which meant some targets and dependencies could be built with different assertion behavior. In particular,libaaptsawNDEBUG, butlibutilsdid not, so a default host CMakeaaptbuild could abort inVectorImpl::itemLocation()on a debug-only assertion that the Soong-style build would compile out.Match Soong's global native defines at the top level instead, and remove the ad hoc
NDEBUGfromlibandroidfw.Testing
Locally tested the same change in an initialized checkout:
VectorImpl.cppcompile line includes-DANDROID,-DNDEBUG, and-UDEBUGResourceTable.cppcompile line includes-DANDROID,-DNDEBUG, and-UDEBUGaapt packagecommand againstandroid-36/android.jar; it succeeded and produced an APKThe same minimal command aborted before this change with: