2015-06-30 12:46:07 +03:00
|
|
|
import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils
|
|
|
|
import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig
|
|
|
|
import org.doomedsociety.gradlecpp.toolchain.icc.Icc
|
|
|
|
import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin
|
2018-10-05 10:31:40 +03:00
|
|
|
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
|
2015-06-30 12:46:07 +03:00
|
|
|
import org.gradle.nativeplatform.NativeBinarySpec
|
|
|
|
import org.gradle.nativeplatform.NativeLibrarySpec
|
|
|
|
|
|
|
|
apply plugin: 'cpp'
|
|
|
|
apply plugin: IccCompilerPlugin
|
2018-10-05 10:31:40 +03:00
|
|
|
apply plugin: GccCompilerPlugin
|
2015-06-30 12:46:07 +03:00
|
|
|
|
|
|
|
void setupToolchain(NativeBinarySpec b) {
|
2016-02-23 02:13:52 +03:00
|
|
|
def cfg = rootProject.createToolchainConfig(b)
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2016-02-23 02:13:52 +03:00
|
|
|
ToolchainConfigUtils.apply(project, cfg, b)
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
model {
|
2016-02-23 02:13:52 +03:00
|
|
|
buildTypes {
|
|
|
|
debug
|
|
|
|
release
|
|
|
|
}
|
|
|
|
|
|
|
|
platforms {
|
|
|
|
x86 {
|
|
|
|
architecture "x86"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
toolChains {
|
2018-10-05 10:31:40 +03:00
|
|
|
visualCpp(VisualCpp)
|
|
|
|
if (project.hasProperty("useGcc")) {
|
|
|
|
gcc(Gcc)
|
|
|
|
} else {
|
|
|
|
icc(Icc)
|
2016-02-23 02:13:52 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
components {
|
2015-06-30 12:46:07 +03:00
|
|
|
cppunitlite(NativeLibrarySpec) {
|
|
|
|
targetPlatform 'x86'
|
2016-02-23 02:13:52 +03:00
|
|
|
|
2015-06-30 12:46:07 +03:00
|
|
|
sources {
|
|
|
|
cppul_main(CppSourceSet) {
|
|
|
|
source {
|
|
|
|
srcDir "src"
|
|
|
|
include "**/*.cpp"
|
|
|
|
}
|
2016-02-23 02:13:52 +03:00
|
|
|
|
2015-06-30 12:46:07 +03:00
|
|
|
exportedHeaders {
|
|
|
|
srcDir "include"
|
2016-02-23 02:13:52 +03:00
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-23 02:13:52 +03:00
|
|
|
binaries.all { NativeBinarySpec b ->
|
|
|
|
project.setupToolchain(b)
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|