@@ -67,12 +67,10 @@ main() {
67
67
retry cargo fetch
68
68
# don't use xargo: should have native support just from rustc
69
69
rustup toolchain add nightly
70
- " ${CROSS[@]} " build --lib --target " ${TARGET} " ${CROSS_FLAGS}
70
+ cross_build --lib --target " ${TARGET} "
71
71
popd
72
72
73
73
rm -rf " ${td} "
74
-
75
- return
76
74
fi
77
75
78
76
# `cross build` test for the other targets
@@ -82,7 +80,7 @@ main() {
82
80
pushd " ${td} "
83
81
cargo init --lib --name foo .
84
82
retry cargo fetch
85
- " ${CROSS[@]} " build --target " ${TARGET} " ${CROSS_FLAGS}
83
+ cross_build --target " ${TARGET} "
86
84
popd
87
85
88
86
rm -rf " ${td} "
@@ -93,7 +91,7 @@ main() {
93
91
# test that linking works
94
92
cargo init --bin --name hello .
95
93
retry cargo fetch
96
- " ${CROSS[@]} " build --target " ${TARGET} " ${CROSS_FLAGS}
94
+ cross_build --target " ${TARGET} "
97
95
popd
98
96
99
97
rm -rf " ${td} "
@@ -165,18 +163,32 @@ main() {
165
163
166
164
fi
167
165
168
- # Test C++ support
166
+ # Test C++ support in a no_std context
169
167
if (( ${CPP:- 0} )) ; then
170
168
td=" $( mkcargotemp -d) "
171
169
170
+ git clone --depth 1 https://github.com/cross-rs/rust-cpp-accumulate " ${td} "
171
+
172
+ pushd " ${td} "
173
+ retry cargo fetch
174
+ cross_build --target " ${TARGET} "
175
+ popd
176
+
177
+ rm -rf " ${td} "
178
+ fi
179
+
180
+ # Test C++ support
181
+ if (( ${STD:- 0} )) && (( ${CPP:- 0} )) ; then
182
+ td=" $( mkcargotemp -d) "
183
+
172
184
git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word " ${td} "
173
185
174
186
pushd " ${td} "
175
187
retry cargo fetch
176
188
if (( ${RUN:- 0} )) ; then
177
189
cross_run --target " ${TARGET} "
178
190
else
179
- " ${CROSS[@]} " build --target " ${TARGET} " ${CROSS_FLAGS}
191
+ cross_build --target " ${TARGET} "
180
192
fi
181
193
popd
182
194
@@ -192,11 +204,44 @@ main() {
192
204
cargo init --bin --name hello .
193
205
retry cargo fetch
194
206
RUSTFLAGS=" -C target-feature=-crt-static" \
195
- " ${CROSS[@]} " build --target " ${TARGET} " ${CROSS_FLAGS}
207
+ cross_build --target " ${TARGET} "
196
208
popd
197
209
198
210
rm -rf " ${td} "
199
211
fi
212
+
213
+ # test cmake support
214
+ td=" $( mkcargotemp -d) "
215
+
216
+ git clone \
217
+ --recursive \
218
+ --depth 1 \
219
+ https://github.com/cross-rs/rust-cmake-hello-world " ${td} "
220
+
221
+ pushd " ${td} "
222
+ retry cargo fetch
223
+ if [[ " ${TARGET} " == " arm-linux-androideabi" ]]; then
224
+ # ARMv5te isn't supported anymore by Android, which produces missing
225
+ # symbol errors with re2 like `__libcpp_signed_lock_free`.
226
+ cross_run --target " ${TARGET} " --features=tryrun
227
+ elif (( ${STD:- 0} )) && (( ${RUN:- 0} )) && (( ${CPP:- 0} )) ; then
228
+ cross_run --target " ${TARGET} " --features=re2,tryrun
229
+ elif (( ${STD:- 0} )) && (( ${CPP:- 0} )) ; then
230
+ cross_build --target " ${TARGET} " --features=re2
231
+ elif (( ${STD:- 0} )) && (( ${RUN:- 0} )) ; then
232
+ cross_run --target " ${TARGET} " --features=tryrun
233
+ elif (( ${STD:- 0} )) ; then
234
+ cross_build --target " ${TARGET} " --features=tryrun
235
+ else
236
+ cross_build --lib --target " ${TARGET} "
237
+ fi
238
+ popd
239
+
240
+ rm -rf " ${td} "
241
+ }
242
+
243
+ cross_build () {
244
+ " ${CROSS[@]} " build " $@ " ${CROSS_FLAGS}
200
245
}
201
246
202
247
cross_run () {
0 commit comments