Skip to content

Commit c9c03ba

Browse files
committed
build.sh: Allow TOOLCHAIN instead of BUILDROOT
1 parent 7ea0831 commit c9c03ba

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

build.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ fi
1616
declare -r TARGET="${1}"
1717

1818
check_buildroot() {
19-
if ! [[ -d $BUILDROOT ]]; then
20-
echo "Please set the BUILDROOT environment variable"
19+
if [[ -n ${TOOLCHAIN:-} ]] && [[ -d $TOOLCHAIN ]]; then
20+
return
21+
elif ! [[ -d $BUILDROOT ]]; then
22+
echo "Please set the BUILDROOT or TOOLCHAIN environment variable"
2123
exit 1
2224
fi
25+
TOOLCHAIN="${BUILDROOT}/output/host/"
2326
}
2427

2528
make_buildroot() {
29+
if [[ -z ${BUILDROOT:-} ]]; then
30+
return
31+
fi
2632
cd "$BUILDROOT"
2733
local -a deps=(toolchain sdl sdl_image)
2834
if [[ "$TARGET" == retrofw ]]; then
@@ -42,7 +48,7 @@ build() {
4248
cmake .. \
4349
-DCMAKE_BUILD_TYPE=Release \
4450
-DTARGET_PLATFORM="$TARGET" \
45-
-DCMAKE_TOOLCHAIN_FILE="$BUILDROOT/output/host/usr/share/buildroot/toolchainfile.cmake"
51+
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN}/usr/share/buildroot/toolchainfile.cmake"
4652
cmake --build . -j $(getconf _NPROCESSORS_ONLN)
4753
cd -
4854
}

0 commit comments

Comments
 (0)