add windows build compat

This commit is contained in:
Kr328 committed 2020-06-13 00:25:18 +08:00
1 parent a0b5e595c8
commit d7b0fa5e29
1 file changed
+11 -3
+11 -3
View File
@@ -13,6 +13,14 @@ val golangSource = file("src/main/golang")
val golangOutput = buildDir.resolve("outputs/golang")
val nativeAbis = listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
val String.exe: String
get() {
return if ( Os.isFamily(Os.FAMILY_WINDOWS) )
"$this.exe"
else
this
}
fun generateGolangBuildEnvironment(abi: String): Map<String, String> {
val properties = Properties().apply {
load(FileInputStream(rootProject.file("local.properties")))
@@ -88,9 +96,9 @@ fun generateGolangBuildEnvironment(abi: String): Map<String, String> {
}
return mapOf(
"CC" to compilerBase.resolve(cCompiler).absolutePath,
"CXX" to compilerBase.resolve(cppCompiler).absolutePath,
"LD" to compilerBase.resolve(linker).absolutePath,
"CC" to compilerBase.resolve(cCompiler.exe).absolutePath,
"CXX" to compilerBase.resolve(cppCompiler.exe).absolutePath,
"LD" to compilerBase.resolve(linker.exe).absolutePath,
"GOOS" to "android",
"GOARCH" to golangArch,
"CGO_ENABLED" to "1",