|
| 1 | +apply plugin: 'com.android.model.application' |
| 2 | + |
| 3 | +// Retrieve ndk path: ndk.dir MUST be set in file local.properties |
| 4 | +Properties properties = new Properties() |
| 5 | +properties.load(project.rootProject.file('local.properties').newDataInputStream()) |
| 6 | +def ndkDir = properties.getProperty('ndk.dir') |
| 7 | + |
| 8 | +def gpg_cpp_path = file(project(':gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android" |
| 9 | + |
| 10 | +// stlport configuration ["c++_static", "c++_shared", "gnustl_static", "gnustl_shared"] |
| 11 | +// used to set stl and location of libgpg.a |
| 12 | +def stlportType = "c++" |
| 13 | +def stllinkType = "static" |
| 14 | + |
| 15 | +model { |
| 16 | + repositories { |
| 17 | + libs(PrebuiltLibraries) { |
| 18 | + gpg { |
| 19 | + headers.srcDir "${gpg_cpp_path}/include" |
| 20 | + // StaticLibraryBinary does not work, use SharedLibraryBinary for now |
| 21 | + binaries.withType(SharedLibraryBinary) { |
| 22 | + sharedLibraryFile = file("${gpg_cpp_path}/lib/${stlportType}/${targetPlatform.getName()}/libgpg.a") |
| 23 | + } |
| 24 | + } |
| 25 | + } |
| 26 | + } |
| 27 | + android { |
| 28 | + compileSdkVersion=22 |
| 29 | + buildToolsVersion="23.0.1" |
| 30 | + |
| 31 | + defaultConfig.with { |
| 32 | + applicationId="com.google.example.games.ButtonClicker" |
| 33 | + minSdkVersion.apiLevel = 11 |
| 34 | + targetSdkVersion.apiLevel = 22 |
| 35 | + } |
| 36 | + } |
| 37 | + android.sources { |
| 38 | + main { |
| 39 | + jni { |
| 40 | + dependencies { |
| 41 | + library "gpg" |
| 42 | + project ":cpufeatures" linkage "static" |
| 43 | + project ":native_app_glue" linkage "static" |
| 44 | + } |
| 45 | + source { |
| 46 | + srcDir 'src/main/jni' |
| 47 | + srcDir '../Common/ndk_helper' |
| 48 | + srcDir '../Common/jui_helper' |
| 49 | + } |
| 50 | + } |
| 51 | + } |
| 52 | + } |
| 53 | + android.ndk { |
| 54 | + platformVersion = 11 |
| 55 | + moduleName = "ButtonClickerNativeActivity" |
| 56 | + stl = "${stlportType}_${stllinkType}" |
| 57 | + ldLibs.addAll(["atomic", "log", "android", "EGL", "GLESv2", "z"]) |
| 58 | + abiFilters.addAll(["armeabi", "armeabi-v7a", "x86", "arm64-v8a"]) |
| 59 | + cppFlags.addAll(["-std=c++11", |
| 60 | + "-I${file("../Common/ndk_helper")}".toString(), |
| 61 | + "-I${file("../Common/jui_helper")}".toString() ]) |
| 62 | + } |
| 63 | + android.buildTypes { |
| 64 | + release { |
| 65 | + minifyEnabled=false |
| 66 | + proguardFiles.add(file('proguard-android.txt')) |
| 67 | + } |
| 68 | + } |
| 69 | + android.abis { |
| 70 | + create("armeabi-v7a") { |
| 71 | + cppFlags.addAll(["-mhard-float", "-D_NDK_MATH_NO_SOFTFP=1", "-mfloat-abi=hard"]) |
| 72 | + ldLibs.add("m_hard") |
| 73 | + ldFlags.add("-Wl,--no-warn-mismatch") |
| 74 | + } |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +dependencies { |
| 79 | + compile 'com.android.support:support-v4:22.2.1' |
| 80 | + compile 'com.google.android.gms:play-services:8.3.0' |
| 81 | +} |
0 commit comments