2015-06-30 12:46:07 +03:00
|
|
|
import org.doomedsociety.gradlecpp.cfg.BinaryKind
|
|
|
|
import org.doomedsociety.gradlecpp.toolchain.icc.Icc
|
|
|
|
import org.gradle.nativeplatform.NativeBinarySpec
|
|
|
|
import org.gradle.nativeplatform.NativeExecutableBinarySpec
|
|
|
|
import org.gradle.nativeplatform.SharedLibraryBinarySpec
|
|
|
|
import org.gradle.nativeplatform.StaticLibraryBinarySpec
|
|
|
|
import org.gradle.nativeplatform.toolchain.VisualCpp
|
|
|
|
|
|
|
|
apply from: 'shared_msvc.gradle'
|
|
|
|
apply from: 'shared_icc.gradle'
|
|
|
|
|
|
|
|
rootProject.ext.createToolchainConfig = { NativeBinarySpec bin ->
|
2015-12-05 22:40:30 +03:00
|
|
|
BinaryKind binaryKind
|
|
|
|
if (bin instanceof NativeExecutableBinarySpec) {
|
|
|
|
binaryKind = BinaryKind.EXECUTABLE
|
|
|
|
} else if (bin instanceof SharedLibraryBinarySpec) {
|
|
|
|
binaryKind = BinaryKind.SHARED_LIBRARY
|
|
|
|
} else if (bin instanceof StaticLibraryBinarySpec) {
|
|
|
|
binaryKind = BinaryKind.STATIC_LIBRARY
|
|
|
|
} else {
|
|
|
|
throw new RuntimeException("Unknown executable kind ${bin.class.name}")
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2015-12-05 22:40:30 +03:00
|
|
|
boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release'
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2015-12-05 22:40:30 +03:00
|
|
|
if (bin.toolChain instanceof VisualCpp) {
|
|
|
|
return rootProject.createMsvcConfig(releaseBuild, binaryKind)
|
|
|
|
} else if (bin.toolChain instanceof Icc) {
|
|
|
|
return rootProject.createIccConfig(releaseBuild, binaryKind)
|
|
|
|
} else {
|
|
|
|
throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}")
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|