summaryrefslogtreecommitdiff
path: root/android/flatbuffers
diff options
context:
space:
mode:
Diffstat (limited to 'android/flatbuffers')
-rw-r--r--android/flatbuffers/build.gradle79
-rw-r--r--android/flatbuffers/proguard-rules.pro21
-rw-r--r--android/flatbuffers/src/main/AndroidManifest.xml4
3 files changed, 104 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)
diff --git a/android/flatbuffers/proguard-rules.pro b/android/flatbuffers/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/android/flatbuffers/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/android/flatbuffers/src/main/AndroidManifest.xml b/android/flatbuffers/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f4119ba
--- /dev/null
+++ b/android/flatbuffers/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.samsung.android.flatbuffers">
+</manifest>