Fix Android

This commit is contained in:
Milan Nikolic 2020-09-03 23:22:07 +02:00
parent 5c9b8d4089
commit 93578e2437
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
3 changed files with 5 additions and 2 deletions

View file

@ -18,7 +18,7 @@ Export sysroot path:
And compile shared library:
CC=arm-linux-androideabi-gcc \
CGO_CFLAGS="-I${ANDROID_SYSROOT}/usr/include --sysroot=${ANDROID_SYSROOT}" \
CGO_CFLAGS="-I${ANDROID_SYSROOT}/usr/include --sysroot=${ANDROID_SYSROOT} -D__ANDROID_API__=16" \
CGO_LDFLAGS="-L${ANDROID_SYSROOT}/usr/lib --sysroot=${ANDROID_SYSROOT}" \
CGO_ENABLED=1 GOOS=android GOARCH=arm \
go build -buildmode=c-shared -ldflags="-s -w -extldflags=-Wl,-soname,libexample.so" \

View file

@ -549,7 +549,8 @@ static void *GamepadThread(void *arg); // Mouse reading thread
#if defined(PLATFORM_ANDROID)
// To allow easier porting to android, we allow the user to define a
// main function which we call from android_main, defined by ourselves
extern int main(int argc, char *argv[]);
//extern int main(int argc, char *argv[]);
extern void android_run();
void android_main(struct android_app *app)
{

View file

@ -2,6 +2,8 @@
#include "_cgo_export.h"
struct android_app *GetAndroidApp();
void android_init() {
struct android_app *app;
app = GetAndroidApp();