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 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 42 | lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared' |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 43 | lib project: ':wpimath', library: 'wpimath', linkage: 'shared' |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 44 | project(':ntcore').addNtcoreDependency(binary, 'shared') |
| 45 | project(':ntcore').addNtcoreJniDependency(binary) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 46 | lib project: ':cscore', library: 'cscore', linkage: 'shared' |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 47 | lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared' |
| 48 | project(':hal').addHalDependency(binary, 'shared') |
| 49 | project(':hal').addHalJniDependency(binary) |
| 50 | lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 51 | lib project: ':wpimath', library: 'wpimathJNIShared', linkage: 'shared' |
| 52 | lib project: ':wpinet', library: 'wpinetJNIShared', linkage: 'shared' |
| 53 | lib project: ':wpiutil', library: 'wpiutilJNIShared', linkage: 'shared' |
| 54 | lib project: ':wpinet', library: 'wpinet', linkage: 'shared' |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 55 | lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared' |
| 56 | if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 57 | nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 58 | } |
| 59 | } else { |
| 60 | binary.sources { |
| 61 | simCpp(CppSourceSet) { |
| 62 | source { |
| 63 | srcDirs 'src/main/native/dt' |
| 64 | includes = ['**/*.cpp'] |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles") |
| 75 | |
| 76 | model { |
| 77 | tasks { |
| 78 | copyWpilibCTestLibrariesToOutput(Copy) { |
| 79 | def task = it |
| 80 | $.binaries.each { |
| 81 | if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.buildable) { |
| 82 | def installTask = it.tasks.install |
| 83 | task.dependsOn installTask |
| 84 | task.from(installTask.executableFile) { |
| 85 | into '/cpp' |
| 86 | } |
| 87 | installTask.libs.each { |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 88 | if (it.absolutePath.endsWith('.debug')) { |
| 89 | return |
| 90 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 91 | task.from(it) { |
| 92 | into '/libs' |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | destinationDir testOutputFolder |
| 98 | } |
| 99 | // This is in a separate if statement because of what I would assume is a bug in grade. |
| 100 | // Will file an issue on their side. |
| 101 | if (!project.hasProperty('skiponlyathena')) { |
| 102 | build.dependsOn copyWpilibCTestLibrariesToOutput |
| 103 | } |
| 104 | } |
| 105 | } |