poco/Foundation/testsuite/build.gradle

121 lines
2.8 KiB
Groovy
Raw Normal View History

2017-10-31 09:07:53 +01:00
import org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec
model {
components {
2018-09-28 16:31:45 +02:00
/*
2017-10-31 09:07:53 +01:00
withType(NativeComponentSpec) {
binaries.withType(NativeBinarySpec) {
if (buildType == buildTypes.debug) {
2018-09-28 16:31:45 +02:00
if (it instanceof NativeExecutableBinarySpec) {
2017-10-31 09:07:53 +01:00
executable.file = toLocalBin(appendDebugSuffix(executable.file), targetPlatform)
}
} else
if (buildType == buildTypes.release) {
2018-09-28 16:31:45 +02:00
if (it instanceof NativeExecutableBinarySpec) {
2017-10-31 09:07:53 +01:00
executable.file = toLocalBin(executable.file, targetPlatform)
}
}
}
}
2018-09-28 16:31:45 +02:00
*/
2018-09-22 20:28:04 +02:00
TestLibrary(NativeLibrarySpec) {
2017-10-31 09:07:53 +01:00
sources {
cpp {
source {
srcDir 'src'
include 'TestLibrary.cpp'
include 'TestPlugin.cpp'
}
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
}
}
}
TestApp(NativeExecutableSpec) {
sources {
cpp {
source {
srcDir 'src'
include 'TestApp.cpp'
}
}
}
}
TestSuite(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
exclude '*Driver.cpp'
exclude '*_WINCE.cpp'
exclude 'TestApp*.cpp'
}
exportedHeaders {
srcDir 'src'
}
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
}
}
}
}
testSuites {
FoundationTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
binaries.all {
String PATH = ""
if (targetPlatform.name.startsWith("win"))
PATH = tasks.run.environment.get("Path")
else
PATH = tasks.run.environment.get("PATH")
2018-10-03 19:42:00 +02:00
String testAppDir = project.buildDir
testAppDir += "/exe" + "/testApp"
testAppDir += "/" + targetPlatform.name
if (buildType == buildTypes.debug)
testAppDir += "/debug"
else
if (buildType == buildTypes.release)
testAppDir += "/release"
if (targetPlatform.name.startsWith("win"))
testAppDir = testAppDir.replace('/', '\\')
2018-10-11 19:23:00 +02:00
PATH = testAppDir + File.pathSeparator + PATH
if (targetPlatform.name.startsWith("win"))
tasks.run.environment "Path", PATH
else
tasks.run.environment "PATH", PATH
}
2017-10-31 09:07:53 +01:00
}
}
binaries {
2017-10-31 09:07:53 +01:00
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
2018-09-22 20:28:04 +02:00
lib library: 'TestLibrary', linkage: 'shared'
2017-10-31 09:07:53 +01:00
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"
}
}
if (toolChain in Gcc) {
}
}
}
}
task testsuite { dependsOn "assemble" }
tasks.withType(RunTestExecutable) {
environment "POCO_BASE", "$rootDir"
args test
2018-10-11 19:23:00 +02:00
}