-
Notifications
You must be signed in to change notification settings - Fork 5
Simplified Build Instructions for Linux #3
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
Open
realThirdpartycookie
wants to merge
2
commits into
StereoKit:main
Choose a base branch
from
realThirdpartycookie:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #!/bin/bash | ||
| # build_android_apk.sh: Configure and build or run the Android APK for StereoKit | ||
|
|
||
| set -e | ||
|
|
||
| # Prevent running with sudo/root so the SDK paths and adb device access use the user account | ||
| if [ "$(id -u)" -eq 0 ]; then | ||
| if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then | ||
| echo "This script should not be run with sudo. Re-running as $SUDO_USER..." | ||
| exec sudo -u "$SUDO_USER" -H bash "$0" "$@" | ||
| else | ||
| echo "Please run this script without sudo." >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| export ANDROID_HOME="$HOME/Android/Sdk" | ||
| export ANDROID_SDK_ROOT="$ANDROID_HOME" | ||
| export PATH="$ANDROID_HOME/platform-tools:$PATH" | ||
|
|
||
| export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/25.2.9519653" | ||
| export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" | ||
| export PATH="$JAVA_HOME/bin:$PATH" | ||
|
|
||
| echo "Configuring Android build..." | ||
| cmake -B build-android \ | ||
| -G Ninja \ | ||
| -DCMAKE_ANDROID_NDK="$ANDROID_NDK_HOME" \ | ||
| -DCMAKE_SYSTEM_NAME=Android \ | ||
| -DCMAKE_SYSTEM_VERSION=32 \ | ||
| -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \ | ||
| -DJAVAC="$JAVA_HOME/bin/javac" \ | ||
| -DJava_JAVAC_EXECUTABLE="$JAVA_HOME/bin/javac" | ||
|
|
||
| echo "Choose build option:" | ||
| select opt in "Build and run APK on device" "Build APK only"; do | ||
| case $REPLY in | ||
| 1) | ||
| cmake --build build-android -j8 --target run | ||
| break | ||
| ;; | ||
| 2) | ||
| cmake --build build-android -j8 --target apk | ||
| break | ||
| ;; | ||
| *) | ||
| echo "Invalid option. Please select 1 or 2." | ||
| ;; | ||
| esac | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/bin/bash | ||
| # install_android-deps.sh: Install all dependencies for Android build on Linux | ||
|
|
||
| set -e | ||
|
|
||
| # Prevent running the whole script with sudo/root. | ||
| # We still use sudo for apt installs below, but the SDK should be under the user home, not /root. | ||
| if [ "$(id -u)" -eq 0 ]; then | ||
| if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then | ||
| echo "This script should not be run with sudo. Re-running as $SUDO_USER..." | ||
| exec sudo -u "$SUDO_USER" -H bash "$0" "$@" | ||
| else | ||
| echo "Please run this script without sudo (it will use sudo only where needed)." >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| sudo apt update | ||
| sudo apt install -y cmake libx11-dev libxfixes-dev libegl-dev libgbm-dev libfontconfig-dev unzip curl zip ninja-build openjdk-8-jdk adb google-android-cmdline-tools-13.0-installer | ||
|
|
||
| export ANDROID_HOME="$HOME/Android/Sdk" | ||
|
|
||
| sdkmanager --sdk_root=$ANDROID_HOME \ | ||
| "platform-tools" \ | ||
| "platforms;android-32" \ | ||
| "build-tools;32.0.0" \ | ||
| "ndk;25.2.9519653" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.