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' lib project: ':Crypto', library: 'Crypto' lib library: 'ssl' lib library: 'crypto' lib project: ':Foundation', library: 'Foundation' } } } } testSuites { CryptoTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) { testing $.components.TestSuite binaries.all { String PATH = tasks.run.environment.get("Path") if (targetPlatform.name.equals("win32")) { PATH = "$rootDir/openssl/build/win32/bin/release;$PATH" PATH = "$rootDir/openssl/build/win32/bin/debug;$PATH" } else if (targetPlatform.name.equals("win64")) { PATH = "$rootDir/openssl/build/win64/bin/release;$PATH" PATH = "$rootDir/openssl/build/win64/bin/debug;$PATH" } tasks.run.environment "Path", PATH } } } 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" }