2015-12-14 19:06:38 +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 ->
|
|
|
|
BinaryKind binaryKind
|
2017-07-07 16:01:43 +03:00
|
|
|
if (bin instanceof NativeExecutableBinarySpec)
|
|
|
|
{
|
2015-12-14 19:06:38 +03:00
|
|
|
binaryKind = BinaryKind.EXECUTABLE
|
2017-07-07 16:01:43 +03:00
|
|
|
}
|
|
|
|
else if (bin instanceof SharedLibraryBinarySpec)
|
|
|
|
{
|
2015-12-14 19:06:38 +03:00
|
|
|
binaryKind = BinaryKind.SHARED_LIBRARY
|
2017-07-07 16:01:43 +03:00
|
|
|
}
|
|
|
|
else if (bin instanceof StaticLibraryBinarySpec)
|
|
|
|
{
|
2015-12-14 19:06:38 +03:00
|
|
|
binaryKind = BinaryKind.STATIC_LIBRARY
|
2017-07-07 16:01:43 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-14 19:06:38 +03:00
|
|
|
throw new RuntimeException("Unknown executable kind ${bin.class.name}")
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release'
|
2017-07-07 16:01:43 +03:00
|
|
|
if (bin.toolChain instanceof VisualCpp)
|
|
|
|
{
|
2015-12-14 19:06:38 +03:00
|
|
|
return rootProject.createMsvcConfig(releaseBuild, binaryKind)
|
2017-07-07 16:01:43 +03:00
|
|
|
}
|
|
|
|
else if (bin.toolChain instanceof Icc)
|
|
|
|
{
|
2015-12-14 19:06:38 +03:00
|
|
|
return rootProject.createIccConfig(releaseBuild, binaryKind)
|
2017-07-07 16:01:43 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-14 19:06:38 +03:00
|
|
|
throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}")
|
|
|
|
}
|
|
|
|
}
|