build_examples.sh 994 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. #
  3. # Build all examples from the examples directory, out of tree to
  4. # ensure they can run when copied to a new directory.
  5. #
  6. # Runs as part of CI process.
  7. #
  8. # Assumes CWD is an out-of-tree build directory, and will copy examples to individual subdirectories, one by one.
  9. #
  10. [ -z ${IDF_PATH} ] && echo "IDF_PATH is not set" && exit 1
  11. EXAMPLE_NUM=1
  12. RESULT=0
  13. set -e
  14. for example in ${IDF_PATH}/examples/*; do
  15. [ -f ${example}/Makefile ] || continue
  16. echo "Building ${example} as ${EXAMPLE_NUM}..."
  17. mkdir ${EXAMPLE_NUM}
  18. cp -r ${example} ${EXAMPLE_NUM}
  19. pushd ${EXAMPLE_NUM}/`basename ${example}`
  20. # be stricter in the CI build than the default IDF settings
  21. export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
  22. export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
  23. # build non-verbose first, only build verbose if there's an error
  24. (make clean defconfig && make all ) || (RESULT=$?; make V=1)
  25. popd
  26. EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
  27. done
  28. exit $RESULT