Skip to content

Commit ac29082

Browse files
authored
Update copy-libs.sh
1 parent 08cbc3c commit ac29082

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

tools/copy-libs.sh

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,33 @@ shorten_includes() {
9999
for inc in "${includes_array[@]}"; do
100100
if [[ -n "$inc" ]]; then
101101
if is_framework_subfolder "$inc"; then
102-
# Berechne relativen Pfad (analog zu Python os.path.relpath)
102+
# Mappe auf die kopierte Struktur im Arduino Framework
103103
local rel_path="${inc#$BUILD_FRAMEWORK_DIR}"
104104
rel_path="${rel_path#/}" # Entferne führenden Slash
105-
if [[ -n "$rel_path" ]]; then
105+
106+
# Konvertiere ESP-IDF Pfad zu Arduino Framework Pfad
107+
if [[ "$rel_path" == "components/"* ]]; then
108+
# components/freertos/include -> include/freertos
109+
local component_path="${rel_path#components/}"
110+
local component_name="${component_path%%/*}"
111+
local sub_path="${component_path#*/}"
112+
if [[ "$sub_path" == "include" ]]; then
113+
shortened_includes+=" -iwithprefix/include/$component_name"
114+
else
115+
shortened_includes+=" -iwithprefix/include/$component_name/$sub_path"
116+
fi
117+
elif [[ "$rel_path" == "managed_components/"* ]]; then
118+
# managed_components/esp32-camera/include -> include/esp32-camera
119+
local component_path="${rel_path#managed_components/}"
120+
local component_name="${component_path%%/*}"
121+
local sub_path="${component_path#*/}"
122+
if [[ "$sub_path" == "include" ]]; then
123+
shortened_includes+=" -iwithprefix/include/$component_name"
124+
else
125+
shortened_includes+=" -iwithprefix/include/$component_name/$sub_path"
126+
fi
127+
else
128+
# Andere Pfade direkt mappen
106129
shortened_includes+=" -iwithprefix/$rel_path"
107130
fi
108131
else
@@ -489,19 +512,9 @@ echo " '-Wl,-Map=\"%s\"' % join(\"\${BUILD_DIR}\", \"\${PROGNAME}.map\")"
489512
echo " ]," >> "$AR_PLATFORMIO_PY"
490513
echo "" >> "$AR_PLATFORMIO_PY"
491514

492-
# CPPPATH nur mit generischen Includes und Arduino Core
515+
# CPPPATH nur mit kopierten Headers
493516
echo " CPPPATH=[" >> "$AR_PLATFORMIO_PY"
494517

495-
# Füge generische (nicht-Framework) Includes hinzu
496-
if [[ -n "$GENERIC_INCLUDES" ]]; then
497-
IFS=' ' read -ra generic_array <<< "$GENERIC_INCLUDES"
498-
for inc in "${generic_array[@]}"; do
499-
if [[ -n "$inc" ]]; then
500-
echo " \"$inc\"," >> "$AR_PLATFORMIO_PY"
501-
fi
502-
done
503-
fi
504-
505518
# Bestehende CPPPATH-Logik für kopierte Headers
506519
REL_INC=""
507520
set -- $INCLUDES

0 commit comments

Comments
 (0)