blob: d86e4d604be0bb465f2ce512d2a6472d3754d4fd [file] [log] [blame]
Brian Silverman41cdd3e2019-01-19 19:48:58 -08001apply plugin: 'cpp'
2apply plugin: 'google-test-test-suite'
3apply plugin: 'visual-studio'
4apply plugin: 'edu.wpi.first.NativeUtils'
5apply plugin: SingleNativeBuild
6apply plugin: ExtraTasks
7
8
9ext {
10 nativeName = 'lowfi_sim'
11}
12
13apply from: "${rootDir}/shared/config.gradle"
14
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080015if (!project.hasProperty('onlylinuxathena')) {
16 ext.skiplinuxathena = true
Brian Silverman41cdd3e2019-01-19 19:48:58 -080017 ext {
18 sharedCvConfigs = [lowfi_simTest: []]
19 staticCvConfigs = [:]
20 useJava = false
21 useCpp = true
22 }
23 apply from: "${rootDir}/shared/opencv.gradle"
24
25 ext {
26 staticGtestConfigs = [:]
27 }
28 staticGtestConfigs["${nativeName}Test"] = []
29 apply from: "${rootDir}/shared/googletest.gradle"
30
31 project(':').libraryBuild.dependsOn build
32
33 ext {
34 chipObjectComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(),
35 "${nativeName}Test".toString()]
36 netCommComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(),
37 "${nativeName}Test".toString()]
38 useNiJava = false
39 }
40
41 apply from: "${rootDir}/shared/nilibraries.gradle"
42
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080043 nativeUtils.exportsConfigs {
44 lowfi_sim {
45 x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
46 '_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
47 '_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range',
48 '_TI3?AVout_of_range', '_CT??_R0?AVbad_cast']
49 x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
50 '_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
51 '_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range',
52 '_TI3?AVout_of_range', '_CT??_R0?AVbad_cast']
Brian Silverman41cdd3e2019-01-19 19:48:58 -080053 }
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080054 }
55
56 model {
Brian Silverman41cdd3e2019-01-19 19:48:58 -080057 components {
58 "${nativeName}Base"(NativeLibrarySpec) {
59 sources {
60 cpp {
61 source {
62 srcDirs = ['src/main/native/cpp']
63 include '**/*.cpp'
64 }
65 exportedHeaders {
66 srcDirs 'src/main/native/include'
67 }
68 }
69 }
70 binaries.all {
71 if (it instanceof SharedLibraryBinarySpec) {
72 it.buildable = false
73 return
74 }
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080075 if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
Brian Silverman41cdd3e2019-01-19 19:48:58 -080076 it.buildable = false
77 return
78 }
79 project(':hal').addHalDependency(it, 'shared')
80 lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
Brian Silverman41cdd3e2019-01-19 19:48:58 -080081 }
82 }
83 "${nativeName}"(NativeLibrarySpec) {
84 sources {
85 cpp {
86 source {
87 srcDirs "${rootDir}/shared/singlelib"
88 include '**/*.cpp'
89 }
90 exportedHeaders {
91 srcDirs 'src/main/native/include'
92 }
93 }
94 }
95 binaries.all {
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080096 if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
Brian Silverman41cdd3e2019-01-19 19:48:58 -080097 it.buildable = false
98 return
99 }
100 project(':hal').addHalDependency(it, 'shared')
101 lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
Brian Silverman41cdd3e2019-01-19 19:48:58 -0800102 }
103 }
104 // By default, a development executable will be generated. This is to help the case of
105 // testing specific functionality of the library.
106 "${nativeName}Dev"(NativeExecutableSpec) {
107 targetBuildTypes 'debug'
108 sources {
109 cpp {
110 source {
111 srcDirs 'src/dev/native/cpp'
112 include '**/*.cpp'
113 lib library: "${nativeName}"
114 }
115 exportedHeaders {
116 srcDirs 'src/dev/native/include'
117 }
118 }
119 }
120 binaries.all {
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -0800121 if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
Brian Silverman41cdd3e2019-01-19 19:48:58 -0800122 it.buildable = false
123 return
124 }
125 project(':hal').addHalDependency(it, 'shared')
126 lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
Brian Silverman41cdd3e2019-01-19 19:48:58 -0800127 lib library: nativeName, linkage: 'shared'
128 }
129 }
130 }
131 binaries {
132 withType(GoogleTestTestSuiteBinarySpec) {
133 lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
134 lib project: ':cscore', library: 'cscore', linkage: 'shared'
135 project(':hal').addHalDependency(it, 'shared')
136 lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
137 lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
138 lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
Brian Silverman41cdd3e2019-01-19 19:48:58 -0800139 lib library: nativeName, linkage: 'shared'
140 }
141 }
142 }
143
144 apply from: "publish.gradle"
145}
146
147model {
148
149 testSuites {
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -0800150 if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) {
Brian Silverman41cdd3e2019-01-19 19:48:58 -0800151 "${nativeName}Test"(GoogleTestTestSuiteSpec) {
152 for(NativeComponentSpec c : $.components) {
153 if (c.name == nativeName) {
154 testing c
155 break
156 }
157 }
158 sources {
159 cpp {
160 source {
161 srcDirs 'src/test/native/cpp'
162 include '**/*.cpp'
163 }
164 exportedHeaders {
165 srcDirs 'src/test/native/include', 'src/main/native/cpp'
166 }
167 }
168 }
169 }
170 }
171 }
172 tasks {
173 def c = $.components
174 project.tasks.create('runCpp', Exec) {
175 def found = false
176 c.each {
177 if (it in NativeExecutableSpec && it.name == "${nativeName}Dev") {
178 it.binaries.each {
179 if (!found) {
180 def arch = it.targetPlatform.architecture.name
181 if (arch == 'x86-64' || arch == 'x86') {
182 dependsOn it.tasks.install
183 commandLine it.tasks.install.runScriptFile.get().asFile.toString()
184
185 found = true
186 }
187 }
188 }
189 }
190 }
191 }
192 }
193}
194
195tasks.withType(RunTestExecutable) {
196 args "--gtest_output=xml:test_detail.xml"
197 outputs.dir outputDir
198}