Skip to content

Conversation

@rpavlik
Copy link

@rpavlik rpavlik commented Nov 22, 2024

This builds on #483 and #482 .

"Prefab" is the way to go these days for native libraries in Android build systems. Switching to prefab here gives us a few advantages, including simplified build scripts, and build dependencies that actually work (./gradlew hellocardboard-android:installDebug in a fresh clone actually works properly.)

There are a few quirks. I had to switch to the shared C++ runtime for the SDK so it would be acceptable to use in a shared library linked to another C++ project, per the rules of the AGP. This is actually overkill, since the cardboard SDK only exports C symbols, but I didn't see a way in AGP to override the exposed STL in the prefab metadata. (Ideally we would build against the static and have the prefab report "NONE", because of only exporting C symbols, but I couldn't figure out how to do that in Gradle. In another project I maintain, I make the prefab metadata files manually, building with CMake and packing with a bash script rather than gradle to get this working.)

So the prefab isn't ideal for use outside the project, but within a single project (e.g. as a submodule) it appears to work great!

@rjcausarano
Copy link

Thanks for your pull request. We have started internal review. Please don’t push any more changes into this PR as they might be overwritten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants