mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-21 09:31:33 -08:00
199 lines
5.7 KiB
Groovy
199 lines
5.7 KiB
Groovy
buildscript {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:8.6.1'
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
task "generatePngs"() {
|
|
group = 'Custom'
|
|
|
|
mkdir layout.buildDirectory.dir('generated_resources')
|
|
["mipmap-mdpi", "mipmap-hdpi", "mipmap-xhdpi", "mipmap-xxhdpi", "mipmap-xxxhdpi", ].each {
|
|
mkdir layout.buildDirectory.dir("generated_resources/${it}")
|
|
}
|
|
|
|
exec {
|
|
executable = 'rsvg-convert'
|
|
args = [ "wivrn.svg", "-w", "48", "-h", "48", "-o", layout.buildDirectory.file('generated_resources/mipmap-mdpi/ic_wivrn_launcher.png').get().asFile ]
|
|
workingDir 'images'
|
|
}
|
|
|
|
exec {
|
|
executable = 'rsvg-convert'
|
|
args = [ "wivrn.svg", "-w", "72", "-h", "72", "-o", layout.buildDirectory.file('generated_resources/mipmap-hdpi/ic_wivrn_launcher.png').get().asFile ]
|
|
workingDir 'images'
|
|
}
|
|
|
|
exec {
|
|
executable = 'rsvg-convert'
|
|
args = [ "wivrn.svg", "-w", "96", "-h", "96", "-o", layout.buildDirectory.file('generated_resources/mipmap-xhdpi/ic_wivrn_launcher.png').get().asFile ]
|
|
workingDir 'images'
|
|
}
|
|
|
|
exec {
|
|
executable = 'rsvg-convert'
|
|
args = [ "wivrn.svg", "-w", "144", "-h", "144", "-o", layout.buildDirectory.file('generated_resources/mipmap-xxhdpi/ic_wivrn_launcher.png').get().asFile ]
|
|
workingDir 'images'
|
|
}
|
|
|
|
exec {
|
|
executable = 'rsvg-convert'
|
|
args = [ "wivrn.svg", "-w", "192", "-h", "192", "-o", layout.buildDirectory.file('generated_resources/mipmap-xxxhdpi/ic_wivrn_launcher.png').get().asFile ]
|
|
workingDir 'images'
|
|
}
|
|
}
|
|
|
|
android {
|
|
namespace "org.meumeu.wivrn"
|
|
ndkVersion "27.1.12297006"
|
|
|
|
lint {
|
|
disable += "ExpiredTargetSdkVersion"
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId "org.meumeu.wivrn"
|
|
// for Vulkan, need at least 24
|
|
// for AImage_getHardwareBuffer, API 26
|
|
minSdkVersion 29
|
|
compileSdkVersion 32
|
|
targetSdkVersion 32 // for Oculus Store
|
|
|
|
versionName = project.hasProperty('wivrn_version') ? wivrn_version : "1.0"
|
|
versionCode = project.hasProperty('wivrn_versionCode') ? wivrn_versionCode.toInteger() : 1
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments '-DANDROID_TOOLCHAIN=clang',
|
|
'-DANDROID_STL=c++_static',
|
|
'-DCMAKE_ANDROID_NDK_VERSION=' + ndkVersion,
|
|
'-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON',
|
|
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
|
|
'-DWIVRN_USE_SYSTEM_FREETYPE=OFF',
|
|
'-DWIVRN_BUILD_CLIENT=ON',
|
|
'-DWIVRN_BUILD_SERVER=OFF',
|
|
'-DWIVRN_WERROR=ON'
|
|
resValue "string", "app_name", "WiVRn"
|
|
}
|
|
}
|
|
}
|
|
|
|
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"
|
|
}
|
|
|
|
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
|
|
manifestPlaceholders.ComOculusSupportedDevices = "quest2|quest3|questpro"
|
|
}
|
|
|
|
debug {
|
|
manifestPlaceholders.ComOculusSupportedDevices = "all"
|
|
}
|
|
|
|
debugWithValidationLayer {
|
|
initWith debug
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments '-DUSE_ANDROID_VALIDATION_LAYER=ON'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
flavorDimensions "device"
|
|
|
|
productFlavors {
|
|
standard {
|
|
dimension "device"
|
|
externalNativeBuild {
|
|
cmake {
|
|
abiFilters 'arm64-v8a'//, 'x86_64'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['client/java']
|
|
res.srcDirs = [ 'resources', layout.buildDirectory.dir('generated_resources') ]
|
|
|
|
assets.srcDirs 'assets'
|
|
}
|
|
}
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
version '3.30.3'
|
|
path 'CMakeLists.txt'
|
|
}
|
|
}
|
|
|
|
applicationVariants.all { variant ->
|
|
tasks["assemble${variant.name.capitalize()}"].finalizedBy "generatePngs"
|
|
tasks["assemble${variant.name.capitalize()}"].dependsOn "externalNativeBuild${variant.name.capitalize()}"
|
|
}
|
|
|
|
productFlavors.all { variant ->
|
|
sourceSets {
|
|
"${variant.name}" {
|
|
assets.srcDirs layout.buildDirectory.dir("assets${variant.name.capitalize()}")
|
|
}
|
|
}
|
|
|
|
externalNativeBuild{
|
|
cmake {
|
|
arguments '-DCMAKE_ANDROID_ASSETS_DIRECTORIES=' + layout.buildDirectory.dir("assets${variant.name.capitalize()}").get().asFile
|
|
}
|
|
}
|
|
}
|
|
}
|