普通文本  |  72行  |  2.07 KB

apply plugin: 'com.android.model.native'

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkDir = properties.getProperty('ndk.dir')

model {
    android {
        compileSdkVersion = 23
        buildToolsVersion = "23.0.2"

        defaultConfig.with {
            minSdkVersion.apiLevel = 22
            targetSdkVersion.apiLevel = 24
            versionCode = 1
            versionName = "0.0.1"
        }
    }

    android.ndk {
        moduleName = "VkLayer_${project.name}"
        toolchain = "clang"
        stl = "gnustl_static"
        ldLibs.addAll(["log", "android"])
        cppFlags.addAll(["-std=c++11", "-DVK_PROTOTYPES", "-Wall", "-Werror",
                         "-Wno-unused-function", "-Wno-unused-const-variable",
                         "-DVK_USE_PLATFORM_ANDROID_KHR"])
        cppFlags.addAll(["-I${file("../../../../layers")}".toString(),
                         "-I${file("../../../../include")}".toString(),
                         "-I${file("../../../../loader")}".toString(),
                         "-I${file("../../include")}".toString(),
                         "-I${file("../../../../../glslang")}".toString()])
    }

    // Turn on hard float support in armeabi-v7a
    android.abis {
        create("armeabi-v7a") {
            cppFlags.addAll(["-mhard-float", "-D_NDK_MATH_NO_SOFTFP=1", "-mfloat-abi=hard"])
            ldLibs.add("m_hard")
            ldFlags.add("-Wl,--no-warn-mismatch")
        }
    }

    android.sources {
        main {
            jni {
                source {
                    srcDir "../../layer-src/${project.name}"
                    srcDir '../../common'

                }
            }
        }
    }

    android.buildTypes {
        release {
            ndk.with {
                debuggable = true
            }
            minifyEnabled = false
        }
    }
    android.productFlavors {
        create ("all") {
            ndk.abiFilters.addAll(["armeabi-v7a", 'arm64-v8a',
                                   'x86', 'x86_64'])
        }
    }
}