forked from google/bigwheels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
160 lines (143 loc) · 5.64 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
layout.buildDirectory = layout.projectDirectory.dir("build_android")
subprojects {
repositories {
mavenCentral()
google()
}
apply plugin: "com.android.application"
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}
project.layout.buildDirectory = rootProject.layout.buildDirectory.dir(project.name)
ext {
assets = []
thirdPartyAssets = []
}
// copyTask copies project specific assets into a build asset folder,
// so they can be packaged into the APK.
task copyTask {
// doLast to make sure we get subproject assets value, and
// execute in execution phase.
doLast {
project.assets.each {
def fromFile = "${rootProject.projectDir}/assets/${it}"
def intoFile = layout.buildDirectory.dir("assets/${it}")
copy {
from fromFile
into intoFile
}
}
// Copy the rest of the assets - generated shaders.
project.assets.each {
def fromFile = "${rootProject.projectDir}/build_android/assets/${it}"
def intoFile = layout.buildDirectory.dir("assets/${it}")
copy {
from fromFile
into intoFile
}
}
project.thirdPartyAssets.each {
def fromFile = "${rootProject.projectDir}/third_party/assets/${it}"
def intoFile = layout.buildDirectory.dir("assets/${it}")
copy {
from fromFile
into intoFile
}
}
}
}
android {
namespace 'com.google.bigwheels'
compileSdk 32
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
prefab true
}
externalNativeBuild {
cmake {
path file("${rootProject.projectDir}/CMakeLists.txt")
version '3.22.1+'
buildStagingDirectory "${rootProject.projectDir}/.cxx/${project.name}"
}
}
buildTypes {
release {
minifyEnabled false
}
debug {
applicationIdSuffix '.debug'
debuggable true
}
}
defaultConfig {
applicationId "com.google.bigwheels.project_${project.name}"
minSdk 29
targetSdk 32
versionCode 1
versionName "1.0"
manifestPlaceholders = [
sampleLibraryName : "vk_${project.name}",
appLabel : "vk_${project.name}"
]
ndk.abiFilters = ['arm64-v8a']
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
if (project.name.contains("_xr") || project.name.contains("graphics_pipeline")) {
arguments '-DPPX_ANDROID=TRUE',
'-DPPX_BUILD_TESTS=FALSE',
'-DBUILD_TESTS=FALSE', // Required for OpenXR
'-DPPX_BUILD_XR=TRUE',
'-DBUILD_LOADER=TRUE',
'-DBUILD_ALL_EXTENSIONS=TRUE'
}
else {
arguments '-DPPX_ANDROID=TRUE',
'-DPPX_BUILD_TESTS=FALSE'
}
if (project.name.contains("_xr") || project.name.contains("graphics_pipeline")) {
cppFlags '-std=c++17',
'-DXR_USE_PLATFORM_ANDROID'
}
else {
cppFlags '-std=c++17'
}
if (project.hasProperty('DXC_PATH')) {
arguments "-DDXC_PATH=$DXC_PATH"
}
targets "vk_${project.name}"
}
}
multiDexEnabled true
it.buildConfigField "String", "sample_library_name", '"vk_' + project.name + '"'
sourceSets.main {
java.srcDirs = [ "${rootProject.projectDir}/src/android" ]
if (project.name.contains("_xr") || project.name.contains("graphics_pipeline")) {
manifest.srcFile "${rootProject.projectDir}/src/android/AndroidManifest.XR.xml"
} else {
manifest.srcFile "${rootProject.projectDir}/src/android/AndroidManifest.xml"
}
}
}
sourceSets.main.assets.srcDirs += layout.buildDirectory.dir("assets")
applicationVariants.all { variant ->
// copyTask copies generated shaders, so it must be run after
// they are built. mustRunAfter only makes sure copyTask executes
// after the task if that task is already supposed to execute,
// but does not force it to be executed.
tasks["copyTask"].mustRunAfter("externalNativeBuild${variant.name.capitalize()}")
tasks["generate${variant.name.capitalize()}Assets"]
.dependsOn(copyTask)
}
}
}
tasks.register("clean", Delete) {
delete layout.buildDirectory
}