blob: 38fbe824d938191f40eafb808a191421fe4b89e2 [file] [log] [blame]
Brian Silverman8fce7482020-01-05 13:18:21 -08001import org.gradle.language.base.internal.ProjectLayout
2
3apply plugin: 'cpp'
4apply plugin: 'visual-studio'
5apply plugin: 'edu.wpi.first.NativeUtils'
6apply plugin: ExtraTasks
7
8apply from: '../shared/config.gradle'
9
10ext {
11 sharedCvConfigs = [wpilibcIntegrationTests: []]
12 staticCvConfigs = [:]
13 useJava = false
14 useCpp = true
15 staticGtestConfigs = [wpilibcIntegrationTests: []]
16}
17
18apply from: "${rootDir}/shared/opencv.gradle"
19
20apply from: "${rootDir}/shared/googletest.gradle"
21
22model {
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 Silverman8fce7482020-01-05 13:18:21 -080042 lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
Austin Schuh1e69f942020-11-14 15:06:14 -080043 lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
James Kuszmaulcf324122023-01-14 14:07:17 -080044 project(':ntcore').addNtcoreDependency(binary, 'shared')
45 project(':ntcore').addNtcoreJniDependency(binary)
Brian Silverman8fce7482020-01-05 13:18:21 -080046 lib project: ':cscore', library: 'cscore', linkage: 'shared'
Brian Silverman8fce7482020-01-05 13:18:21 -080047 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 Kuszmaulcf324122023-01-14 14:07:17 -080051 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 Silverman8fce7482020-01-05 13:18:21 -080055 lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
56 if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
Austin Schuh812d0d12021-11-04 20:16:48 -070057 nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries')
Brian Silverman8fce7482020-01-05 13:18:21 -080058 }
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
74def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles")
75
76model {
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 Kuszmaulcf324122023-01-14 14:07:17 -080088 if (it.absolutePath.endsWith('.debug')) {
89 return
90 }
Brian Silverman8fce7482020-01-05 13:18:21 -080091 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}