@@ -99,10 +99,33 @@ shorten_includes() {
99
99
for inc in " ${includes_array[@]} " ; do
100
100
if [[ -n " $inc " ]]; then
101
101
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
103
103
local rel_path=" ${inc# $BUILD_FRAMEWORK_DIR } "
104
104
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
106
129
shortened_includes+=" -iwithprefix/$rel_path "
107
130
fi
108
131
else
@@ -489,19 +512,9 @@ echo " '-Wl,-Map=\"%s\"' % join(\"\${BUILD_DIR}\", \"\${PROGNAME}.map\")"
489
512
echo " ]," >> " $AR_PLATFORMIO_PY "
490
513
echo " " >> " $AR_PLATFORMIO_PY "
491
514
492
- # CPPPATH nur mit generischen Includes und Arduino Core
515
+ # CPPPATH nur mit kopierten Headers
493
516
echo " CPPPATH=[" >> " $AR_PLATFORMIO_PY "
494
517
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
-
505
518
# Bestehende CPPPATH-Logik für kopierte Headers
506
519
REL_INC=" "
507
520
set -- $INCLUDES
0 commit comments