summaryrefslogtreecommitdiff
path: root/android/flatbuffers/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'android/flatbuffers/build.gradle')
-rw-r--r--android/flatbuffers/build.gradle79
1 files changed, 79 insertions, 0 deletions
diff --git a/android/flatbuffers/build.gradle b/android/flatbuffers/build.gradle
new file mode 100644
index 0000000..ccd0ce7
--- /dev/null
+++ b/android/flatbuffers/build.gradle
@@ -0,0 +1,79 @@
+plugins {
+ id 'com.android.library'
+ id "de.undercouch.download" version "5.0.1"
+}
+
+def thirdPartyDir = new File ("${rootProject.projectDir}/third_party")
+
+def flatbuffersDir = new File("${thirdPartyDir}/flatbuffers-2.0.0")
+
+android {
+ compileSdkVersion 31
+ ndkVersion "21.3.6528147"
+ defaultConfig {
+ minSdkVersion 28
+ targetSdkVersion 31
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ externalNativeBuild {
+ cmake {
+ arguments '-DCMAKE_VERBOSE_MAKEFILE=1'
+ arguments '-DCMAKE_INSTALL_PREFIX:PATH=/usr'
+ arguments '-DANDROID_STL=c++_shared'
+ arguments "-DANDROID_NDK_HOME=${System.env.ANDROID_NDK_ROOT}"
+ arguments '-DFLATBUFFERS_BUILD_TESTS=OFF'
+ arguments '-DFLATBUFFERS_BUILD_FLATC=OFF'
+ arguments '-DFLATBUFFERS_BUILD_FLATHASH=OFF'
+ arguments '-DFLATBUFFERS_BUILD_CPP17=ON'
+ arguments '-DFLATBUFFERS_INSTALL=OFF'
+ cppFlags "-std=c++17"
+ abiFilters 'arm64-v8a', 'x86'
+ targets "flatbuffers"
+ }
+ }
+ }
+ buildFeatures {
+ prefab false
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ externalNativeBuild {
+ cmake {
+ path "${flatbuffersDir}/CMakeLists.txt"
+ }
+ }
+}
+
+dependencies {
+ testImplementation 'junit:junit:4.+'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.3'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
+}
+
+task downloadFlatBuffers(type: Download) {
+ doFirst {
+ println("Downloading FlatBuffers")
+ }
+ src "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.0.zip"
+ dest new File(thirdPartyDir, "flatbuffers.zip")
+ onlyIfModified true
+}
+
+task unzipFlatBuffers(type: Copy, dependsOn: downloadFlatBuffers) {
+ doFirst {
+ println("Unzipping FlatBuffers")
+ }
+ from zipTree(downloadFlatBuffers.dest)
+ into thirdPartyDir
+ onlyIf { !flatbuffersDir.exists() }
+}
+
+task wrapper(type: Wrapper) {
+ gradleVersion = '4.1'
+}
+
+preBuild.dependsOn(unzipFlatBuffers)