glsl-optimizer
glsl-optimizer copied to clipboard
Building for android
Hello, I've struggled for 2 days now trying to build this for Android. I've managed to build the static libs, but linking them to the project is a bloody nightmare. Undefined variables all over the place. Does anyone have any source code I can browse to find the solution?
Thanks
It seems that the std library in the ndk doesn't include some key functions like rand that the library uses. Has anyone managed to get this running on Android? I might end up having to use the emscriptened js version soon...
Here's the config I used (with NDK 10e).
It's been a while but I vaguely recall modifying/deleting some of the source files as well.
In the end, it did run on Android, yes.
Thanks a billion, you're a life saver.
On Tue, May 24, 2016 at 4:47 PM, aliasaila [email protected] wrote:
Here's the config https://gist.github.com/aliasaila/b5b041d3add88d4a4747c230f30e4eb4 I used (with NDK 10e).
It's been a while but I vaguely recall modifying/deleting some of the source files as well.
In the end, it did run on Android, yes.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/aras-p/glsl-optimizer/issues/127#issuecomment-221294921
Ah ok, so you're actually building it in the Android.mk. I've been building it as a static lib with cmake then just wrapping it in the Android.mk.
Ok got it! I wasted all that time trying to build it as a library first then wrap it, when I could have just built it directly with the Android.mk. Thanks!
One thing for future android builders: this version of glsl-optimizer crashes when using the release build. You have to use this fork, which has some bug fixes that aren't in this repo.
I think cmake was updated to work directly with the android NDK. So now you just do:
cmake . -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="$NDK" -DCMAKE_ANDROID_ARCH_ABI=$ARCH -DCMAKE_SYSTEM_VERSION=21
make glsl_optimizer
Also, I had a similar issue with rand
and what not. The issue I had was that the code I was linking against was compiling against platform-19 and glsl-optimizer was compiled for platform-21, which ins't compatible with 19. So I changed my codebase to compile against platform-21 and everything was fine.