1buildscript { 2 repositories { 3 jcenter() 4 } 5 6 dependencies { 7 classpath 'com.android.tools.build:gradle-experimental:0.6.0-alpha3' 8 } 9} 10 11apply plugin: 'com.android.model.application' 12 13def demosDir = "../.." 14def smokeDir = "${demosDir}/demos/Smoke" 15def glmDir = "${demosDir}/../libs" 16def vulkanDir = "${demosDir}/../Vulkan-Docs/src" 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 } 69 } 70 } 71 } 72 73 android.buildTypes { 74 release { 75 ndk.with { 76 debuggable = true 77 } 78 } 79 } 80 81 android.productFlavors { 82 create ("fat") { 83 ndk.abiFilters.add("armeabi-v7a") 84 ndk.abiFilters.add("x86") 85 } 86 } 87} 88