Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -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 | ext { |
| 23 | chipObjectComponents = ['wpilibcIntegrationTests'] |
| 24 | netCommComponents = ['wpilibcIntegrationTests'] |
| 25 | useNiJava = false |
| 26 | } |
| 27 | |
| 28 | apply from: "${rootDir}/shared/nilibraries.gradle" |
| 29 | |
| 30 | model { |
| 31 | components { |
| 32 | wpilibcIntegrationTests(NativeExecutableSpec) { |
| 33 | targetBuildTypes 'debug' |
| 34 | baseName = 'FRCUserProgram' |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame^] | 35 | nativeUtils.useRequiredLibrary(it, 'googletest_static') |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 36 | binaries.all { binary -> |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame^] | 37 | if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 38 | binary.sources { |
| 39 | athenaCpp(CppSourceSet) { |
| 40 | source { |
| 41 | srcDirs = ['src/main/native/cpp'] |
| 42 | includes = ['**/*.cpp'] |
| 43 | } |
| 44 | exportedHeaders { |
| 45 | srcDirs = ['src/main/native/include'] |
| 46 | includes = ['**/*.h'] |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | binary.tasks.withType(CppCompile) { |
| 51 | cppCompiler.args "-Wno-missing-field-initializers" |
| 52 | cppCompiler.args "-Wno-unused-variable" |
| 53 | cppCompiler.args "-Wno-error=deprecated-declarations" |
| 54 | } |
| 55 | lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' |
| 56 | lib project: ':ntcore', library: 'ntcore', linkage: 'shared' |
| 57 | lib project: ':cscore', library: 'cscore', linkage: 'shared' |
| 58 | lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared' |
| 59 | lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared' |
| 60 | project(':hal').addHalDependency(binary, 'shared') |
| 61 | project(':hal').addHalJniDependency(binary) |
| 62 | lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' |
| 63 | lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' |
| 64 | } else { |
| 65 | binary.sources { |
| 66 | simCpp(CppSourceSet) { |
| 67 | source { |
| 68 | srcDirs 'src/main/native/dt' |
| 69 | includes = ['**/*.cpp'] |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles") |
| 80 | |
| 81 | model { |
| 82 | tasks { |
| 83 | copyWpilibCTestLibrariesToOutput(Copy) { |
| 84 | def task = it |
| 85 | $.binaries.each { |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame^] | 86 | if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.buildable) { |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 87 | def installTask = it.tasks.install |
| 88 | task.dependsOn installTask |
| 89 | task.from(installTask.executableFile) { |
| 90 | into '/cpp' |
| 91 | } |
| 92 | installTask.libs.each { |
| 93 | task.from(it) { |
| 94 | into '/libs' |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | destinationDir testOutputFolder |
| 100 | } |
| 101 | // This is in a separate if statement because of what I would assume is a bug in grade. |
| 102 | // Will file an issue on their side. |
James Kuszmaul | 4f3ad3c | 2019-12-01 16:35:21 -0800 | [diff] [blame^] | 103 | if (!project.hasProperty('skiponlyathena')) { |
Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame] | 104 | build.dependsOn copyWpilibCTestLibrariesToOutput |
| 105 | } |
| 106 | } |
| 107 | } |