• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1buildscript {
2    repositories {
3        jcenter()
4    }
5
6    dependencies {
7        classpath 'com.android.tools.build:gradle-experimental:0.8.0'
8    }
9}
10
11apply plugin: 'com.android.model.application'
12
13def demosDir = "../.."
14def smokeDir = "${demosDir}/smoke"
15def glmDir = "${demosDir}/../libs"
16def vulkanDir = "${demosDir}/../include"
17
18Properties properties = new Properties()
19properties.load(project.rootProject.file('local.properties').newDataInputStream())
20def ndkDir = properties.getProperty('ndk.dir')
21
22model {
23    android {
24        compileSdkVersion = 23
25        buildToolsVersion = "23.0.2"
26
27        defaultConfig.with {
28            applicationId = "com.example.Smoke"
29            minSdkVersion.apiLevel = 22
30            targetSdkVersion.apiLevel = 22
31            versionCode = 1
32            versionName = "0.1"
33        }
34    }
35
36    android.ndk {
37        moduleName = "Smoke"
38        toolchain = "clang"
39        stl = "c++_static"
40
41        cppFlags.addAll(["-std=c++11", "-fexceptions"])
42        cppFlags.addAll(["-Wall", "-Wextra", "-Wno-unused-parameter"])
43
44        cppFlags.addAll([
45            "-DVK_NO_PROTOTYPES",
46            "-DVK_USE_PLATFORM_ANDROID_KHR",
47            "-DGLM_FORCE_RADIANS",
48        ])
49
50        cppFlags.addAll([
51            "-I${file("${ndkDir}/sources/android/native_app_glue")}".toString(),
52            "-I${file("${vulkanDir}")}".toString(),
53            "-I${file("${glmDir}")}".toString(),
54            "-I${file("src/main/jni")}".toString(),
55        ])
56
57        ldLibs.addAll(["android", "log", "dl"])
58    }
59
60    android.sources {
61        main {
62            jni {
63                source {
64                    srcDir "${ndkDir}/sources/android/native_app_glue"
65                    srcDir "${smokeDir}"
66                    exclude 'ShellXcb.cpp'
67                    exclude 'ShellWin32.cpp'
68                    exclude 'ShellWayland.cpp'
69                }
70            }
71        }
72    }
73
74    android.buildTypes {
75        release {
76            ndk.with {
77                debuggable = true
78            }
79        }
80    }
81
82    android.productFlavors {
83        create ("fat") {
84            ndk.abiFilters.add("arm64-v8a")
85            ndk.abiFilters.add("armeabi-v7a")
86            ndk.abiFilters.add("x86")
87        }
88    }
89}
90