Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/build-arduino-emulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ jobs:

- name: Clone AsyncTCP, Arduino FS headers, lwIP and lwIP contrib
run: |
git clone --depth 1 https://github.com/ESP32Async/AsyncTCP .ci/asynctcp
git clone --depth 1 https://github.com/MitchBradley/PosixAsyncTCP .ci/asynctcp
git clone --depth 1 https://github.com/espressif/arduino-esp32.git .ci/arduino-esp32
git clone --depth 1 https://github.com/lwip-tcpip/lwip.git .ci/lwip
git clone --depth 1 https://git.savannah.nongnu.org/git/lwip/lwip-contrib.git .ci/lwip-contrib

- name: Build with Arduino-Emulator
run: |
cmake -S examples/arduino_emulator -B .ci/arduino-emulator-build/out -G Ninja
cmake --build .ci/arduino-emulator-build/out --target espasyncwebserver --parallel
cmake --build .ci/arduino-emulator-build/out --target espasyncwebserver_host --parallel
chmod +x .ci/arduino-emulator-build/out/espasyncwebserver_host
18 changes: 15 additions & 3 deletions examples/arduino_emulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@ project(espasyncwebserver_host_compile LANGUAGES C CXX)
add_subdirectory(${CMAKE_SOURCE_DIR}/../../.ci/arduino-emulator ${CMAKE_BINARY_DIR}/arduino-emulator)
file(GLOB WEB_SRC "${CMAKE_SOURCE_DIR}/../../src/*.cpp")
add_library(espasyncwebserver STATIC ${WEB_SRC})
add_library(test STATIC
${CMAKE_SOURCE_DIR}/../../.ci/asynctcp/src/AsyncTCP.cpp
${CMAKE_SOURCE_DIR}/../../.ci/arduino-esp32/libraries/FS/src/FS.cpp
${CMAKE_SOURCE_DIR}/../../.ci/arduino-emulator/ArduinoCore-Linux/cores/arduino/libb64/cencode.c
)

target_compile_definitions(espasyncwebserver PUBLIC HOST ARDUINO=10813)
target_include_directories(espasyncwebserver PUBLIC
${CMAKE_SOURCE_DIR}/../../src
${CMAKE_SOURCE_DIR}/../../.ci/asynctcp/src
${CMAKE_SOURCE_DIR}/../../.ci/arduino-esp32/libraries/FS/src
${CMAKE_SOURCE_DIR}/../../.ci/lwip/src/include
${CMAKE_SOURCE_DIR}/../../.ci/lwip-contrib/ports/unix/port/include
${CMAKE_SOURCE_DIR}/host_config
)
target_link_libraries(espasyncwebserver PUBLIC arduino_emulator)

target_compile_definitions(test PUBLIC HOST ARDUINO=10813)
target_include_directories(test PUBLIC
${CMAKE_SOURCE_DIR}/../../.ci/asynctcp/src
${CMAKE_SOURCE_DIR}/../../.ci/arduino-esp32/libraries/FS/src
)
target_link_libraries(test PUBLIC arduino_emulator)

add_executable(espasyncwebserver_host main.cpp)
target_link_libraries(espasyncwebserver_host PRIVATE espasyncwebserver test)
3 changes: 0 additions & 3 deletions examples/arduino_emulator/host_config/freertos/semphr.h

This file was deleted.

11 changes: 0 additions & 11 deletions examples/arduino_emulator/host_config/lwipopts.h

This file was deleted.

3 changes: 0 additions & 3 deletions examples/arduino_emulator/host_config/sdkconfig.h

This file was deleted.

20 changes: 20 additions & 0 deletions examples/arduino_emulator/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <Arduino.h>
#include <ESPAsyncWebServer.h>

static AsyncWebServer server(8080);

void setup() {
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "text/plain", "ESPAsyncWebServer host app is running on port 8080\n");
});

server.onNotFound([](AsyncWebServerRequest *request) {
request->send(404, "text/plain", "Not found\n");
});

server.begin();
}

void loop() {
delay(1000);
}
3 changes: 3 additions & 0 deletions src/ESPAsyncWebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

#include <Arduino.h>
#include <FS.h>

#if !defined(HOST) || __has_include(<lwip/tcpbase.h>)
#include <lwip/tcpbase.h>
#endif

#include <algorithm>
#include <deque>
Expand Down
Loading