hashlink
hashlink copied to clipboard
android vs third-party libraries
I had to make some changes to turbojpeg/vorbis/libpng to make fmt compile, because the sources included in the repo are stripped and doesn't include support for ARM architectures and specific optimizations (e.g. NEON), which raises a question:
What's the reccomended way to work with these libs? Judging from CMakeFiles, the included third-party libraries are only used on windows, so I guess on android/ios one must use official distros?
Right, the include provided versions are only meant to ease windows compilation. They are also used on consoles, but in that case we disable some of them, for instance by using native hardware supported ZLib/JPG decoding.
@rtissera could you comment on the workflow for Android/Windows, or did you only compile from OSX?
Relinking https://github.com/HaxeFoundation/hashlink/wiki/Android for discussion
@ncannasse @nadako We are using Android Studio 3.0.1 using CMake build system. We're basically doing all our mobile development on OS X, but I can guess the following instructions should be easy to follow on Windows using MSYS2 or similar system.
Our current build process is still rough for third-party libraries integration and can be vastly improved, but here's a detailed breakdown of what we do so far :
We have a master CMakeLists.txt (template file attached) including source code of the following repositories into our Android project native code : https://github.com/xiph/vorbis.git https://github.com/xiph/ogg.git https://github.com/kcat/openal-soft https://sourceforge.net/projects/pcre/files/pcre/
We use prebuilt libraries for SDL2 (just use official distro to build them), libpng and libjpeg-turbo by using the following repositories : https://github.com/julienr/libpng-android.git https://github.com/openstf/android-libjpeg-turbo.git
Contrary to libpng and libjpeg-turbo, SDL2 is built as a dynamic library so make sure to explicitly load it on the java side (using System.loadLibrary) before anything else.
We have not integrated mbedtls, libuv, OpenSSL, SQLite, neither FFMPEG since we don't use them in our current project but managed to build them on Android from these repositories :
https://github.com/ARMmbed/mbedtls.git https://github.com/cocochpie/android-openssl.git https://sqlite.org/android/doc/trunk/www/install.wiki (build AAR, extract libraries from it) https://github.com/IljaKosynkin/FFmpeg-Development-Kit.git (build process highly depends on the FFMPEG features you want to embed)
And finally libuv can be built from official repo (there's an android-configure script), but the script might need to be patched for newer NDK versions. https://github.com/libuv/libuv.git
Oh my, that sounds very annoying, anyway thank you!
@nadako - Hi, is your comment above still actual now?
https://github.com/rainyt/zyheaps
here is a library for android/ios easy compilation.