-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.sh
More file actions
executable file
·31 lines (25 loc) · 1.01 KB
/
compile.sh
File metadata and controls
executable file
·31 lines (25 loc) · 1.01 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
#!/usr/bin/env bash
# Build script for a pico or pico-w project
# -DPICO_BOARD=pico_w builds for pico w, not pico
# -B build means cmake creates the build folder if needed
# && means make is only run if cmake was successful
# -j tells make how many cpu threads to use
# $(getconf _NPROCESSORS_ONLN) is the number of threads yout pc has
# -j $(getconf _NPROCESSORS_ONLN) tells make to use all your cores
# This is much faster, but will use more cpu
# -C build tells make what folder to build from/in
# Download the pico-sdk as a submodule
git submodule update --init --recursive
compile_successful=false
# Build files
cmake -B build && \
make -j $(getconf _NPROCESSORS_ONLN) -C build && \
compile_successful=true
if [ "$compile_successful" = false ]; then
echo If issues persist, try deleting the build folder and retrying
fi
echo compile_successful=$compile_successful
# If user runs ./compile u then follow up by running the upload script
if [ "$compile_successful" = true ] && [ "$1" = "u" ]; then
bash upload.sh $2
fi