blob: 8a3797b7f5f6212c54daa96e8d6bee66f3782bac [file] [log] [blame]
Brian Silverman41cdd3e2019-01-19 19:48:58 -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
22ext {
23 chipObjectComponents = ['wpilibcIntegrationTests']
24 netCommComponents = ['wpilibcIntegrationTests']
25 useNiJava = false
26}
27
28apply from: "${rootDir}/shared/nilibraries.gradle"
29
30model {
31 components {
32 wpilibcIntegrationTests(NativeExecutableSpec) {
33 targetBuildTypes 'debug'
34 baseName = 'FRCUserProgram'
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080035 nativeUtils.useRequiredLibrary(it, 'googletest_static')
Brian Silverman41cdd3e2019-01-19 19:48:58 -080036 binaries.all { binary ->
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080037 if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
Brian Silverman41cdd3e2019-01-19 19:48:58 -080038 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
79def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles")
80
81model {
82 tasks {
83 copyWpilibCTestLibrariesToOutput(Copy) {
84 def task = it
85 $.binaries.each {
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080086 if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.buildable) {
Brian Silverman41cdd3e2019-01-19 19:48:58 -080087 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 Kuszmaul4f3ad3c2019-12-01 16:35:21 -0800103 if (!project.hasProperty('skiponlyathena')) {
Brian Silverman41cdd3e2019-01-19 19:48:58 -0800104 build.dependsOn copyWpilibCTestLibrariesToOutput
105 }
106 }
107}