blob: ed6d58e9f3f7433acfa4f54ce01a27a31dc307cc [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 }
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'
49 lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
50 lib project: ':cscore', library: 'cscore', linkage: 'shared'
51 lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared'
52 lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared'
53 project(':hal').addHalDependency(binary, 'shared')
54 project(':hal').addHalJniDependency(binary)
55 lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
56 lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
57 if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
58 nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared')
59 }
60 } else {
61 binary.sources {
62 simCpp(CppSourceSet) {
63 source {
64 srcDirs 'src/main/native/dt'
65 includes = ['**/*.cpp']
66 }
67 }
68 }
69 }
70 }
71 }
72 }
73}
74
75def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles")
76
77model {
78 tasks {
79 copyWpilibCTestLibrariesToOutput(Copy) {
80 def task = it
81 $.binaries.each {
82 if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.buildable) {
83 def installTask = it.tasks.install
84 task.dependsOn installTask
85 task.from(installTask.executableFile) {
86 into '/cpp'
87 }
88 installTask.libs.each {
89 task.from(it) {
90 into '/libs'
91 }
92 }
93 }
94 }
95 destinationDir testOutputFolder
96 }
97 // This is in a separate if statement because of what I would assume is a bug in grade.
98 // Will file an issue on their side.
99 if (!project.hasProperty('skiponlyathena')) {
100 build.dependsOn copyWpilibCTestLibrariesToOutput
101 }
102 }
103}