Skip to content

Commit 71faf30

Browse files
committed
build.sh: improve script
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
1 parent 982b071 commit 71faf30

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

build.sh

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
BUILD_DIR=build
4-
PICO_SDK_DIR=pico-sdk
5-
6-
main () {
7-
local cur_dir=$PWD
3+
BASE_DIR="$(dirname ${BASH_SOURCE[0]})"
4+
BUILD_DIR=$BASE_DIR/build
5+
PICO_SDK_DIR=$BASE_DIR/pico-sdk
86

7+
main() {
98
if [ ! -d "$PICO_SDK_DIR/.git" ]; then
109
git submodule sync --recursive
1110
git submodule update --init --recursive
1211
fi
1312

14-
mkdir -p $BUILD_DIR
15-
cd $BUILD_DIR
16-
cmake ../
17-
make
18-
19-
cd $cur_dir
13+
cmake -B $BUILD_DIR -S $BASE_DIR
14+
make -C $BUILD_DIR
2015
}
2116

2217
main $@

0 commit comments

Comments
 (0)