-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include header files in AAR required for building custom externals #75
Comments
Please share your reference regarding packaging headers in AAR I've only found is: https://stackoverflow.com/q/35140809/901597 |
Sorry for the late response. Seeing this just now. I also don't know a standard way to package header files in AAR. One NDK contributor provides a workaround to include the headers here. I also see vague mention of using C/C++ Package Managers for this purpose here. Interestingly, there seems to be many C/C++ package managers that mention that Android is supported. Examples are cdep, conan, hunter. They may provide a clean way to create AAR with additional stuff like header files although I couldn't figure out how to actually achieve that. this conan documentation shows how to package header files along with the binaries. There may be a way to produce AAR through that. I'm afraid, if any of these is of any relevance to the issue. I will be really surprised if other native libraries used for android does not have the similar need (which seems basic). I wonder how they handle this. |
@rpattabi did you ever make progress on this? I'm looking for tips on how to compile additional externals without also having to check out the PD repository and it sounds like maybe this work was a potential solution. |
Looks like Android Gradle Plugins supports it natively for a while now: https://developer.android.com/studio/build/dependencies#publish-native-libs-in-aars |
pd-for-android
currently includeslibpd.so
and native binaries of standard externals. However, the user ofpd-for-android
aar file wants to write custom externals,m_pd.h
is also required. Such headers required for building custom externals can be packaged in AAR.PdTest
gives a nice example of custom external, but it does not depend on aar file which is what a typical user of this library will have.Documenting the approach I use to build custom external here (Hope it helps someone. Suggestions and corrections are welcome).
Custom External: Compilation
Compilation of custom external requires
m_pd.h
in the include path. To achieve thisgit clone https://github.com/libpd/libpd
CMakeLists.txt
of the custom external module like this. (I have android studio module for custom external and I use CMake for building c/c++ stuff for android as per current recommendation by Google)Custom External: Linking
In order to make linking succeed, I pull libpd.so for different architectures from
pd-for-android
aar like this:Conclusions
As you can see, compilation requires header files from pure data source which we have to pull manually. This makes compilation work, but there may be mismatch between the header files from
libpd
repository and native libs included inpd-for-android
. I learned somewhere thataar
file which carry native libraries can package header files as well.Additionally, it would be great if
pd-for-android
can help further simplify this process.The text was updated successfully, but these errors were encountered: