Skip to content

Commit e56da36

Browse files
authored
Update copy-libs.sh
1 parent 1651308 commit e56da36

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

tools/copy-libs.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,62 @@ echo " CPPPATH=[" >> "$AR_PLATFORMIO_PY"
397397

398398
set -- $INCLUDES
399399

400+
for item; do
401+
if [[ "$item" != $PWD ]]; then
402+
ipath="$item"
403+
fname=`basename "$ipath"`
404+
dname=`basename $(dirname "$ipath")`
405+
if [[ "$fname" == "main" && "$dname" == $(basename "$PWD") ]]; then
406+
continue
407+
fi
408+
while [[ "$dname" != "components" && "$dname" != "managed_components" && "$dname" != "build" ]]; do
409+
ipath=`dirname "$ipath"`
410+
fname=`basename "$ipath"`
411+
dname=`basename $(dirname "$ipath")`
412+
done
413+
if [[ "$fname" == "arduino" ]]; then
414+
continue
415+
fi
416+
if [[ "$fname" == "config" ]]; then
417+
continue
418+
fi
419+
420+
out_sub="${item#*$ipath}"
421+
out_cpath="$AR_SDK/include/$fname$out_sub"
422+
REL_INC+="-iwithprefixbefore $fname$out_sub "
423+
if [ "$out_sub" = "" ]; then
424+
# echo " join($PIO_SDK, \"include\", \"$fname\")," >> "$AR_PLATFORMIO_PY"
425+
else
426+
pio_sub="${out_sub:1}"
427+
pio_sub=`echo $pio_sub | sed 's/\//\\", \\"/g'`
428+
# echo " join($PIO_SDK, \"include\", \"$fname\", \"$pio_sub\")," >> "$AR_PLATFORMIO_PY"
429+
fi
430+
for f in `find "$item" -name '*.h'`; do
431+
rel_f=${f#*$item}
432+
rel_p=${rel_f%/*}
433+
mkdir -p "$out_cpath$rel_p"
434+
cp -n $f "$out_cpath$rel_p/"
435+
done
436+
for f in `find "$item" -name '*.hpp'`; do
437+
rel_f=${f#*$item}
438+
rel_p=${rel_f%/*}
439+
mkdir -p "$out_cpath$rel_p"
440+
cp -n $f "$out_cpath$rel_p/"
441+
done
442+
for f in `find "$item" -name '*.inc'`; do
443+
rel_f=${f#*$item}
444+
rel_p=${rel_f%/*}
445+
mkdir -p "$out_cpath$rel_p"
446+
cp -n $f "$out_cpath$rel_p/"
447+
done
448+
# Temporary measure to fix issues caused by https://github.com/espressif/esp-idf/commit/dc4731101dd567cc74bbe4d0f03afe52b7db9afb#diff-1d2ce0d3989a80830fdf230bcaafb3117f32046d16cf46616ac3d55b4df2a988R17
449+
if [[ "$fname" == "bt" && "$out_sub" == "/include/$IDF_TARGET/include" && -f "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" ]]; then
450+
mkdir -p "$AR_SDK/include/$fname/controller/$IDF_TARGET"
451+
cp -n "$ipath/controller/$IDF_TARGET/esp_bt_cfg.h" "$AR_SDK/include/$fname/controller/$IDF_TARGET/esp_bt_cfg.h"
452+
fi
453+
fi
454+
done
455+
400456
echo " \"-iprefix \" + join($PIO_SDK, \"include\") + \" @\" + join($PIO_SDK, \"flags\", \"includes\")," >> "$AR_PLATFORMIO_PY"
401457
echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")), \"include\")," >> "$AR_PLATFORMIO_PY"
402458
echo " join(FRAMEWORK_DIR, \"cores\", board_config.get(\"build.core\"))" >> "$AR_PLATFORMIO_PY"

0 commit comments

Comments
 (0)