-
-
Notifications
You must be signed in to change notification settings - Fork 202
/
shared.gradle
54 lines (51 loc) · 1.55 KB
/
shared.gradle
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
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'
apply from: 'shared_clang.gradle'
apply from: 'shared_gcc.gradle'
rootProject.ext.createToolchainConfig = { NativeBinarySpec bin ->
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}")
}
boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release'
if (bin.toolChain instanceof VisualCpp)
{
return rootProject.createMsvcConfig(releaseBuild, binaryKind)
}
else if (bin.toolChain instanceof Icc)
{
return rootProject.createIccConfig(releaseBuild, binaryKind)
}
else if (bin.toolChain instanceof Clang)
{
return rootProject.createClangConfig(releaseBuild, binaryKind)
}
else if (bin.toolChain instanceof Gcc)
{
return rootProject.createGccConfig(releaseBuild, binaryKind)
}
else
{
throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}")
}
}