Skip to content

Commit 75501ac

Browse files
authored
Update copy-libs.sh
1 parent 3ce10b7 commit 75501ac

File tree

1 file changed

+68
-60
lines changed

1 file changed

+68
-60
lines changed

tools/copy-libs.sh

Lines changed: 68 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -391,66 +391,6 @@ echo " '-Wl,-Map=\"%s\"' % join(\"\${BUILD_DIR}\", \"\${PROGNAME}.map\")"
391391
echo " ]," >> "$AR_PLATFORMIO_PY"
392392
echo "" >> "$AR_PLATFORMIO_PY"
393393

394-
# include dirs - nur noch Memory-Type und Framework Core
395-
echo " CPPPATH=[" >> "$AR_PLATFORMIO_PY"
396-
echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")), \"include\")," >> "$AR_PLATFORMIO_PY"
397-
echo " join(FRAMEWORK_DIR, \"cores\", board_config.get(\"build.core\"))" >> "$AR_PLATFORMIO_PY"
398-
echo " ]," >> "$AR_PLATFORMIO_PY"
399-
echo "" >> "$AR_PLATFORMIO_PY"
400-
401-
AR_LIBS="$LD_LIBS"
402-
PIO_LIBS=""
403-
set -- $LD_LIBS
404-
for item; do
405-
if [ "$PIO_LIBS" != "" ]; then
406-
PIO_LIBS+=", "
407-
fi
408-
PIO_LIBS+="\"$item\""
409-
done
410-
411-
set -- $LD_LIB_FILES
412-
for item; do
413-
#echo "***** Stripping $item"
414-
"$TOOLCHAIN-strip" -g "$item"
415-
cp "$item" "$AR_SDK/lib/"
416-
done
417-
418-
echo " LIBPATH=[" >> "$AR_PLATFORMIO_PY"
419-
echo " join($PIO_SDK, \"lib\")," >> "$AR_PLATFORMIO_PY"
420-
echo " join($PIO_SDK, \"ld\")," >> "$AR_PLATFORMIO_PY"
421-
echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")))" >> "$AR_PLATFORMIO_PY"
422-
echo " ]," >> "$AR_PLATFORMIO_PY"
423-
echo "" >> "$AR_PLATFORMIO_PY"
424-
425-
echo " LIBS=[" >> "$AR_PLATFORMIO_PY"
426-
echo " $PIO_LIBS" >> "$AR_PLATFORMIO_PY"
427-
echo " ]," >> "$AR_PLATFORMIO_PY"
428-
echo "" >> "$AR_PLATFORMIO_PY"
429-
430-
echo " CPPDEFINES=[" >> "$AR_PLATFORMIO_PY"
431-
set -- $DEFINES
432-
for item; do
433-
item="${item:2}" #remove -D
434-
item="${item/NDEBUG}" #remove NDEBUG
435-
if [[ $item == *"="* ]]; then
436-
item=(${item//=/ })
437-
re='^[+-]?[0-9]+([.][0-9]+)?$'
438-
if [[ ${item[1]} =~ $re ]]; then
439-
echo " (\"${item[0]}\", ${item[1]})," >> "$AR_PLATFORMIO_PY"
440-
else
441-
echo " (\"${item[0]}\", '${item[1]}')," >> "$AR_PLATFORMIO_PY"
442-
fi
443-
else
444-
echo " \"$item\"," >> "$AR_PLATFORMIO_PY"
445-
fi
446-
done
447-
448-
# end generation of platformio-build.py
449-
cat configs/pio_end.txt >> "$AR_PLATFORMIO_PY"
450-
451-
# replace double backslashes with single one
452-
DEFINES=`echo "$DEFINES" | tr -s '\'`
453-
454394
# include dirs
455395
REL_INC=""
456396

@@ -512,6 +452,74 @@ for item; do
512452
fi
513453
done
514454

455+
echo " CPPPATH=[" >> "$AR_PLATFORMIO_PY"
456+
457+
set -- $REL_INC
458+
for item; do
459+
if [ "${item:0:17}" = "-iwithprefixbefore" ]; then
460+
include_path="${item:18}"
461+
echo " join($PIO_SDK, \"include\", \"$include_path\")," >> "$AR_PLATFORMIO_PY"
462+
fi
463+
done
464+
465+
echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")), \"include\")," >> "$AR_PLATFORMIO_PY"
466+
echo " join(FRAMEWORK_DIR, \"cores\", board_config.get(\"build.core\"))" >> "$AR_PLATFORMIO_PY"
467+
echo " ]," >> "$AR_PLATFORMIO_PY"
468+
echo "" >> "$AR_PLATFORMIO_PY"
469+
470+
AR_LIBS="$LD_LIBS"
471+
PIO_LIBS=""
472+
set -- $LD_LIBS
473+
for item; do
474+
if [ "$PIO_LIBS" != "" ]; then
475+
PIO_LIBS+=", "
476+
fi
477+
PIO_LIBS+="\"$item\""
478+
done
479+
480+
set -- $LD_LIB_FILES
481+
for item; do
482+
#echo "***** Stripping $item"
483+
"$TOOLCHAIN-strip" -g "$item"
484+
cp "$item" "$AR_SDK/lib/"
485+
done
486+
487+
echo " LIBPATH=[" >> "$AR_PLATFORMIO_PY"
488+
echo " join($PIO_SDK, \"lib\")," >> "$AR_PLATFORMIO_PY"
489+
echo " join($PIO_SDK, \"ld\")," >> "$AR_PLATFORMIO_PY"
490+
echo " join($PIO_SDK, board_config.get(\"build.arduino.memory_type\", (board_config.get(\"build.flash_mode\", \"dio\") + \"_qspi\")))" >> "$AR_PLATFORMIO_PY"
491+
echo " ]," >> "$AR_PLATFORMIO_PY"
492+
echo "" >> "$AR_PLATFORMIO_PY"
493+
494+
echo " LIBS=[" >> "$AR_PLATFORMIO_PY"
495+
echo " $PIO_LIBS" >> "$AR_PLATFORMIO_PY"
496+
echo " ]," >> "$AR_PLATFORMIO_PY"
497+
echo "" >> "$AR_PLATFORMIO_PY"
498+
499+
echo " CPPDEFINES=[" >> "$AR_PLATFORMIO_PY"
500+
set -- $DEFINES
501+
for item; do
502+
item="${item:2}" #remove -D
503+
item="${item/NDEBUG}" #remove NDEBUG
504+
if [[ $item == *"="* ]]; then
505+
item=(${item//=/ })
506+
re='^[+-]?[0-9]+([.][0-9]+)?$'
507+
if [[ ${item[1]} =~ $re ]]; then
508+
echo " (\"${item[0]}\", ${item[1]})," >> "$AR_PLATFORMIO_PY"
509+
else
510+
echo " (\"${item[0]}\", '${item[1]}')," >> "$AR_PLATFORMIO_PY"
511+
fi
512+
else
513+
echo " \"$item\"," >> "$AR_PLATFORMIO_PY"
514+
fi
515+
done
516+
517+
# end generation of platformio-build.py
518+
cat configs/pio_end.txt >> "$AR_PLATFORMIO_PY"
519+
520+
# replace double backslashes with single one
521+
DEFINES=`echo "$DEFINES" | tr -s '\'`
522+
515523
# copy precompiled libs (if we need them)
516524
function copy_precompiled_lib(){
517525
lib_file="$1"

0 commit comments

Comments
 (0)