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' |
| 35 | binaries.all { binary -> |
| 36 | if (binary.targetPlatform.architecture.name == 'athena') { |
| 37 | binary.sources { |
| 38 | athenaCpp(CppSourceSet) { |
| 39 | source { |
| 40 | srcDirs = ['src/main/native/cpp'] |
| 41 | includes = ['**/*.cpp'] |
| 42 | } |
| 43 | exportedHeaders { |
| 44 | srcDirs = ['src/main/native/include'] |
| 45 | includes = ['**/*.h'] |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | binary.tasks.withType(CppCompile) { |
| 50 | cppCompiler.args "-Wno-missing-field-initializers" |
| 51 | cppCompiler.args "-Wno-unused-variable" |
| 52 | cppCompiler.args "-Wno-error=deprecated-declarations" |
| 53 | } |
| 54 | lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' |
| 55 | lib project: ':ntcore', library: 'ntcore', linkage: 'shared' |
| 56 | lib project: ':cscore', library: 'cscore', linkage: 'shared' |
| 57 | lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared' |
| 58 | lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared' |
| 59 | project(':hal').addHalDependency(binary, 'shared') |
| 60 | project(':hal').addHalJniDependency(binary) |
| 61 | lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' |
| 62 | lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' |
| 63 | } else { |
| 64 | binary.sources { |
| 65 | simCpp(CppSourceSet) { |
| 66 | source { |
| 67 | srcDirs 'src/main/native/dt' |
| 68 | includes = ['**/*.cpp'] |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles") |
| 79 | |
| 80 | model { |
| 81 | tasks { |
| 82 | copyWpilibCTestLibrariesToOutput(Copy) { |
| 83 | def task = it |
| 84 | $.binaries.each { |
| 85 | if (it in NativeExecutableBinarySpec && it.targetPlatform.architecture.name == 'athena') { |
| 86 | def installTask = it.tasks.install |
| 87 | task.dependsOn installTask |
| 88 | task.from(installTask.executableFile) { |
| 89 | into '/cpp' |
| 90 | } |
| 91 | installTask.libs.each { |
| 92 | task.from(it) { |
| 93 | into '/libs' |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | destinationDir testOutputFolder |
| 99 | } |
| 100 | // This is in a separate if statement because of what I would assume is a bug in grade. |
| 101 | // Will file an issue on their side. |
| 102 | if (!project.hasProperty('skipAthena')) { |
| 103 | build.dependsOn copyWpilibCTestLibrariesToOutput |
| 104 | } |
| 105 | } |
| 106 | } |