Skip to content

remove standalone example, simplify readme #554

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ release: update build-luajit
@echo "Application $(APPNAME) was built, type: release (unsigned), flavor: $(FLAVOR), version: $(NAME), release $(VERSION)"
@echo "WARNING: You'll need to sign this application to be able to install it"

example: update clean build-luajit
@echo "Building HelloWorld example"
mkdir -p assets/module/
cp -pv examples/helloWorld/*.lua assets/module/
./gradlew -q -PversName=1.0 -PversCode=1 -PprojectName=HelloFromLua \
-PndkCustomPath=$(ANDROID_NDK_FULLPATH) app:$(BUILD_TASK)Debug
mkdir -p bin/
find app/build/outputs/apk/ -type f -name '*.apk' -exec mv -v {} bin/ \;

lint:
./gradlew -PndkCustomPath=$(ANDROID_NDK_FULLPATH) $(LINT_TASK)Release

Expand Down
33 changes: 1 addition & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ NativeActivity is available starting with platform android-9.

Have a look at the Android NDK's "native-plasma" sample activity to get an idea what it does - or rather, is theoretically able to do. While the sample from NDK implements everything in C, in our case, we create a LuaJIT instance and hand off control to it instead. LuaJIT then handles the main loop. In this programming model, we have a thread which presents us with a "main" entry point and allow us to follow our own program flow as long as we poll for and react to events.

A good number of Android native API headers are readily presented via FFI already. I'll probably add more along the way.

For now - and probably ever, since Mike Pall recommends strongly to do so - the compilation of LuaJIT is not integrated into the Android build framework and has to be run separately.

A wrapper script for building LuaJIT is provided. It **relies on NDK r15c**
A good number of Android native API headers are readily presented via FFI already.

Have a look at KOReader's [llapp_main.lua](https://github.com/koreader/koreader/blob/master/platform/android/llapp_main.lua) file. You can use it as a starting point for your own app.

Expand All @@ -22,30 +18,3 @@ The real starting point, called from JNI/C, is the run() function in android.lua
## Disclaimer

This repo is used as glue code to run KOReader on Android.

Usage on its own doesn't make much sense since you're expected to write your own drawing routines in Lua!
A standalone example is attached (with no drawing routines!) in case you're curious what you'll get.


## Building the example app

### Export `ANDROID_NDK_HOME`

```sh
export ANDROID_NDK_HOME=/path/to/your/ndk/folder
```

### Build example APK for arm 32 bits

```sh
make example
```


### Build example APK for any other arch

```sh
ANDROID_ARCH=MY_ARCH make example
```

where `MY_ARCH` is either `x86`, `x86_64` or `arm64`
9 changes: 0 additions & 9 deletions examples/helloWorld/llapp_main.lua

This file was deleted.

89 changes: 0 additions & 89 deletions examples/helloWorld/main_loop.lua

This file was deleted.

15 changes: 0 additions & 15 deletions examples/helloWorld/utils.lua

This file was deleted.