forked from petejohanson/unified-zmk-config-template
-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·40 lines (34 loc) · 1.15 KB
/
build.sh
File metadata and controls
executable file
·40 lines (34 loc) · 1.15 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
config_dir="${PWD}/config"
timestamp=$(date -u +"%Y%m%d%H%M%S")
while IFS=$',' read -r board shield; do
extra_cmake_args=${shield:+-DSHIELD="$shield"}
artifact_name=${shield:+${shield// /-}-}${board}-zmk
filename="firmware/${timestamp}-${artifact_name}"
build_dir="build/${artifact_name}"
echo ""
echo "-----------------"
echo "BUILDING FIRMWARE"
echo "-----------------"
echo "Zephyr: ${ZEPHYR_VERSION}"
echo "Board: ${board}"
echo "Shield: ${shield}"
echo ""
if [[ ! -d "$build_dir" ]]; then
west build -s zmk/app -b "$board" -d ${build_dir} -- \
-DZMK_CONFIG="$config_dir" "${extra_cmake_args}"
else
west build -d ${build_dir} -- -DZMK_CONFIG="$config_dir"
fi
if [[ ! -z $OUTPUT_ZMK_CONFIG ]]; then
grep -v -e "^#" -e "^$" ${build_dir}/zephyr/.config \
| sort > "${filename}.config"
fi
cp ${build_dir}/zephyr/zmk.uf2 "${filename}.uf2"
done < <(yq '
[{"board": .board[], "shield": .shield[] // ""}] + .include
| filter(.board)
| unique_by(.board + .shield).[]
| [.board, .shield // ""]
| @csv
' build.yaml)