forked from ctron/rust-esp-container
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bindgen-project
executable file
·30 lines (23 loc) · 899 Bytes
/
bindgen-project
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
set -e
FLAGS=""
FLAGS+=" --sysroot=${ESP_PATH}/xtensa-esp32-elf/sysroot"
FLAGS+=" -I${PROJECT}/build/include"
FLAGS+=" -D__bindgen"
FLAGS+=" -target xtensa"
FLAGS+=" -x c"
while read -r include; do
FLAGS+=" -I${include}"
done <<< "$(find "${IDF_PATH}/components" -maxdepth 3 -name include)"
# Not picked up from above
FLAGS+=" -I${IDF_PATH}/components/lwip/lwip/src/include"
FLAGS+=" -I${IDF_PATH}/components/lwip/port/esp32/include"
FLAGS+=" -I${IDF_PATH}/components/newlib/platform_include"
FLAGS+=" -I${IDF_PATH}/components/lwip/include/apps"
FLAGS+=" -I${IDF_PATH}/components/lwip/include/apps/sntp"
FLAGS+=" -I${IDF_PATH}/components/esp-tls"
: "${BINDGEN_FLAGS:=--use-core --no-layout-tests --ctypes-prefix=libc}"
: "${ESP32_SYS_DIR:=esp32-sys}"
cd "$ESP32_SYS_DIR"
#shellcheck disable=SC2086
bindgen $BINDGEN_FLAGS --output src/bindings.rs src/bindings.h -- $FLAGS