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