build.sh 468 B

1234567891011121314151617
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. PARAM=""
  4. # Retrive the target from the current filename, if no target specified,
  5. # the variable will be empty
  6. TARGET=$(echo $0 | cut -s -f2 -d- | cut -s -f1 -d.)
  7. if [[ -n $TARGET ]]
  8. then
  9. # Target is not null, specify the build parameters
  10. PARAM="-DCMAKE_TOOLCHAIN_FILE=$IDF_PATH/tools/cmake/toolchain-${TARGET}.cmake -DTARGET=${TARGET} -GNinja"
  11. fi
  12. rm -rf build && mkdir build && cd build
  13. cmake .. $PARAM
  14. cmake --build .