Update instructions and build script for Android

This commit is contained in:
rodolpheh 2023-11-05 15:07:10 +00:00
parent 6b9c7eaa91
commit 0c50394a66
2 changed files with 38 additions and 3 deletions

View File

@ -7,6 +7,7 @@ A GDExtension plugin to use Ultraleap hand tracking in your project. See GIF bel
- [:hammer\_and\_wrench: Build](#hammer-and-wrench-build)
- [🍎 Mac extra instructions](#mac-extra-instructions)
- [:wine\_glass: Windows extra instructions](#wine-glass-windows-extra-instructions)
- [:robot: Android instructions](#robot-android-instructions)
- [:fast\_forward: Quick start](#fast-forward-quick-start)
![GIF of Ultraleap hand tracking in Godot](res/ul-godot.gif)
@ -38,9 +39,7 @@ The other important scene is an obvious rip-off of Ultraleap's Blocks demo used
## :hammer_and_wrench: Build
To build you'll need to have Python and SCons installed. On Linux and Mac it can be installed using your favourite package manager (homebrew for Mac). On Windows you probably want to install it with [pip](https://pypi.org/project/SCons/). You'll also need a compiler, GCC on Linux, XCode Command Line Tools on Mac, and MSBuild on Windows.
Use git to clone this repository and the submodules:
First thing first, pull all the sources and submodules:
```bash
git clone https://forge.lunai.re/rodolphe/godot-ultraleap-plugin
@ -48,6 +47,10 @@ cd godot-ultraleap-plugin
git submodule update --init
```
**If you want to build the plugin for Android, follow [the specific instructions](#robot-android-instructions)**
To build you'll need to have Python and SCons installed. On Linux and Mac it can be installed using your favourite package manager (homebrew for Mac). On Windows you probably want to install it with [pip](https://pypi.org/project/SCons/). You'll also need a compiler, GCC on Linux, XCode Command Line Tools on Mac, and MSBuild on Windows.
From there, just launch scons:
```bash
@ -64,6 +67,25 @@ After building the extension, copy `/Applications/Ultraleap Hand Tracking Servic
After building the extension, copy `C:/Program Files/Ultraleap/LeapSDK/lib/x64/LeapC.dll` in the `demo/addons/godot_ultraleap_plugin/bin` folder.
### :robot: Android instructions
There are a lot of extra-steps to build for Android. We'll start by assuming you already have installed the Android SDK and the NDK, plus the build tools and all the things required (you can refer to the [Godot documentation](https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_android.html#download-the-android-sdk)). We'll also assume that all the submodules have been pulled and are up-to-date.
On top of that, you'll need to download and copy some files around by yourself:
* [`godot-lib.4.1.2.stable.template_release.aar`](https://github.com/godotengine/godot-builds/releases/download/4.1.2-stable/godot-lib.4.1.2.stable.template_release.aar): put it in `godot-ultraleap-binder/ultraleap-binder/libs`
* [`libLeapC.so` (Android version from Ultraleap's repository)](https://github.com/ultraleap/UnityPlugin/raw/develop/Packages/Tracking/Core/Runtime/Plugins/Android/libs/libLeapC.so): put it in `android`
* [`UltraleapTrackingServiceBinder.aar` (from Ultraleap's repository)](https://github.com/ultraleap/UnityPlugin/raw/develop/Packages/Tracking/Core/Runtime/Plugins/Android/libs/UltraleapTrackingServiceBinder.aar): put it in `godot-ultraleap-binder/ultraleap-binder/libs`
You'll also need to find the file `LeapC.h` which should be wherever your SDK is installed, and place it in `android`. Now we can go on with building:
* Go into `godot-ultraleap-plugin`
* Build the service binder with `./gradlew build`
* Go into the root of the project
* Build the plugin with `ANDROID_NDK_ROOT=<path-to-your-ndk> scons platform=android architecture=arm64`
If everything went well, all files should have been copied in their respective folders.
## :fast_forward: Quick start
**These are very simple instructions and barely covers all the possibilities but it shows my willingness to try and document things to help people who want to adopt this plugin**

View File

@ -59,6 +59,19 @@ elif env["platform"] == "android":
env.Append(LIBS=['LeapC'])
env.Append(LIBPATH = ['./android'])
env.Append(CPPPATH = ["./android"])
post_actions = [
Mkdir("demo/android"),
Mkdir("demo/android/plugins"),
Mkdir("demo/android/plugins/ultraleap_binder"),
Copy("demo/android/plugins/UltraleapBinder.gdap", "godot-ultraleap-binder/UltraleapBinder.gdap"),
Copy("demo/android/plugins/ultraleap_binder/UltraleapTrackingServiceBinder.aar", "godot-ultraleap-binder/ultraleap-binder/libs/UltraleapTrackingServiceBinder.aar"),
Copy("demo/android/plugins/ultraleap_binder/ultraleap-binder-debug.aar", "godot-ultraleap-binder/ultraleap-binder/build/outputs/aar/ultraleap-binder-debug.aar"),
Copy("demo/addons/godot_ultraleap_plugin/bin/libLeapC.so", "android/libLeapC.so")
]
for post_action in post_actions:
AddPostAction(library, post_action)
else:
library = env.SharedLibrary(
"demo/addons/godot_ultraleap_plugin/bin/libgdultraleap{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),