esp-idf/examples/build_system/cmake/idf_as_lib/build-esp32p4.sh
2023-08-09 19:33:36 +08:00

18 lines
468 B
Bash

#!/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 .