Home | History | Annotate | Download | only in gradle-templates
      1 apply plugin: 'com.android.model.native'
      2 
      3 Properties properties = new Properties()
      4 properties.load(project.rootProject.file('local.properties').newDataInputStream())
      5 def ndkDir = properties.getProperty('ndk.dir')
      6 
      7 model {
      8     android {
      9         compileSdkVersion = 23
     10         buildToolsVersion = "23.0.2"
     11 
     12         defaultConfig.with {
     13             minSdkVersion.apiLevel = 22
     14             targetSdkVersion.apiLevel = 24
     15             versionCode = 1
     16             versionName = "0.0.1"
     17         }
     18     }
     19 
     20     android.ndk {
     21         moduleName = "VkLayer_${project.name}"
     22         toolchain = "clang"
     23         stl = "gnustl_static"
     24         ldLibs.addAll(["log", "android"])
     25         cppFlags.addAll(["-std=c++11", "-DVK_PROTOTYPES", "-Wall", "-Werror",
     26                          "-Wno-unused-function", "-Wno-unused-const-variable",
     27                          "-DVK_USE_PLATFORM_ANDROID_KHR"])
     28         cppFlags.addAll(["-I${file("../../../../layers")}".toString(),
     29                          "-I${file("../../../../include")}".toString(),
     30                          "-I${file("../../../../loader")}".toString(),
     31                          "-I${file("../../include")}".toString(),
     32                          "-I${file("../../../../../glslang")}".toString()])
     33     }
     34 
     35     // Turn on hard float support in armeabi-v7a
     36     android.abis {
     37         create("armeabi-v7a") {
     38             cppFlags.addAll(["-mhard-float", "-D_NDK_MATH_NO_SOFTFP=1", "-mfloat-abi=hard"])
     39             ldLibs.add("m_hard")
     40             ldFlags.add("-Wl,--no-warn-mismatch")
     41         }
     42     }
     43 
     44     android.sources {
     45         main {
     46             jni {
     47                 source {
     48                     srcDir "../../layer-src/${project.name}"
     49                     srcDir '../../common'
     50 
     51                 }
     52             }
     53         }
     54     }
     55 
     56     android.buildTypes {
     57         release {
     58             ndk.with {
     59                 debuggable = true
     60             }
     61             minifyEnabled = false
     62         }
     63     }
     64     android.productFlavors {
     65         create ("all") {
     66             ndk.abiFilters.addAll(["armeabi-v7a", 'arm64-v8a',
     67                                    'x86', 'x86_64'])
     68         }
     69     }
     70 }
     71 
     72