diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2011-11-04 18:36:26 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2011-11-07 20:17:40 +0200 |
commit | f3a78f52f1099545f204e8fa3eb992081abe14b4 (patch) | |
tree | e54feb8e354064993717b68c9bb3e974ba376a02 /sal | |
parent | 7beffc231c887eabdc36c55a3126a04c1056f037 (diff) |
First baby steps of proper Android "native" program support
We use the "native app glue" thing from the NDK to avoid having to
have an explicit Java wrapper. (There is one provided by the OS's
NativeActivity anyway; all Android apps are Java programs.)
For simplicity, we just #include android_native_app_glue.c in
sal/main.h. sal/main.h is included only from source files that
actually form the "main" programs for our programs anyway, I hope.
Presumably the only programs we actually want to build for Android in
this way are unit tests. Any real (or toy) LibreOffice-related Android
app would have a totally Android-specific user interface written in
Java, and just call LO libraries, I think.
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/sal/main.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sal/inc/sal/main.h b/sal/inc/sal/main.h index ffe34d4a0a6e..bf1d2d3ef477 100644 --- a/sal/inc/sal/main.h +++ b/sal/inc/sal/main.h @@ -117,6 +117,54 @@ static int sal_main(void); @end +#elif defined ANDROID + +#ifdef __cplusplus +extern "C" { +#endif +#include <android_native_app_glue.c> +#ifdef __cplusplus +} +#endif + +#define SAL_MAIN_WITH_ARGS_IMPL \ +static int sal_main_with_args(int argc, char **argv); \ +\ +void android_main(struct android_app *state) \ +{ \ + int argc = 0; \ + char **argv = { NULL }; \ +\ + (void) state; \ +\ + /* Make sure glue isn't stripped. */ \ + app_dummy(); \ +\ + sal_detail_initialize(argc, argv); \ + sal_main_with_args(argc, argv); \ + sal_detail_deinitialize(); \ +} + +#define SAL_MAIN_IMPL \ +static int sal_main(void); \ +\ +void android_main(struct android_app *state) \ +{ \ + int argc = 0; \ + char **argv = { NULL }; \ +\ + (void) state; \ +\ + /* Make sure glue isn't stripped. */ \ + app_dummy(); \ +\ + sal_detail_initialize(argc, argv); \ + sal_main(); \ + sal_detail_deinitialize(); \ +} + +#define SAL_MAIN_WITH_GUI_IMPL SAL_MAIN_IMPL + #else #define SAL_MAIN_WITH_ARGS_IMPL \ |