106 lines
3.0 KiB
Groovy
106 lines
3.0 KiB
Groovy
// This script accepts the following parameters:
|
|
//
|
|
// filament_dist_dir
|
|
// Path to the Filament distribution/install directory for Android
|
|
// (produced by make/ninja install). This directory must contain lib/arm64-v8a/ etc.
|
|
//
|
|
// filament_tools_dir
|
|
// Path to the Filament distribution/install directory for desktop.
|
|
// This directory must contain bin/matc.
|
|
//
|
|
// filament_supports_vulkan
|
|
// When set, support for Vulkan will be enabled.
|
|
//
|
|
// filament_skip_samples
|
|
// Exclude samples from the project. Useful to speed up compilation.
|
|
//
|
|
// Example:
|
|
// ./gradlew -Pfilament_dist_dir=../dist-android-release assembleRelease
|
|
|
|
buildscript {
|
|
def filamentPath = file("../out/android-release/filament").absolutePath
|
|
if (project.hasProperty("filament_dist_dir")) {
|
|
filamentPath = file(project.property("filament_dist_dir")).absolutePath
|
|
}
|
|
def hasVulkan = project.hasProperty("filament_supports_vulkan")
|
|
|
|
// Our minSdkVersion is actually 19, we lie and say 14 here so apps don't have
|
|
// to increase their minSdkVersion unnecessarily. It is however up to them to
|
|
// ensure they do not initialize Filament on API levels < 19.
|
|
ext.versions = [
|
|
'minSdk': 14,
|
|
'targetSdk': 29,
|
|
'compileSdk': 29,
|
|
'kotlin': '1.3.61',
|
|
'buildTools': '29.0.3',
|
|
'ndk': '21.0.6113669'
|
|
]
|
|
|
|
ext.deps = [
|
|
'androidx': [
|
|
'annotations': "androidx.annotation:annotation:1.1.0",
|
|
'core': "androidx.core:core:1.1.0",
|
|
],
|
|
'kotlin': "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}"
|
|
]
|
|
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:3.6.1'
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
|
|
}
|
|
|
|
ext.cmakeArgs = [
|
|
"-DANDROID_PIE=ON",
|
|
"-DANDROID_PLATFORM=21",
|
|
"-DANDROID_STL=c++_static",
|
|
"-DFILAMENT_DIST_DIR=${filamentPath}".toString(),
|
|
"-DFILAMENT_SUPPORTS_VULKAN=${hasVulkan ? 'ON' : 'OFF'}".toString()
|
|
]
|
|
|
|
ext.cppFlags = [
|
|
"-std=c++14",
|
|
"-Wno-unused-command-line-argument",
|
|
// Required to support API levels below 23
|
|
"-Wl,--hash-style=both",
|
|
"-fno-stack-protector",
|
|
"-fno-exceptions",
|
|
"-fno-unwind-tables",
|
|
"-fno-asynchronous-unwind-tables",
|
|
"-fno-rtti",
|
|
"-ffast-math",
|
|
"-ffp-contract=fast",
|
|
"-fvisibility-inlines-hidden",
|
|
"-fvisibility=hidden",
|
|
"-fomit-frame-pointer",
|
|
"-ffunction-sections",
|
|
"-fdata-sections",
|
|
"-Wl,--gc-sections",
|
|
"-Wl,-Bsymbolic-functions",
|
|
]
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
google()
|
|
jcenter()
|
|
}
|
|
}
|
|
|
|
subprojects { project ->
|
|
group = GROUP
|
|
version = VERSION_NAME
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
google()
|
|
jcenter()
|
|
}
|
|
}
|
|
|
|
gradle.taskGraph.whenReady {
|
|
gradle.taskGraph.allTasks.each {
|
|
it.onlyIf {
|
|
!it.project.ext.has('isSample') || !project.hasProperty('filament_skip_samples')
|
|
}
|
|
}
|
|
}
|