poco/Data/ODBC/testsuite/build.gradle
2018-05-02 23:00:58 +02:00

74 lines
2.0 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) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
exclude '*Driver.cpp'
}
exportedHeaders {
srcDir 'src'
}
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
lib project: ':Data:ODBC', library: 'DataODBC', linkage: 'shared'
lib project: ':Data', library: 'Data', linkage: 'shared'
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
}
}
}
}
testSuites {
ODBCTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
}
}
binaries {
all {
if (toolChain in VisualCpp) {
linker.args 'odbc32.lib'
linker.args 'odbccp32.lib'
}
if (toolChain in Gcc) {
linker.args ( "-L", "/usr/lib/x86_64-linux-gnu")
linker.args ( "-l", "odbc")
}
}
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" }