mirror of
https://github.com/godotengine/godot-swappy.git
synced 2026-02-25 06:32:52 +03:00
Update to latest version of swappy
Built from source
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
build/
|
||||
BIN
Docs/build_tools.png
Normal file
BIN
Docs/build_tools.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 135 KiB |
BIN
Docs/ndk_install.png
Normal file
BIN
Docs/ndk_install.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
BIN
Docs/sdk_install.png
Normal file
BIN
Docs/sdk_install.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 138 KiB |
118
README.md
118
README.md
@@ -1,7 +1,119 @@
|
||||
This repo contains prebuilt versions of Google's Swappy Frame Pacing library.
|
||||
|
||||
Obtained from agdk-libraries-2023.3.0.0.zip
|
||||
|
||||
SHA-256 b663c36461f8c3665931819cd3e4b29a09655353082add573ba7ab463c8347a0
|
||||
Compiled from source.
|
||||
|
||||
See [Releases page](https://github.com/godotengine/godot-angle-static/releases).
|
||||
|
||||
# How to build from source
|
||||
|
||||
This script has only been tested on Ubuntu 24.04 LTS. **READ ALL THE STEPS BEFORE LAUNCHING THE SCRIPT**.
|
||||
|
||||
1. The script will checkout a specific commit hash. If you want a different one, Edit [build.bash](./build.bash) and change `SPECIFIC_REVISION` variable.
|
||||
2. You **must** set environment variables `ANDROID_SDK` to point to Android SDK and `JAVA_HOME` to point to the Java installation (for best results, use the one bundled with Android Studio), and `ANDROID_NDK` to a specific NDK version (see Common Errors section).
|
||||
- gradle dropped support for `ANDROID_NDK` environment variable a long time ago, *however* the Gradle scripts in gamesdk check for this variable and re-added the functionality.
|
||||
3. You **must edit** [local.properties](./local.properties) to have `sdk.dir` point to your Android SDK (i.e. same as `ANDROID_SDK`), and have `cmake.dir` point to where the CMake included in your Android SDK lives.
|
||||
|
||||
This script assumes you already have installed necessary dependencies such as repo, git, the Android SDK and Android Studio.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
sudo apt install repo ninja-build git
|
||||
|
||||
export ANDROID_HOME=/home/matias/Android/Sdk
|
||||
export JAVA_HOME=/home/matias/apps/android-studio/jbr
|
||||
export ANDROID_NDK=/home/matias/Android/Sdk/ndk/21.4.7075529
|
||||
|
||||
./build.bash
|
||||
```
|
||||
|
||||
## Extracting the files
|
||||
|
||||
The files will be generated at `build/package/local/gamesdk.zip`. Decompress it and extract `games-frame-pacing-release.aar`.
|
||||
|
||||
The files will be at `games-frame-pacing-release.aar_FILES/prefab/modules/swappy_static`.
|
||||
|
||||
Note that the library paths say: `android.arm64-v8a`, `android.x86_64`, etc. **Remove** the `android.` prefix.
|
||||
|
||||
# Common Errors
|
||||
|
||||
## "NDK not configured"
|
||||
|
||||
If you get the following error message:
|
||||
|
||||
```
|
||||
org.gradle.api.InvalidUserDataException: NDK not configured. Download it with SDK manager. Preferred NDK version is '21.4.7075529'.
|
||||
```
|
||||
|
||||
You **must** install NDK version `21.4.7075529` (or whatever number it asks you). It says "preferred" but it's mandatory.
|
||||
You may have others NDK versions installed, but the error won't go away until you install the exact version it is asking you.
|
||||
|
||||
Use the SDK Manager -> **SDK Tools**:
|
||||
|
||||

|
||||
|
||||
## Failed to find target with hash string 'android-31'
|
||||
|
||||
If you get the error:
|
||||
|
||||
```
|
||||
Failed to find target with hash string 'android-31' in: /home/matias/Android/Sdk
|
||||
```
|
||||
|
||||
Then you must install Android API 31 SDK.
|
||||
|
||||
Use the SDK Manager -> **SDK Platforms**:
|
||||
|
||||

|
||||
|
||||
## Failed to find Build Tools revision 30.0.3
|
||||
|
||||
Install Build Tools version 30.0.3
|
||||
|
||||
Use the SDK Manager -> **SDK Tools**:
|
||||
|
||||

|
||||
|
||||
## Other errors
|
||||
|
||||
Pay a lot of attention to the errors, it's very easy to get lost.
|
||||
|
||||
**For example all the following errors are completely misleading:**
|
||||
|
||||
```
|
||||
> Task :buildSrc:compileKotlin
|
||||
'compileJava' task (current target is 17) and 'compileKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
|
||||
w: /home/matias/SlowProjects/godot-swappy/build/gamesdk/buildSrc/src/main/java/com/google/androidgamesdk/AarPrefabPatcher.kt: (48, 13): 'createTempDir(String = ..., String? = ..., File? = ...): File' is deprecated. Avoid creating temporary directories in the default temp location with this function due to too wide permissions on the newly created directory. Use kotlin.io.path.createTempDirectory instead.
|
||||
w: /home/matias/SlowProjects/godot-swappy/build/gamesdk/buildSrc/src/main/java/com/google/androidgamesdk/BuildInfoFile.kt: (52, 9): Parameter 'nativeLibraries' is never used
|
||||
|
||||
> Task :buildSrc:jar
|
||||
:jar: No valid plugin descriptors were found in META-INF/gradle-plugins
|
||||
|
||||
> Task :buildSrc:compileTestKotlin
|
||||
'compileTestJava' task (current target is 17) and 'compileTestKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
|
||||
|
||||
FAILURE: Build failed with an exception.
|
||||
```
|
||||
|
||||
This could get you completely side-tracked, because if you keep reading, it will tell you the following:
|
||||
|
||||
```
|
||||
* What went wrong:
|
||||
Could not determine the dependencies of task ':games-frame-pacing:verifyReleaseResources'.
|
||||
> Failed to find target with hash string 'android-31' in: /home/matias/Android/Sdk
|
||||
|
||||
* Try:
|
||||
> Run with --stacktrace option to get the stack trace.
|
||||
> Run with --info or --debug option to get more log output.
|
||||
> Run with --scan to get full insights.
|
||||
|
||||
* Get more help at https://help.gradle.org
|
||||
|
||||
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
|
||||
```
|
||||
|
||||
AHA! **Failed to find target with hash string 'android-31' in: /home/matias/Android/Sdk**. This is the root of the problem.
|
||||
|
||||
In rare cases, the root of the problem may be the first problem to appear, instead of the last one; and in that case you may have to scroll quite a bit.
|
||||
|
||||
For example if you force it to build with a newer NDK version than the recommended one, you will get errors C++ about function redeclarations with a different function signature, but at the bottom you will see Java errors that mislead you.
|
||||
28
build.bash
Executable file
28
build.bash
Executable file
@@ -0,0 +1,28 @@
|
||||
#! /bin/bash
|
||||
|
||||
SPECIFIC_REVISION="1198bb06b041e2df5d42cc5cf18fac81fcefa03f"
|
||||
|
||||
if [ -z "$ANDROID_HOME" ]; then
|
||||
echo "You must set ANDROID_HOME environment variable. See README."
|
||||
fi
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
echo "You must set JAVA_HOME environment variable. See README."
|
||||
fi
|
||||
|
||||
mkdir -p build
|
||||
|
||||
pushd build
|
||||
|
||||
echo "Setting up Repo"
|
||||
repo init -u https://android.googlesource.com/platform/manifest -b android-games-sdk || exit $?
|
||||
repo sync -c -j8 gamesdk || exit $?
|
||||
repo sync -c -j8 external/modp_b64 external/googletest external/nanopb-c external/protobuf external/StatsD tools/repohooks || exit $?
|
||||
repo sync -c -j8 prebuilts/cmake/linux-x86 prebuilts/cmake/windows-x86 prebuilts/cmake/darwin-x86 || exit $?
|
||||
|
||||
echo "Checking out the specific revision."
|
||||
cd gamesdk
|
||||
git checkout ${SPECIFIC_REVISION} || exit $?
|
||||
cp ../../local.properties local.properties || exit $?
|
||||
./gradlew packageLocalZip -Plibraries=swappy -PpackageName=local || exit $?
|
||||
|
||||
popd
|
||||
11
local.properties
Normal file
11
local.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
export ANDROID_HOME=/home/matias/Android/Sdk
|
||||
export JAVA_HOME=/home/matias/apps/android-studio/jbr
|
||||
|
||||
> org.gradle.api.InvalidUserDataException: NDK not configured. Download it with SDK manager. Preferred NDK version is '21.4.7075529'.
|
||||
|
||||
git checkout 1198bb06b041e2df5d42cc5cf18fac81fcefa03f || exit $?
|
||||
|
||||
|
||||
|
||||
sdk.dir=/home/matias/Android/Sdk
|
||||
cmake.dir=/home/matias/Android/Sdk/cmake/3.22.1
|
||||
Reference in New Issue
Block a user