blob: 0dea4006751d5ed82e884e915eac768033adbc80 [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'
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
78def testOutputFolder = file("${project(':').buildDir}/integrationTestFiles")
79
80model {
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}