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.
This commit is contained in:
Tor Lillqvist 2011-11-04 18:36:26 +02:00
parent 7beffc231c
commit f3a78f52f1

View File

@ -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 \