mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-12-05 16:22:38 -08:00
Build the APK without using gradle
This commit is contained in:
1 parent
abe0722ecc
commit
2877c32858
19 files changed
+404
-555
No files matched your search
@@ -10,7 +10,7 @@ env:
|
||||
jobs:
|
||||
build-android-only:
|
||||
name: Android
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-26.04
|
||||
if: ${{ vars.APK_ONLY != '' }}
|
||||
|
||||
strategy:
|
||||
@@ -25,20 +25,11 @@ jobs:
|
||||
ref: ${{ github.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
# Gradle distribution and the Android plugin's dependencies.
|
||||
- uses: actions/cache@v5
|
||||
with:
|
||||
key: gradle-android-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }}
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
restore-keys: gradle-android-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install glslang-tools spirv-tools librsvg2-bin gettext npm
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.4.0/KTX-Software-4.4.0-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.4.0-Linux-x86_64.deb
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.4.2/KTX-Software-4.4.2-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.4.2-Linux-x86_64.deb
|
||||
npm install --global @gltf-transform/[email protected]
|
||||
|
||||
- name: Check for Secret availability
|
||||
@@ -57,20 +48,32 @@ jobs:
|
||||
APK_SIGNINGKEYPASSWORD: ${{ secrets.APK_SIGNINGKEYPASSWORD }}
|
||||
APK_KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
echo signingKeyPassword="$APK_SIGNINGKEYPASSWORD" > gradle.properties
|
||||
echo "$APK_SIGNINGKEYPASSWORD" > signing_key_password
|
||||
echo "$APK_KEYSTORE_BASE64" | base64 --decode --ignore-garbage > ks.keystore
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew -Psuffix=".github.nightly" -Pwivrn_css=images/wivrn-nightly.css -Pwivrn_app_name="WiVRn Nightly" -Pwivrn_compress_glb=ON assemble${{ matrix.buildtype }}
|
||||
cmake --preset android-${{ matrix.buildtype }} -B build \
|
||||
-DCMAKE_ANDROID_NDK=$ANDROID_NDK_LATEST_HOME \
|
||||
-DWIVRN_APK_PACKAGE=org.meumeu.wivrn.github.nightly \
|
||||
-DWIVRN_CSS=images/wivrn-nightly.css \
|
||||
-DWIVRN_APK_NAME="WiVRn Nightly" \
|
||||
-DWIVRN_COMPRESS_GLB=ON \
|
||||
-DCPACK_APK_KEYSTORE=$(pwd)/ks.keystore \
|
||||
-DCPACK_APK_KEYSTORE_PASSWORD=$(cat signing_key_password) \
|
||||
-DCPACK_APK_KEY_ALIAS=default_key \
|
||||
-DCPACK_APK_KEY_PASSWORD=$(cat signing_key_password)
|
||||
|
||||
( cd build && ninja && cpack )
|
||||
|
||||
- name: Prepare before archiving artifacts
|
||||
run: |
|
||||
mkdir apk
|
||||
mv $(find build/outputs/apk/ -name "*.apk") apk/
|
||||
mv build/_CPack_Packages/Android/APK/wivrn.apk apk/WiVRn-APK-${{ matrix.buildtype }}.apk
|
||||
|
||||
mkdir debug
|
||||
mv build/intermediates/merged_native_libs/*/*/out/lib/* debug/
|
||||
mv build/_CPack_Packages/Android/APK/wivrn/lib/arm64-v8a/*.so debug/
|
||||
|
||||
find debug -name libopenxr_loader.so -delete
|
||||
|
||||
- name: Archive APK
|
||||
|
||||
+30
-31
@@ -273,7 +273,7 @@ jobs:
|
||||
|
||||
build-android:
|
||||
name: Android
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-26.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
|
||||
strategy:
|
||||
@@ -306,20 +306,11 @@ jobs:
|
||||
evict-old-files: job
|
||||
save: ${{ github.ref == 'refs/heads/master' }}
|
||||
|
||||
# Gradle distribution and the Android plugin's dependencies.
|
||||
- uses: actions/cache@v5
|
||||
with:
|
||||
key: gradle-android-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }}
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
restore-keys: gradle-android-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install glslang-tools spirv-tools librsvg2-bin gettext
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.3.2/KTX-Software-4.3.2-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.3.2-Linux-x86_64.deb
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.4.2/KTX-Software-4.4.2-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.4.2-Linux-x86_64.deb
|
||||
npm install --global @gltf-transform/cli
|
||||
|
||||
- name: Check for Secret availability
|
||||
@@ -343,7 +334,7 @@ jobs:
|
||||
APK_SIGNINGKEYPASSWORD: ${{ secrets.APK_SIGNINGKEYPASSWORD }}
|
||||
APK_KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
echo signingKeyPassword="$APK_SIGNINGKEYPASSWORD" > gradle.properties
|
||||
echo "$APK_SIGNINGKEYPASSWORD" > signing_key_password
|
||||
echo "$APK_KEYSTORE_BASE64" | base64 --decode --ignore-garbage > ks.keystore
|
||||
|
||||
- name: Build
|
||||
@@ -351,7 +342,6 @@ jobs:
|
||||
# Paths under the workspace are hashed relative to it
|
||||
CCACHE_BASEDIR: ${{github.workspace}}
|
||||
run: |
|
||||
VERSION=$(git describe --tags --always | sed "s/^v\([0-9]\)/\1/")
|
||||
if [ ${{ matrix.buildtype }} = 'Oculus' ]
|
||||
then
|
||||
SUFFIX=""
|
||||
@@ -362,6 +352,9 @@ jobs:
|
||||
fi
|
||||
|
||||
APPNAME=WiVRn
|
||||
|
||||
KS_OPTS="-DCPACK_APK_KEYSTORE=$(pwd)/ks.keystore -DCPACK_APK_KEYSTORE_PASSWORD=$(cat signing_key_password) -DCPACK_APK_KEY_ALIAS=default_key -DCPACK_APK_KEY_PASSWORD=$(cat signing_key_password)"
|
||||
|
||||
else
|
||||
VERSION_CODE=1
|
||||
|
||||
@@ -373,22 +366,26 @@ jobs:
|
||||
SUFFIX=".github.testing"
|
||||
APPNAME="WiVRn Testing"
|
||||
fi
|
||||
|
||||
KS_OPTS=""
|
||||
fi
|
||||
|
||||
echo Setting version $VERSION and version code $VERSION_CODE in manifest
|
||||
echo Setting version code $VERSION_CODE in manifest
|
||||
echo Using stylesheet ${{env.CSS}} and name $APPNAME
|
||||
|
||||
chmod +x gradlew
|
||||
./gradlew \
|
||||
-Pwivrn_version=$VERSION \
|
||||
-Pwivrn_versionCode=$VERSION_CODE \
|
||||
-Psuffix=$SUFFIX \
|
||||
-Pwivrn_css=${{env.CSS}} \
|
||||
-Pwivrn_app_name="$APPNAME" \
|
||||
-Pwivrn_compress_glb=ON \
|
||||
-Pfetchcontent_base_dir=${{github.workspace}}/cmake-fetch \
|
||||
-Pcompiler_launcher=ccache \
|
||||
assemble${{ matrix.buildtype }}
|
||||
cmake --preset android-${{ matrix.buildtype }} -B build \
|
||||
-DCMAKE_ANDROID_NDK=$ANDROID_NDK_LATEST_HOME \
|
||||
-DWIVRN_APK_VERSION_CODE=$VERSION_CODE \
|
||||
-DWIVRN_APK_PACKAGE=org.meumeu.wivrn$SUFFIX \
|
||||
-DWIVRN_CSS=${{env.CSS}} \
|
||||
-DWIVRN_APK_NAME="$APPNAME" \
|
||||
-DWIVRN_COMPRESS_GLB=ON \
|
||||
-DFETCHCONTENT_BASE_DIR=${{github.workspace}}/cmake-fetch \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
$KS_OPTS
|
||||
|
||||
( cd build && ninja && cpack )
|
||||
|
||||
- name: Upload build dir
|
||||
uses: actions/upload-artifact@v7
|
||||
@@ -402,14 +399,16 @@ jobs:
|
||||
- name: Prepare before archiving artifacts
|
||||
run: |
|
||||
mkdir apk
|
||||
mv $(find build/outputs/apk/ -name "*.apk") apk/
|
||||
mv build/_CPack_Packages/Android/APK/wivrn.apk apk/WiVRn-${{ matrix.buildtype }}.apk
|
||||
|
||||
mkdir debug
|
||||
mv build/intermediates/merged_native_libs/*/*/out/lib/* debug/
|
||||
mv build/_CPack_Packages/Android/APK/wivrn/lib/arm64-v8a/*.so debug/
|
||||
|
||||
find debug -name libopenxr_loader.so -delete
|
||||
|
||||
- name: Archive APK
|
||||
uses: actions/upload-artifact@v7
|
||||
if: ${{ matrix.buildtype != 'Oculus' }}
|
||||
if: ${{ matrix.buildtype != 'oculus' }}
|
||||
with:
|
||||
name: apk-${{ (steps.secret-check.outputs.available == 'false' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
|
||||
path: apk/*.apk
|
||||
@@ -456,8 +455,8 @@ jobs:
|
||||
apt update
|
||||
apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev libarchive-dev npm qml6-module-org-kde-kirigamiaddons-formcard
|
||||
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.3.2/KTX-Software-4.3.2-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.3.2-Linux-x86_64.deb
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.4.2/KTX-Software-4.4.2-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.4.2-Linux-x86_64.deb
|
||||
npm install --global @gltf-transform/cli
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
+3
-1
@@ -80,7 +80,9 @@
|
||||
android:hasCode="true"
|
||||
android:icon="@mipmap/ic_wivrn_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_wivrn_launcher">
|
||||
android:roundIcon="@mipmap/ic_wivrn_launcher"
|
||||
android:extractNativeLibs="${ExtractNativeLibs}"
|
||||
android:debuggable="${debuggable}">
|
||||
|
||||
<profileable android:shell="true" />
|
||||
|
||||
|
||||
+26
-2
@@ -1,4 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
|
||||
if(ANDROID)
|
||||
cmake_minimum_required(VERSION 4.5)
|
||||
|
||||
if (CMAKE_SYSTEM_VERSION LESS 29)
|
||||
message(FATAL_ERROR "Android API level must be at least 29" )
|
||||
endif()
|
||||
|
||||
if (CMAKE_ANDROID_NDK_VERSION VERSION_LESS 29.0.14206865)
|
||||
message(FATAL_ERROR "Android NDJK version must be at least 29.0.14206865" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
project(WiVRn VERSION 0.0.0 LANGUAGES C CXX)
|
||||
|
||||
# Workaround for boost CMake error
|
||||
@@ -17,6 +30,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
if(ANDROID)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/android)
|
||||
|
||||
# Used for subprojects (libktx) that assume they are called by gradle
|
||||
set(ANDROID_PLATFORM "android-${CMAKE_SYSTEM_VERSION}")
|
||||
set(ANDROID_ABI "${CMAKE_ANDROID_ARCH_ABI}")
|
||||
set(ANDROID_NDK "${CMAKE_ANDROID_NDK}")
|
||||
endif()
|
||||
|
||||
# Default to PIC code
|
||||
@@ -104,6 +122,12 @@ option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang on
|
||||
|
||||
set(WIVRN_ENVIRONMENTS_URL "https://github.com/WiVRn/WiVRn-environments/releases/latest/download/index.json" CACHE STRING "URL hosting the custom environments json file")
|
||||
|
||||
set(WIVRN_APK_VERSION_CODE 1 CACHE STRING "APK version code (must be an integer)")
|
||||
set(WIVRN_APK_NAME "WiVRn Local" CACHE STRING "APK package name, displayed to the user")
|
||||
set(WIVRN_APK_PACKAGE "org.meumeu.wivrn.local" CACHE STRING "APK package ID")
|
||||
option(WIVRN_APK_DEBUGGABLE "Whether the APK is debuggable" ON)
|
||||
set(WIVRN_APK_SUPPORTED_DEVICES "all" CACHE STRING "List of supported devices for the Meta store")
|
||||
|
||||
if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_SERVER OR WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_DISSECTOR)
|
||||
set(NEED_COMMON TRUE)
|
||||
else()
|
||||
@@ -226,8 +250,8 @@ if (WIVRN_BUILD_CLIENT AND NOT ANDROID)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
set(ANDROID_NDK $ENV{ANDROID_NDK_ROOT})
|
||||
set(CMAKE_ANDROID_NDK $ENV{ANDROID_NDK_ROOT})
|
||||
# AndroidNdkModules uses ANDROID_NDK instead of CMAKE_ANDROID_NDK
|
||||
set(ANDROID_NDK ${CMAKE_ANDROID_NDK})
|
||||
include(AndroidNdkModules)
|
||||
android_ndk_import_module_native_app_glue()
|
||||
endif()
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
|
||||
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "ON",
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"FETCHCONTENT_BASE_DIR": "${sourceDir}/build-deps",
|
||||
"WIVRN_BUILD_CLIENT": "OFF",
|
||||
"WIVRN_BUILD_SERVER": "OFF",
|
||||
"WIVRN_BUILD_SERVER_LIBRARY": "OFF",
|
||||
@@ -30,6 +31,37 @@
|
||||
"WIVRN_WERROR": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "android-base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_SYSTEM_NAME": "Android",
|
||||
"CMAKE_SYSTEM_VERSION": "29",
|
||||
"CMAKE_ANDROID_NDK_VERSION": "29.0.14206865",
|
||||
"CMAKE_ANDROID_ARCH_ABI": "arm64-v8a",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
|
||||
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "ON",
|
||||
"FETCHCONTENT_BASE_DIR": "${sourceDir}/build-deps-android",
|
||||
"WIVRN_BUILD_CLIENT": "ON",
|
||||
"WIVRN_BUILD_DASHBOARD": "OFF",
|
||||
"WIVRN_BUILD_SERVER": "OFF",
|
||||
"WIVRN_BUILD_SERVER_LIBRARY": "OFF",
|
||||
"WIVRN_BUILD_WIVRNCTL": "OFF",
|
||||
"WIVRN_USE_ANDROID_BIN_LIBKTX": "ON",
|
||||
"WIVRN_USE_SYSTEM_BOOST": "OFF",
|
||||
"WIVRN_USE_SYSTEM_FREETYPE": "OFF",
|
||||
"WIVRN_WERROR": "ON",
|
||||
"WIVRN_SHOW_IMGUI_DEMO_WINDOW": "OFF",
|
||||
"WIVRN_CLIENT_DEBUG_MENU": "OFF",
|
||||
"WIVRN_COMPRESS_GLB": "OFF",
|
||||
"WIVRN_ADDRESS_SANITIZER": "OFF",
|
||||
"WIVRN_CSS": "images/wivrn-local.css",
|
||||
"WIVRN_APK_VERSION_CODE": "1",
|
||||
"WIVRN_APK_NAME": "WiVRn Local",
|
||||
"WIVRN_APK_PACKAGE": "org.meumeu.wivrn.local"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "everything",
|
||||
"displayName": "Everything",
|
||||
@@ -179,6 +211,75 @@
|
||||
"WIVRN_COMPRESS_GLB": "ON",
|
||||
"WIVRN_WERROR": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "android-Debug",
|
||||
"displayName": "Android (debug)",
|
||||
"inherits": "android-base",
|
||||
"binaryDir": "${sourceDir}/build-android-Debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "android-DebugWithValidationLayer",
|
||||
"displayName": "Android (debug with Vulkan validation layer)",
|
||||
"inherits": "android-Debug",
|
||||
"binaryDir": "${sourceDir}/build-android-DebugWithValidationLayer",
|
||||
"cacheVariables": {
|
||||
"WIVRN_USE_ANDROID_VALIDATION_LAYER": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "android-DebugAsan",
|
||||
"displayName": "Android (debug with Address Sanitizer)",
|
||||
"inherits": "android-Debug",
|
||||
"binaryDir": "${sourceDir}/build-android-DebugAsan",
|
||||
"cacheVariables": {
|
||||
"WIVRN_ADDRESS_SANITIZER": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "android-DebugKtx",
|
||||
"displayName": "Android (debug, compile libktx from source)",
|
||||
"inherits": "android-Debug",
|
||||
"binaryDir": "${sourceDir}/build-android-DebugKtx",
|
||||
"cacheVariables": {
|
||||
"WIVRN_USE_ANDROID_BIN_LIBKTX": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "android-Release",
|
||||
"displayName": "Android (release)",
|
||||
"inherits": "android-base",
|
||||
"binaryDir": "${sourceDir}/build-android-Release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||
"WIVRN_APK_DEBUGGABLE": "OFF",
|
||||
"WIVRN_CSS": "images/wivrn-nightly.css"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "android-ReleaseDebuggable",
|
||||
"displayName": "Android (release, debuggable)",
|
||||
"inherits": "android-Release",
|
||||
"binaryDir": "${sourceDir}/build-android-ReleaseDebuggable",
|
||||
"cacheVariables": {
|
||||
"WIVRN_APK_DEBUGGABLE": "ON",
|
||||
"WIVRN_APK_NAME": "WiVRn Nightly",
|
||||
"WIVRN_APK_PACKAGE": "org.meumeu.wivrn.nightly"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "android-Oculus",
|
||||
"displayName": "Android (Meta Store)",
|
||||
"inherits": "android-Release",
|
||||
"binaryDir": "${sourceDir}/build-android-Oculus",
|
||||
"cacheVariables": {
|
||||
"WIVRN_APK_NAME": "WiVRn",
|
||||
"WIVRN_APK_PACKAGE": "org.meumeu.wivrn",
|
||||
"WIVRN_APK_SUPPORTED_DEVICES": "quest2|quest3|questpro"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
|
||||
-263
@@ -1,263 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.13.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
|
||||
import javax.inject.Inject
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.process.ExecOperations
|
||||
|
||||
abstract class GeneratePngsTask extends DefaultTask {
|
||||
@Inject
|
||||
abstract ExecOperations getExecOps()
|
||||
|
||||
@InputFile
|
||||
abstract RegularFileProperty getSvg()
|
||||
|
||||
@InputFile
|
||||
@Optional
|
||||
abstract RegularFileProperty getCss()
|
||||
|
||||
@OutputDirectory
|
||||
abstract DirectoryProperty getOutputDir()
|
||||
|
||||
@TaskAction
|
||||
void generate() {
|
||||
def outDir = getOutputDir().get().asFile
|
||||
outDir.mkdirs()
|
||||
|
||||
// Map of density → size
|
||||
def dpiConfigs = [
|
||||
"mipmap-mdpi" : 48,
|
||||
"mipmap-hdpi" : 72,
|
||||
"mipmap-xhdpi" : 96,
|
||||
"mipmap-xxhdpi" : 144,
|
||||
"mipmap-xxxhdpi": 192
|
||||
]
|
||||
|
||||
def cssFile = getCss().isPresent() ? getCss().get().asFile : null
|
||||
|
||||
dpiConfigs.each { dpi, size ->
|
||||
def dpiDir = new File(outDir, dpi)
|
||||
dpiDir.mkdirs()
|
||||
|
||||
def outputFile = new File(dpiDir, "ic_wivrn_launcher.png")
|
||||
|
||||
def argsList = [
|
||||
getSvg().get().asFile.absolutePath,
|
||||
"-w", size.toString(),
|
||||
"-h", size.toString(),
|
||||
"-o", outputFile.absolutePath
|
||||
]
|
||||
if (cssFile != null) {
|
||||
argsList.add("--stylesheet=${cssFile.absolutePath}")
|
||||
}
|
||||
|
||||
execOps.exec {
|
||||
executable = "rsvg-convert"
|
||||
args = argsList
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("generatePngs", GeneratePngsTask) {
|
||||
group = "Custom"
|
||||
|
||||
// configure defaults
|
||||
svg.set(layout.projectDirectory.file("images/wivrn.svg"))
|
||||
outputDir.set(layout.buildDirectory.dir("generated_resources"))
|
||||
|
||||
if (project.hasProperty("wivrn_css")) {
|
||||
css.set(layout.projectDirectory.file(project.wivrn_css))
|
||||
} else {
|
||||
css.set(layout.projectDirectory.file("images/wivrn-local.css"))
|
||||
}
|
||||
}
|
||||
|
||||
def use_asan = project.hasProperty('wivrn_address_sanitizer') && wivrn_address_sanitizer == 'ON'
|
||||
|
||||
android {
|
||||
namespace = "org.meumeu.wivrn"
|
||||
ndkVersion = "29.0.14206865"
|
||||
|
||||
lint {
|
||||
disable += "ExpiredTargetSdkVersion"
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.meumeu.wivrn"
|
||||
// for Vulkan, need at least 24
|
||||
// for AImage_getHardwareBuffer, API 26
|
||||
minSdkVersion 29
|
||||
compileSdkVersion 34
|
||||
targetSdkVersion 32 // for Oculus Store
|
||||
|
||||
versionName = project.hasProperty('wivrn_version') ? wivrn_version : "1.0"
|
||||
versionCode = project.hasProperty('wivrn_versionCode') ? wivrn_versionCode.toInteger() : 1
|
||||
def showImguiDemo = project.hasProperty('wivrn_show_imgui_demo') ? wivrn_show_imgui_demo : 'OFF'
|
||||
def showDebugMenu = project.hasProperty('wivrn_show_debug_menu') ? wivrn_show_debug_menu : 'OFF'
|
||||
def compressGlb = project.hasProperty('wivrn_compress_glb') ? wivrn_compress_glb : 'OFF'
|
||||
def fetchcontentBaseDir = project.hasProperty('fetchcontent_base_dir') ? ['-DFETCHCONTENT_BASE_DIR=' + fetchcontent_base_dir] : []
|
||||
|
||||
def compilerLauncher = project.hasProperty('compiler_launcher') ? ['-DCMAKE_C_COMPILER_LAUNCHER=' + compiler_launcher, '-DCMAKE_CXX_COMPILER_LAUNCHER=' + compiler_launcher] : []
|
||||
|
||||
def asan = use_asan ? 'ON': 'OFF'
|
||||
def stl = use_asan ? 'c++_shared' : "c++_static"
|
||||
|
||||
externalNativeBuild {
|
||||
def css = project.hasProperty('wivrn_css') ? project.wivrn_css: "images/wivrn-local.css"
|
||||
|
||||
cmake {
|
||||
arguments = ['-DANDROID_TOOLCHAIN=clang',
|
||||
'-DANDROID_STL=' + stl,
|
||||
'-DCMAKE_ANDROID_NDK_VERSION=' + ndkVersion,
|
||||
'-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON',
|
||||
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
|
||||
'-DCMAKE_ANDROID_ASSETS_DIRECTORIES=' + layout.buildDirectory.dir("assets").get().asFile,
|
||||
'-DRESOURCES_DIRECTORIES=' + layout.buildDirectory.dir("resources").get().asFile,
|
||||
'-DWIVRN_USE_SYSTEM_BOOST=OFF',
|
||||
'-DWIVRN_USE_SYSTEM_FREETYPE=OFF',
|
||||
'-DWIVRN_USE_ANDROID_BIN_LIBKTX=ON',
|
||||
'-DWIVRN_BUILD_CLIENT=ON',
|
||||
'-DWIVRN_BUILD_SERVER=OFF',
|
||||
'-DWIVRN_BUILD_SERVER_LIBRARY=OFF',
|
||||
'-DWIVRN_BUILD_WIVRNCTL=OFF',
|
||||
'-DWIVRN_BUILD_DASHBOARD=OFF',
|
||||
'-DWIVRN_WERROR=ON',
|
||||
'-DWIVRN_SHOW_IMGUI_DEMO_WINDOW=' + showImguiDemo,
|
||||
'-DWIVRN_CLIENT_DEBUG_MENU=' + showDebugMenu,
|
||||
'-DWIVRN_CSS=' + css,
|
||||
'-DWIVRN_COMPRESS_GLB=' + compressGlb,
|
||||
'-DWIVRN_ADDRESS_SANITIZER=' + asan,
|
||||
] +
|
||||
fetchcontentBaseDir +
|
||||
compilerLauncher
|
||||
resValue "string", "app_name", project.hasProperty('wivrn_app_name') ? project.wivrn_app_name : "WiVRn Local"
|
||||
abiFilters 'arm64-v8a'//, 'x86_64'
|
||||
}
|
||||
|
||||
}
|
||||
packaging {
|
||||
jniLibs {
|
||||
useLegacyPackaging = use_asan
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (project.hasProperty("signingKeyPassword")) {
|
||||
release {
|
||||
storeFile file("ks.keystore")
|
||||
keyAlias "default_key"
|
||||
storePassword signingKeyPassword // Set in gradle.properties
|
||||
keyPassword signingKeyPassword
|
||||
enableV2Signing = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
if (project.hasProperty("signingKeyPassword")) {
|
||||
release {
|
||||
signingConfig = signingConfigs.release
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
manifestPlaceholders.ComOculusSupportedDevices = "all"
|
||||
applicationIdSuffix = project.hasProperty('suffix') ? suffix: ".local"
|
||||
}
|
||||
|
||||
releaseDebuggable {
|
||||
initWith release
|
||||
debuggable true
|
||||
|
||||
// Uncomment to have debug symbols
|
||||
// packagingOptions {
|
||||
// doNotStrip "*/arm64-v8a/*.so"
|
||||
// doNotStrip "*/armeabi-v7a/*.so"
|
||||
// doNotStrip "*/x86/*.so"
|
||||
// doNotStrip "*/x86_64/*.so"
|
||||
// }
|
||||
}
|
||||
|
||||
oculus
|
||||
{
|
||||
initWith release
|
||||
applicationIdSuffix = project.hasProperty('suffix') ? suffix: ""
|
||||
manifestPlaceholders.ComOculusSupportedDevices = "quest2|quest3|questpro"
|
||||
}
|
||||
|
||||
debug {
|
||||
applicationIdSuffix = project.hasProperty('suffix') ? suffix: ".local"
|
||||
manifestPlaceholders.ComOculusSupportedDevices = "all"
|
||||
}
|
||||
|
||||
debugWithValidationLayer {
|
||||
initWith debug
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DWIVRN_USE_ANDROID_VALIDATION_LAYER=ON'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes.all { variant ->
|
||||
sourceSets {
|
||||
"${variant.name}" {
|
||||
jniLibs.srcDirs layout.buildDirectory.dir("libs${variant.name.capitalize()}")
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild{
|
||||
cmake {
|
||||
arguments '-DANDROID_LIB_DIRECTORIES=' + layout.buildDirectory.dir("libs${variant.name.capitalize()}").get().asFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['client/java']
|
||||
res.srcDirs = [ 'resources', layout.buildDirectory.dir('generated_resources') ]
|
||||
resources.srcDirs = [layout.buildDirectory.dir('resources')]
|
||||
|
||||
assets.srcDirs = ['assets', layout.buildDirectory.dir("assets")]
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version = '3.31.5'
|
||||
path 'CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
|
||||
tasks["preBuild"].dependsOn "generatePngs"
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
// It probably works with merge${variant.name.capitalize()}Assets too
|
||||
tasks["generate${variant.name.capitalize()}Assets"].dependsOn "externalNativeBuild${variant.name.capitalize()}"
|
||||
tasks["merge${variant.name.capitalize()}Resources"].dependsOn "externalNativeBuild${variant.name.capitalize()}"
|
||||
}
|
||||
}
|
||||
+109
-28
@@ -12,23 +12,38 @@ set(SPIRV_REFLECT_STATIC_LIB ON)
|
||||
set(SPIRV_REFLECT_INSTALL OFF)
|
||||
|
||||
FetchContent_MakeAvailable(simdjson spdlog glm fastgltf imgui stb implot uni-algo entt spirv-reflect)
|
||||
if(ANDROID AND WIVRN_USE_ANDROID_BIN_LIBKTX)
|
||||
if(NOT EXISTS ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip)
|
||||
file(DOWNLOAD
|
||||
https://github.com/KhronosGroup/KTX-Software/releases/download/${KTX_VERSION_FULL}/KTX-Software-${KTX_VERSION}-Android.zip
|
||||
${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip
|
||||
EXPECTED_HASH SHA256=9f84a395f37a185e2e21e77cfd3893e67271b616edf5feb39125f09ab4c06b29
|
||||
)
|
||||
|
||||
if(ANDROID)
|
||||
|
||||
if(WIVRN_USE_ANDROID_BIN_LIBKTX)
|
||||
if(NOT EXISTS ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip)
|
||||
file(DOWNLOAD
|
||||
https://github.com/KhronosGroup/KTX-Software/releases/download/${KTX_VERSION_FULL}/KTX-Software-${KTX_VERSION}-Android.zip
|
||||
${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip
|
||||
EXPECTED_HASH SHA256=9f84a395f37a185e2e21e77cfd3893e67271b616edf5feb39125f09ab4c06b29
|
||||
)
|
||||
endif()
|
||||
file(ARCHIVE_EXTRACT INPUT ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip DESTINATION ${FETCHCONTENT_BASE_DIR})
|
||||
add_library(ktx INTERFACE)
|
||||
target_link_libraries(ktx INTERFACE ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android/${CMAKE_ANDROID_ARCH_ABI}/lib/libktx.so)
|
||||
target_include_directories(ktx INTERFACE ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android/${CMAKE_ANDROID_ARCH_ABI}/include)
|
||||
|
||||
install(FILES ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android/${CMAKE_ANDROID_ARCH_ABI}/lib/libktx.so
|
||||
DESTINATION lib/${CMAKE_ANDROID_ARCH_ABI})
|
||||
else()
|
||||
FetchContent_MakeAvailable(libktx)
|
||||
# libktx is compiled as a static library, no need to install it
|
||||
endif()
|
||||
file(ARCHIVE_EXTRACT INPUT ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip DESTINATION ${FETCHCONTENT_BASE_DIR})
|
||||
add_library(ktx INTERFACE)
|
||||
target_link_libraries(ktx INTERFACE ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android/${ANDROID_ABI}/lib/libktx.so)
|
||||
target_include_directories(ktx INTERFACE ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android/${ANDROID_ABI}/include)
|
||||
elseif(WIVRN_USE_SYSTEM_LIBKTX AND NOT ANDROID)
|
||||
|
||||
else()
|
||||
FetchContent_MakeAvailable(libktx)
|
||||
|
||||
if(NOT WIVRN_USE_SYSTEM_LIBKTX)
|
||||
FetchContent_MakeAvailable(libktx)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
include(FreetypeHarfbuzz)
|
||||
include(CompileGLSL)
|
||||
include(GenerateAssets)
|
||||
@@ -38,7 +53,6 @@ add_library(stb INTERFACE)
|
||||
target_include_directories(stb INTERFACE ${stb_SOURCE_DIR})
|
||||
|
||||
if(ANDROID)
|
||||
file(REMOVE_RECURSE ${RESOURCES_DIRECTORIES}/lib ${ANDROID_LIB_DIRECTORIES})
|
||||
add_library(wivrn MODULE)
|
||||
|
||||
find_library(ANDROID_LIBRARY NAMES android REQUIRED)
|
||||
@@ -83,20 +97,24 @@ if(ANDROID)
|
||||
target_sources(wivrn PRIVATE ${PLATFORM_SOURCE})
|
||||
|
||||
if (WIVRN_ADDRESS_SANITIZER)
|
||||
file(MAKE_DIRECTORY
|
||||
${RESOURCES_DIRECTORIES}/lib/${CMAKE_ANDROID_ARCH_ABI}
|
||||
${ANDROID_LIB_DIRECTORIES}/${CMAKE_ANDROID_ARCH_ABI})
|
||||
file(GLOB _asan_location
|
||||
${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/*/lib/linux/libclang_rt.asan-${CMAKE_SYSTEM_PROCESSOR}-android.so
|
||||
${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/*/lib/linux/libclang_rt.asan-${CMAKE_SYSTEM_PROCESSOR}-android.so
|
||||
)
|
||||
file(COPY
|
||||
|
||||
install(FILES
|
||||
${_asan_location}
|
||||
DESTINATION ${ANDROID_LIB_DIRECTORIES}/${CMAKE_ANDROID_ARCH_ABI}
|
||||
DESTINATION lib/${CMAKE_ANDROID_ARCH_ABI}
|
||||
)
|
||||
file(COPY_FILE
|
||||
${ANDROID_NDK}/wrap.sh/asan.sh
|
||||
${RESOURCES_DIRECTORIES}/lib/${CMAKE_ANDROID_ARCH_ABI}/wrap.sh
|
||||
|
||||
install(FILES
|
||||
${CMAKE_ANDROID_NDK}/wrap.sh/asan.sh
|
||||
DESTINATION lib/${CMAKE_ANDROID_ARCH_ABI}
|
||||
RENAME wrap.sh
|
||||
)
|
||||
|
||||
set(CMAKE_ANDROID_STL_TYPE "c++_shared")
|
||||
else()
|
||||
set(CMAKE_ANDROID_STL_TYPE "c++_static")
|
||||
endif()
|
||||
else()
|
||||
add_executable(wivrn)
|
||||
@@ -249,9 +267,8 @@ if(WIVRN_USE_ANDROID_VALIDATION_LAYER)
|
||||
|
||||
file(ARCHIVE_EXTRACT INPUT ${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip DESTINATION ${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayer)
|
||||
|
||||
file(COPY
|
||||
${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayer/android-binaries-${VVL_VERSION}/${CMAKE_ANDROID_ARCH_ABI}
|
||||
DESTINATION ${ANDROID_LIB_DIRECTORIES})
|
||||
install(FILES ${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayer/android-binaries-${VVL_VERSION}/${CMAKE_ANDROID_ARCH_ABI}/libVkLayer_khronos_validation.so
|
||||
DESTINATION lib/${CMAKE_ANDROID_ARCH_ABI})
|
||||
endif()
|
||||
|
||||
|
||||
@@ -259,7 +276,10 @@ endif()
|
||||
# Assets
|
||||
#
|
||||
if(ANDROID)
|
||||
set(ASSETS_DIR ${CMAKE_ANDROID_ASSETS_DIRECTORIES})
|
||||
set(ASSETS_DIR ${CMAKE_CURRENT_BINARY_DIR}/assets)
|
||||
file(MAKE_DIRECTORY ${ASSETS_DIR})
|
||||
install(DIRECTORY "${ASSETS_DIR}/" DESTINATION assets)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../assets/" DESTINATION assets)
|
||||
else()
|
||||
set(ASSETS_DIR ${CMAKE_CURRENT_BINARY_DIR}/share/wivrn/assets)
|
||||
file(MAKE_DIRECTORY ${ASSETS_DIR})
|
||||
@@ -289,7 +309,7 @@ endif()
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Generate assets
|
||||
# Generate assets and Android resources
|
||||
#
|
||||
file(REAL_PATH ${WIVRN_CSS} WIVRN_CSS_ABS BASE_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
@@ -302,6 +322,14 @@ wivrn_rasterize_svg(SOURCE ${IMAGES_SRC_DIR}/wivrn-christmas.svg DESTINATION
|
||||
wivrn_rasterize_svg(SOURCE ${ASSETS_SRC_DIR}/passthrough.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/passthrough.png WIDTH 256 HEIGHT 256)
|
||||
wivrn_rasterize_svg(SOURCE ${ASSETS_SRC_DIR}/default-environment.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/default-environment.png WIDTH 256 HEIGHT 256)
|
||||
|
||||
if(ANDROID)
|
||||
wivrn_rasterize_svg(SOURCE ${IMAGES_SRC_DIR}/wivrn.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/res/mipmap-mdpi/ic_wivrn_launcher.png WIDTH 48 HEIGHT 48 CSS ${WIVRN_CSS_ABS} TARGET wivrn)
|
||||
wivrn_rasterize_svg(SOURCE ${IMAGES_SRC_DIR}/wivrn.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/res/mipmap-hdpi/ic_wivrn_launcher.png WIDTH 72 HEIGHT 72 CSS ${WIVRN_CSS_ABS} TARGET wivrn)
|
||||
wivrn_rasterize_svg(SOURCE ${IMAGES_SRC_DIR}/wivrn.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/res/mipmap-xhdpi/ic_wivrn_launcher.png WIDTH 96 HEIGHT 96 CSS ${WIVRN_CSS_ABS} TARGET wivrn)
|
||||
wivrn_rasterize_svg(SOURCE ${IMAGES_SRC_DIR}/wivrn.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/res/mipmap-xxhdpi/ic_wivrn_launcher.png WIDTH 144 HEIGHT 144 CSS ${WIVRN_CSS_ABS} TARGET wivrn)
|
||||
wivrn_rasterize_svg(SOURCE ${IMAGES_SRC_DIR}/wivrn.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/res/mipmap-xxxhdpi/ic_wivrn_launcher.png WIDTH 192 HEIGHT 192 CSS ${WIVRN_CSS_ABS} TARGET wivrn)
|
||||
endif()
|
||||
|
||||
wivrn_generate_ktx( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/wivrn.png DESTINATION ${ASSETS_DIR}/wivrn.ktx2 TARGET wivrn)
|
||||
wivrn_generate_ktx( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/wivrn-pride.png DESTINATION ${ASSETS_DIR}/wivrn-pride.ktx2 TARGET wivrn)
|
||||
wivrn_generate_ktx( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/wivrn-christmas.png DESTINATION ${ASSETS_DIR}/wivrn-christmas.ktx2 TARGET wivrn)
|
||||
@@ -361,3 +389,56 @@ if(NOT ANDROID)
|
||||
DESTINATION share/applications
|
||||
)
|
||||
endif()
|
||||
|
||||
##############################################################################
|
||||
# APK generation
|
||||
|
||||
if(ANDROID)
|
||||
set(WIVRN_APP_NAME ${WIVRN_APK_NAME})
|
||||
set(CPACK_APK_VERSION_CODE ${WIVRN_APK_VERSION_CODE})
|
||||
set(CPACK_APK_PACKAGE ${WIVRN_APK_PACKAGE})
|
||||
|
||||
set(CPACK_APK_MIN_SDK_VERSION 29)
|
||||
set(CPACK_APK_TARGET_SDK_VERSION 32)
|
||||
|
||||
if (WIVRN_ADDRESS_SANITIZER)
|
||||
# See https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs
|
||||
# Required for ASAN, see https://developer.android.com/ndk/guides/asan#running
|
||||
list(APPEND CPACK_APK_MANIFEST_PLACEHOLDERS ExtractNativeLibs=true)
|
||||
else()
|
||||
list(APPEND CPACK_APK_MANIFEST_PLACEHOLDERS ExtractNativeLibs=false)
|
||||
endif()
|
||||
|
||||
# Set android:debuggable, see https://developer.android.com/guide/topics/manifest/application-element#debug
|
||||
if (WIVRN_APK_DEBUGGABLE OR WIVRN_ADDRESS_SANITIZER)
|
||||
list(APPEND CPACK_APK_MANIFEST_PLACEHOLDERS debuggable=true)
|
||||
else()
|
||||
list(APPEND CPACK_APK_MANIFEST_PLACEHOLDERS debuggable=false)
|
||||
endif()
|
||||
|
||||
list(APPEND CPACK_APK_MANIFEST_PLACEHOLDERS ComOculusSupportedDevices=${WIVRN_APK_SUPPORTED_DEVICES})
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/CPackConfig.cmake.in CPackConfig.cmake @ONLY)
|
||||
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/CPackConfig.cmake)
|
||||
|
||||
configure_file(generated_resources.xml.in generated_resources.xml @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generated_resources.xml DESTINATION res/values)
|
||||
|
||||
install(TARGETS wivrn openxr_loader LIBRARY DESTINATION lib/${CMAKE_ANDROID_ARCH_ABI})
|
||||
|
||||
get_target_property(OpenSSL_Crypto_LOCATION OpenSSL::Crypto IMPORTED_LOCATION)
|
||||
get_target_property(OpenSSL_SSL_LOCATION OpenSSL::SSL IMPORTED_LOCATION)
|
||||
|
||||
install(FILES
|
||||
${OpenSSL_Crypto_LOCATION}
|
||||
${OpenSSL_SSL_LOCATION}
|
||||
DESTINATION lib/${CMAKE_ANDROID_ARCH_ABI})
|
||||
|
||||
install(FILES ../AndroidManifest.xml DESTINATION .)
|
||||
install(DIRECTORY ../resources/ DESTINATION res)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/res/ DESTINATION res)
|
||||
|
||||
set(CPACK_GENERATOR APK)
|
||||
set(CPACK_APK_JAVA_SOURCE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/java")
|
||||
include(CPack)
|
||||
endif()
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">@WIVRN_APP_NAME@</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,33 @@
|
||||
set(GIT_TAG "@GIT_TAG@")
|
||||
set(GIT_DESC "@GIT_DESC@")
|
||||
set(GIT_EXECUTABLE "@GIT_EXECUTABLE@")
|
||||
|
||||
|
||||
if (NOT (GIT_TAG OR GIT_DESC))
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --exact-match --tags
|
||||
OUTPUT_VARIABLE GIT_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if (GIT_TAG)
|
||||
string(REGEX REPLACE "^v" "" CPACK_APK_VERSION_NAME "${GIT_TAG}")
|
||||
else()
|
||||
|
||||
if (NOT GIT_DESC)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --tags --always
|
||||
OUTPUT_VARIABLE GIT_DESC
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "^v" "" CPACK_APK_VERSION_NAME "${GIT_DESC}")
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_VERSION ${CPACK_APK_VERSION_NAME})
|
||||
set(CPACK_PACKAGE_FILE_NAME "wivrn")
|
||||
+4
-2
@@ -12,7 +12,7 @@ function(CREATE_MO_FILES TARGET_NAME I18N_DOMAIN LOCALE_DIR)
|
||||
cmake_path(GET PO_DIR FILENAME LANG)
|
||||
|
||||
if(ANDROID)
|
||||
set(MO_DIR ${CMAKE_ANDROID_ASSETS_DIRECTORIES}/locale/${LANG}/LC_MESSAGES)
|
||||
set(MO_DIR ${CMAKE_CURRENT_BINARY_DIR}/assets/locale/${LANG}/LC_MESSAGES)
|
||||
else()
|
||||
set(MO_DIR ${CMAKE_CURRENT_BINARY_DIR}/share/locale/${LANG}/LC_MESSAGES)
|
||||
endif()
|
||||
@@ -26,7 +26,9 @@ function(CREATE_MO_FILES TARGET_NAME I18N_DOMAIN LOCALE_DIR)
|
||||
|
||||
set(MO_FILES ${MO_FILES} ${MO_FILE})
|
||||
|
||||
install(FILES ${MO_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/locale/${LANG}/LC_MESSAGES)
|
||||
if(NOT ANDROID)
|
||||
install(FILES ${MO_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/locale/${LANG}/LC_MESSAGES)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_target(${TARGET_NAME}-translations ALL DEPENDS ${MO_FILES})
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
# Copyright (c) 2014, Pavel Rojtberg
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
macro(android_ndk_import_module_cpufeatures)
|
||||
if(ANDROID)
|
||||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
||||
add_library(cpufeatures ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
||||
target_link_libraries(cpufeatures dl)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(android_ndk_import_module_native_app_glue)
|
||||
if(ANDROID)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
add_library(native_app_glue ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
target_link_libraries(native_app_glue log)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(android_ndk_import_module_ndk_helper)
|
||||
if(ANDROID)
|
||||
android_ndk_import_module_cpufeatures()
|
||||
android_ndk_import_module_native_app_glue()
|
||||
|
||||
include_directories(${ANDROID_NDK}/sources/android/ndk_helper)
|
||||
file(GLOB _NDK_HELPER_SRCS ${ANDROID_NDK}/sources/android/ndk_helper/*.cpp ${ANDROID_NDK}/sources/android/ndk_helper/gl3stub.c)
|
||||
add_library(ndk_helper ${_NDK_HELPER_SRCS})
|
||||
target_link_libraries(ndk_helper log android EGL GLESv2 cpufeatures native_app_glue)
|
||||
|
||||
unset(_NDK_HELPER_SRCS)
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -87,7 +87,7 @@ QCoro::Task<> apk_installer::doRefreshLatestVersion()
|
||||
{
|
||||
std::string name = i["name"];
|
||||
|
||||
if (name.ends_with("-release.apk"))
|
||||
if (name.ends_with("-Release.apk"))
|
||||
{
|
||||
m_apkUrl = QString::fromStdString(i["browser_download_url"]);
|
||||
break;
|
||||
|
||||
+11
-13
@@ -71,6 +71,8 @@ As Arch package names: git pkgconf glslang cmake jdk17-openjdk librsvg cli11 ktx
|
||||
|
||||
OpenSSL build dependencies are also needed, as described [here](https://github.com/openssl/openssl/blob/master/INSTALL.md#prerequisites), in particular perl 5.
|
||||
|
||||
CMake 4.5 is required.
|
||||
|
||||
#### Android environment
|
||||
Download [sdkmanager](https://developer.android.com/tools/sdkmanager) commandline tool and extract it to any directory.
|
||||
Create your `ANDROID_HOME` directory, for instance `~/Android`.
|
||||
@@ -80,32 +82,28 @@ Review and accept the licenses with
|
||||
sdkmanager --sdk_root="${HOME}/Android" --licenses
|
||||
```
|
||||
|
||||
Install the correct cmake version with
|
||||
```bash
|
||||
sdkmanager --install "cmake;3.31.5"
|
||||
```
|
||||
|
||||
#### Apk signing
|
||||
Your device may refuse to install an unsigned apk, so you must create signing keys before building the client
|
||||
```
|
||||
# Create key, then enter the password and other information that the tool asks for
|
||||
keytool -genkey -v -keystore ks.keystore -alias default_key -keyalg RSA -keysize 2048 -validity 10000
|
||||
|
||||
# Substitute your password that you entered in the command above instead of YOUR_PASSWORD
|
||||
echo signingKeyPassword="YOUR_PASSWORD" > gradle.properties
|
||||
```
|
||||
Once you have generated the keys, the apk will be automatically signed at build time
|
||||
|
||||
#### Client build
|
||||
From the main directory.
|
||||
```bash
|
||||
export ANDROID_HOME=~/Android
|
||||
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk/
|
||||
|
||||
./gradlew assembleRelease
|
||||
# Substitute your password that you entered in the keytool command above instead of YOUR_PASSWORD
|
||||
|
||||
cmake --preset android-Release -DCPACK_APK_KEYSTORE=ks.keystore -DCPACK_APK_KEYSTORE_PASSWORD="YOUR_PASSWORD" -DCPACK_APK_KEY_ALIAS=default_key -DCPACK_APK_KEY_PASSWORD="YOUR_PASSWORD"
|
||||
|
||||
cd build-android-Release
|
||||
ninja
|
||||
cpack
|
||||
```
|
||||
|
||||
Outputs will be in `build/outputs/apk/release/WiVRn-release.apk`
|
||||
Outputs will be in `build-android-Release/WiVRn.apk`
|
||||
|
||||
#### Install apk with adb
|
||||
Before using adb you must enable usb debugging on your device:
|
||||
@@ -123,7 +121,7 @@ adb start-server
|
||||
adb devices
|
||||
|
||||
# Install apk
|
||||
adb install build/outputs/apk/release/WiVRn-release.apk
|
||||
adb install build-android-Release/WiVRn.apk
|
||||
|
||||
# When you're done, you can stop the adb server
|
||||
adb kill-server
|
||||
|
||||
Vendored
BIN
Binary file not shown.
-2
@@ -1,2 +0,0 @@
|
||||
SPDX-FileCopyrightText: Copyright 2007-2014, 2017 the original author or authors.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,2 +0,0 @@
|
||||
SPDX-FileCopyrightText: Copyright 2010 the original author or authors.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
@@ -1,187 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
+4
-1
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
@@ -32,7 +33,9 @@ def get_lib_list(path):
|
||||
return libs
|
||||
|
||||
|
||||
libs = get_lib_list("build/intermediates/merged_native_libs")
|
||||
libs = {}
|
||||
for dir in glob.glob("build-android-*/_CPack_Packages/Android/APK/wivrn/lib"):
|
||||
libs = libs | get_lib_list(dir)
|
||||
|
||||
# stack trace
|
||||
r = re.compile("^.*#[0-9]+ pc ([0-9a-f]+) .*BuildId: ([0-9a-f]*).*")
|
||||
|
||||
Reference in new issue
Block a user