-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·26 lines (26 loc) · 882 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
set -e
if [[ "$1" == "clean" ]] || [[ "$1" == "simulator" ]] || [[ "$1" == "device" ]];then
if [[ "$1" == "clean" ]];then
cargo clean
rm -r build
else
if [[ "$1" == "simulator" ]];then
target=$(uname -m)-apple-darwin
elif [[ "$1" == "device" ]];then
target=thumbv7em-none-eabihf
fi
cargo build --release --example $2 --target $target
out=target/$target/release/examples
mkdir -p $out/source
mkdir -p build
if [[ "$1" == "simulator" ]];then
touch $out/source/pdex.bin
cp $out/lib$2.dylib $out/source/pdex.dylib
pdc $out/source build/$2.pdx
elif [[ "$1" == "device" ]];then
arm-none-eabi-objcopy -O binary $out/$2 $out/source/pdex.bin
pdc $out/source build/$2-device.pdx
fi
fi
fi