Skip to content

Commit 5b9cfb3

Browse files
Fix Arduino Emulator CI to produce an executable with https://github.com/MitchBradley/PosixAsyncTCP (#423)
1 parent c25aabc commit 5b9cfb3

7 files changed

Lines changed: 41 additions & 24 deletions

File tree

.github/workflows/build-arduino-emulator.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ jobs:
4141
4242
- name: Clone AsyncTCP, Arduino FS headers, lwIP and lwIP contrib
4343
run: |
44-
git clone --depth 1 https://github.com/ESP32Async/AsyncTCP .ci/asynctcp
44+
git clone --depth 1 https://github.com/MitchBradley/PosixAsyncTCP .ci/asynctcp
4545
git clone --depth 1 https://github.com/espressif/arduino-esp32.git .ci/arduino-esp32
46-
git clone --depth 1 https://github.com/lwip-tcpip/lwip.git .ci/lwip
47-
git clone --depth 1 https://git.savannah.nongnu.org/git/lwip/lwip-contrib.git .ci/lwip-contrib
4846
4947
- name: Build with Arduino-Emulator
5048
run: |
5149
cmake -S examples/arduino_emulator -B .ci/arduino-emulator-build/out -G Ninja
52-
cmake --build .ci/arduino-emulator-build/out --target espasyncwebserver --parallel
50+
cmake --build .ci/arduino-emulator-build/out --target espasyncwebserver_host --parallel
51+
chmod +x .ci/arduino-emulator-build/out/espasyncwebserver_host

examples/arduino_emulator/CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,26 @@ project(espasyncwebserver_host_compile LANGUAGES C CXX)
44
add_subdirectory(${CMAKE_SOURCE_DIR}/../../.ci/arduino-emulator ${CMAKE_BINARY_DIR}/arduino-emulator)
55
file(GLOB WEB_SRC "${CMAKE_SOURCE_DIR}/../../src/*.cpp")
66
add_library(espasyncwebserver STATIC ${WEB_SRC})
7+
add_library(test STATIC
8+
${CMAKE_SOURCE_DIR}/../../.ci/asynctcp/src/AsyncTCP.cpp
9+
${CMAKE_SOURCE_DIR}/../../.ci/arduino-esp32/libraries/FS/src/FS.cpp
10+
${CMAKE_SOURCE_DIR}/../../.ci/arduino-emulator/ArduinoCore-Linux/cores/arduino/libb64/cencode.c
11+
)
712

813
target_compile_definitions(espasyncwebserver PUBLIC HOST ARDUINO=10813)
914
target_include_directories(espasyncwebserver PUBLIC
1015
${CMAKE_SOURCE_DIR}/../../src
1116
${CMAKE_SOURCE_DIR}/../../.ci/asynctcp/src
1217
${CMAKE_SOURCE_DIR}/../../.ci/arduino-esp32/libraries/FS/src
13-
${CMAKE_SOURCE_DIR}/../../.ci/lwip/src/include
14-
${CMAKE_SOURCE_DIR}/../../.ci/lwip-contrib/ports/unix/port/include
15-
${CMAKE_SOURCE_DIR}/host_config
1618
)
1719
target_link_libraries(espasyncwebserver PUBLIC arduino_emulator)
20+
21+
target_compile_definitions(test PUBLIC HOST ARDUINO=10813)
22+
target_include_directories(test PUBLIC
23+
${CMAKE_SOURCE_DIR}/../../.ci/asynctcp/src
24+
${CMAKE_SOURCE_DIR}/../../.ci/arduino-esp32/libraries/FS/src
25+
)
26+
target_link_libraries(test PUBLIC arduino_emulator)
27+
28+
add_executable(espasyncwebserver_host main.cpp)
29+
target_link_libraries(espasyncwebserver_host PRIVATE espasyncwebserver test)

examples/arduino_emulator/host_config/freertos/semphr.h

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/arduino_emulator/host_config/lwipopts.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/arduino_emulator/host_config/sdkconfig.h

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/arduino_emulator/main.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <Arduino.h>
2+
#include <ESPAsyncWebServer.h>
3+
4+
static AsyncWebServer server(8080);
5+
6+
void setup() {
7+
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
8+
request->send(200, "text/plain", "ESPAsyncWebServer host app is running on port 8080\n");
9+
});
10+
11+
server.onNotFound([](AsyncWebServerRequest *request) {
12+
request->send(404, "text/plain", "Not found\n");
13+
});
14+
15+
server.begin();
16+
}
17+
18+
void loop() {
19+
delay(1000);
20+
}

src/ESPAsyncWebServer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
#include <Arduino.h>
77
#include <FS.h>
8+
9+
#if !defined(HOST) || __has_include(<lwip/tcpbase.h>)
810
#include <lwip/tcpbase.h>
11+
#endif
912

1013
#include <algorithm>
1114
#include <deque>

0 commit comments

Comments
 (0)