-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·42 lines (32 loc) · 976 Bytes
/
build.sh
File metadata and controls
executable file
·42 lines (32 loc) · 976 Bytes
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
41
42
#!/bin/bash
set -ex
### Requirements
# 1. CMake 3.20 or later
# 2. Raspberry Pi Pico C SDK
# > [!IMPORTANT]
# > The project assumes the Pico SDK is installed in your home directory and in a
# > folder named `.pico-sdk`. I.e., `/Users/dev/.pico-sdk/`
if ! test -e ~/.pico-sdk; then
ln -sv /usr/share/pico-sdk ~/.pico-sdk
fi
export PICO_SDK_PATH=~/.pico-sdk
# Default to debug build
if test "$RELEASE"; then
REL=Release
else
REL=Debug
fi
BUILD_ROOT=./build
BUILD_DIR=$BUILD_ROOT/$REL
mkdir -p $BUILD_ROOT
# export MAKEFLAGS=-j$(nproc)
export CMAKE_EXPORT_COMPILE_COMMANDS=ON
# Clean targets
test "$MRPROPER" && rm -rf $BUILD_ROOT && mkdir -p $BUILD_ROOT
test "$CLEAN" && cmake --build $BUILD_DIR --target clean
# Within the project root, use CMake to generate the build scripts
test -d $BUILD_DIR || cmake -DCMAKE_BUILD_TYPE=$REL -B $BUILD_DIR
# Build the project
cmake --build $BUILD_DIR -j
# -DCMAKE_BUILD_TYPE=$REL
cp $BUILD_DIR/compile_commands.json .