esp-idf/examples/build_system/cmake/idf_as_lib/build-esp32p4.sh

18 lines
468 B
Bash
Raw Normal View History

2023-08-07 02:16:53 -04:00
#!/usr/bin/env bash
set -euo pipefail
PARAM=""
# Retrive the target from the current filename, if no target specified,
# the variable will be empty
TARGET=$(echo $0 | cut -s -f2 -d- | cut -s -f1 -d.)
if [[ -n $TARGET ]]
then
# Target is not null, specify the build parameters
PARAM="-DCMAKE_TOOLCHAIN_FILE=$IDF_PATH/tools/cmake/toolchain-${TARGET}.cmake -DTARGET=${TARGET} -GNinja"
fi
rm -rf build && mkdir build && cd build
cmake .. $PARAM
cmake --build .