Build includes in parallel

This commit is contained in:
Jeremy Soller
2019-01-20 20:17:04 -07:00
parent f25c494a73
commit f3c858c151
+12 -4
View File
@@ -1,10 +1,13 @@
#!/usr/bin/env bash
set -ex
set -e
include="$(realpath "$1")"
cbindgen="$(realpath cbindgen)"
cargo build --release --manifest-path cbindgen/Cargo.toml
cbindgen="$(realpath target/release/cbindgen)"
jobs=()
for config in src/header/*/cbindgen.toml
do
dir="$(dirname "$config")"
@@ -13,8 +16,13 @@ do
then
header="$include/${name/_//}.h"
pushd "$dir"
cargo run --release --manifest-path "$cbindgen/Cargo.toml" -- \
-c cbindgen.toml -o "$header" mod.rs
"$cbindgen" -c cbindgen.toml -o "$header" mod.rs &
jobs+=($!)
popd
fi
done
for job in "${jobs[@]}"
do
wait "$job"
done