Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 1 | import org.gradle.language.base.internal.ProjectLayout |
| 2 | |
| 3 | apply plugin: 'cpp' |
| 4 | apply plugin: 'visual-studio' |
| 5 | apply plugin: 'edu.wpi.first.NativeUtils' |
| 6 | apply plugin: ExtraTasks |
| 7 | |
| 8 | apply from: '../shared/config.gradle' |
| 9 | |
| 10 | ext { |
| 11 | sharedCvConfigs = [wpilibcIntegrationTests: []] |
| 12 | staticCvConfigs = [:] |
| 13 | useJava = false |
| 14 | useCpp = true |
| 15 | staticGtestConfigs = [wpilibcIntegrationTests: []] |
| 16 | } |
| 17 | |
| 18 | apply from: "${rootDir}/shared/opencv.gradle" |
| 19 | |
| 20 | apply from: "${rootDir}/shared/googletest.gradle" |
| 21 | |
| 22 | model { |
| 23 | components { |
| 24 | wpilibcIntegrationTests(NativeExecutableSpec) { |
| 25 | targetBuildTypes 'debug' |
| 26 | baseName = 'FRCUserProgram' |
| 27 | nativeUtils.useRequiredLibrary(it, 'googletest_static') |
| 28 | binaries.all { binary -> |
| 29 | if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { |
| 30 | binary.sources { |
| 31 | athenaCpp(CppSourceSet) { |
| 32 | source { |
| 33 | srcDirs = ['src/main/native/cpp'] |
| 34 | includes = ['**/*.cpp'] |
| 35 | } |
| 36 | exportedHeaders { |
| 37 | srcDirs = ['src/main/native/include'] |
| 38 | includes = ['**/*.h'] |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | binary.tasks.withType(CppCompile) { |
| 43 | cppCompiler.args "-Wno-missing-field-initializers" |
| 44 | cppCompiler.args "-Wno-unused-variable" |
| 45 | cppCompiler.args "-Wno-error=deprecated-declarations" |
| 46 | } |
| 47 | lib project: ':wpilibOldCommands', library: 'wpilibOldCommands', linkage: 'shared' |
| 48 | lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame^] | 49 | lib project: ':wpimath', library: 'wpimath', linkage: 'shared' |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 50 | lib project: ':ntcore', library: 'ntcore', linkage: 'shared' |
| 51 | lib project: ':cscore', library: 'cscore', linkage: 'shared' |
| 52 | lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared' |
| 53 | lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared' |
| 54 | project(':hal').addHalDependency(binary, 'shared') |
| 55 | project(':hal').addHalJniDependency(binary) |
| 56 | lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' |
| 57 | lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' |
| 58 | if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { |
| 59 | nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared') |
| 60 | } |
| 61 | } else { |
| 62 | binary.sources { |
| 63 | simCpp(CppSourceSet) { |
| 64 | source { |
| 65 | srcDirs 'src/main/native/dt' |
| 66 | includes = ['**/*.cpp'] |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles") |
| 77 | |
| 78 | model { |
| 79 | tasks { |
| 80 | copyWpilibCTestLibrariesToOutput(Copy) { |
| 81 | def task = it |
| 82 | $.binaries.each { |
| 83 | if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.buildable) { |
| 84 | def installTask = it.tasks.install |
| 85 | task.dependsOn installTask |
| 86 | task.from(installTask.executableFile) { |
| 87 | into '/cpp' |
| 88 | } |
| 89 | installTask.libs.each { |
| 90 | task.from(it) { |
| 91 | into '/libs' |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | destinationDir testOutputFolder |
| 97 | } |
| 98 | // This is in a separate if statement because of what I would assume is a bug in grade. |
| 99 | // Will file an issue on their side. |
| 100 | if (!project.hasProperty('skiponlyathena')) { |
| 101 | build.dependsOn copyWpilibCTestLibrariesToOutput |
| 102 | } |
| 103 | } |
| 104 | } |