Fix Android
This commit is contained in:
parent
5c9b8d4089
commit
93578e2437
3 changed files with 5 additions and 2 deletions
|
@ -18,7 +18,7 @@ Export sysroot path:
|
||||||
And compile shared library:
|
And compile shared library:
|
||||||
|
|
||||||
CC=arm-linux-androideabi-gcc \
|
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_LDFLAGS="-L${ANDROID_SYSROOT}/usr/lib --sysroot=${ANDROID_SYSROOT}" \
|
||||||
CGO_ENABLED=1 GOOS=android GOARCH=arm \
|
CGO_ENABLED=1 GOOS=android GOARCH=arm \
|
||||||
go build -buildmode=c-shared -ldflags="-s -w -extldflags=-Wl,-soname,libexample.so" \
|
go build -buildmode=c-shared -ldflags="-s -w -extldflags=-Wl,-soname,libexample.so" \
|
||||||
|
|
|
@ -549,7 +549,8 @@ static void *GamepadThread(void *arg); // Mouse reading thread
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
// To allow easier porting to android, we allow the user to define a
|
// To allow easier porting to android, we allow the user to define a
|
||||||
// main function which we call from android_main, defined by ourselves
|
// 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)
|
void android_main(struct android_app *app)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include "_cgo_export.h"
|
#include "_cgo_export.h"
|
||||||
|
|
||||||
|
struct android_app *GetAndroidApp();
|
||||||
|
|
||||||
void android_init() {
|
void android_init() {
|
||||||
struct android_app *app;
|
struct android_app *app;
|
||||||
app = GetAndroidApp();
|
app = GetAndroidApp();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue