summaryrefslogtreecommitdiff
path: root/build-android/gradle-templates/win.template.gradle
blob: 07596afa915b20c17a5d1f094466431e1a5e5e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// this template is for windows platform to build
//   need gcc, could not use clang
//   disable -Werror compile flag
// This is temp workaround, clean fix will be provided soon so all OSes should use
// common.gradle

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 = "gcc"
        stl = "gnustl_static"
        ldLibs.addAll(["log", "android"])
        cppFlags.addAll(["-std=c++11", "-DVK_PROTOTYPES", "-Wall",
                         "-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("../../../../external/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'])
        }
    }
}