poco/Util/testsuite/build.gradle
2017-10-31 09:07:53 +01:00

87 lines
2.4 KiB
Groovy

import org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec
model {
components {
withType(NativeComponentSpec) {
binaries.withType(NativeBinarySpec) {
if (buildType == buildTypes.debug) {
if (it instanceof NativeExecutableBinarySpec) {
executable.file = toLocalBin(appendDebugSuffix(executable.file), targetPlatform)
}
} else
if (buildType == buildTypes.release) {
if (it instanceof NativeExecutableBinarySpec) {
executable.file = toLocalBin(executable.file, targetPlatform)
}
}
}
}
TestSuite(NativeLibrarySpec) { m ->
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
exclude 'Win*.cpp'
exclude 'Driver.cpp'
}
exportedHeaders {
srcDir 'src'
}
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
lib project: ':JSON', library: 'JSON', linkage: 'shared'
lib project: ':XML', library: 'XML', linkage: 'shared'
lib project: ':Util', library: 'Util', linkage: 'shared'
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
}
}
binaries.all {
if (targetPlatform.operatingSystem.windows) {
sources {
platformWindows(CppSourceSet) {
lib m.sources.cpp
source {
srcDir 'src'
include 'Win*.cpp'
exclude '*Driver.cpp'
}
exportedHeaders {
srcDir 'src'
}
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
lib project: ':Util', library: 'Util', linkage: 'shared'
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
}
}
}
}
}
}
testSuites {
UtilTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
}
}
binaries {
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
if (toolChain in VisualCpp) {
if (buildType == buildTypes.debug) {
cCompiler.args "/MDd"
cppCompiler.args "/MDd"
} else
if (buildType == buildTypes.release) {
cCompiler.args "/MD"
cppCompiler.args "/MD"
} else {
throw new GradleException("Unknown buildType" + buildType)
}
}
if (toolChain in Gcc) {
}
}
}
}
task testsuite { dependsOn "assemble" }