Skip to content
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

Port Sdl2Application to Android #186

Open
7 tasks
mosra opened this issue Nov 26, 2016 · 1 comment
Open
7 tasks

Port Sdl2Application to Android #186

mosra opened this issue Nov 26, 2016 · 1 comment
Assignees

Comments

@mosra
Copy link
Owner

mosra commented Nov 26, 2016

This has been requested numerous times in the past and until now was blocked by lack of automated tests for Android (to avoid accidental breakages when adding stuff for other platforms). That's done now, so...

The official way to use SDL2 on Android is basically to bundle its whole source with your app and use Android's native build system. I could count a hundred reasons why forcing someone to bundle a source tree and/or use some particularly crappy build system is a wrong idea and I want to do better.

In short, I want to make Sdl2Application working on Android in hopefully the same way as the AndroidApplication is: 90% of CMake workflow stays the same, only a bunch of small files added to your project and two additional adb/ant commands in order to build and install the package (which could then be even integrated into CMake).

What needs to be done:

  • Find a way to build SDL2 for Android using CMake
  • Find a way to build SDL2 for Android using CMake and our Android toolchain
    • Currently CMake is not able to find any headers, breaking everything during build
  • Integrate SDL2 changes upstream, if really needed (I hope not)
  • Find a way to build the SDL2 Java wrapper and all glue and implicitly include it when using Sdl2Application
    • We can't just use the native_app_glue provided by NDK, we need to build our own
    • CMake's UseJava module might help with the JNI stuff
  • Document everything
  • Make a bootstrap repo
  • Port more complex examples to it

Cc: @alicemargatroid

@mosra
Copy link
Owner Author

mosra commented Dec 29, 2018

Re-thinking this after a while:

  • bundling SDL2 on Android may inflate the APK quite a lot, since we only ever use < 10% of its API (no raster stuff like circle drawing, gradients, etc.)
  • building it requires compiling an additional Java source, which is nowhere near straightforward, especially if want to use only CMake and android_create_apk()
  • lots of the unneeded extra complexity is because it tries emulates the busy-loop approach from desktops which we can't use portably at all due to Emscripten
  • we're actually going the other direction with Emscripten (Emscripten application #300), creating an Emscripten-specific Application implementation without SDL, to reduce the bloat

At this point, I'm slowly filling the gaps in AndroidApplication to make it more feature-complete and on par with Sdl2App. Currently that's the path of least obstacles and there's no immediate plan in porting Sdl2Application to Android.

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

No branches or pull requests

1 participant