Skip to content

Commit ca7c83b

Browse files
committed
Add CI for Arduino-Emulator
1 parent 4ccec50 commit ca7c83b

5 files changed

Lines changed: 37 additions & 31 deletions

File tree

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

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,38 +43,14 @@ jobs:
4343
run: |
4444
git clone --depth 1 --recurse-submodules https://github.com/pschatzmann/Arduino-Emulator.git .ci/arduino-emulator
4545
46-
- name: Generate host build project
46+
- name: Clone AsyncTCP, Arduino FS headers, lwIP and lwIP contrib
4747
run: |
48-
mkdir -p .ci/arduino-emulator-build
49-
cat > .ci/arduino-emulator-build/CMakeLists.txt <<'EOF'
50-
cmake_minimum_required(VERSION 3.11)
51-
project(espasyncwebserver_host_build LANGUAGES C CXX)
52-
53-
add_subdirectory(${CMAKE_SOURCE_DIR}/../arduino-emulator ${CMAKE_BINARY_DIR}/arduino-emulator)
54-
include(${CMAKE_SOURCE_DIR}/../arduino-emulator/Arduino.cmake)
55-
56-
arduino_library(asynctcp "$ENV{ASYNCTCP_REPO}" TAG "$ENV{ASYNCTCP_REF}")
57-
arduino_library(espasyncwebserver "${CMAKE_SOURCE_DIR}/../..")
58-
59-
arduino_sketch(host-build-check host-build-check.ino LIBRARIES asynctcp espasyncwebserver DEFINITIONS HOST)
60-
EOF
61-
62-
cat > .ci/arduino-emulator-build/host-build-check.ino <<'EOF'
63-
#include <Arduino.h>
64-
#include <ESPAsyncWebServer.h>
65-
66-
AsyncWebServer server(80);
67-
68-
void setup() {
69-
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
70-
request->send(200, "text/plain", "host-ok");
71-
});
72-
}
73-
74-
void loop() {}
75-
EOF
48+
git clone --depth 1 --branch "${ASYNCTCP_REF}" "${ASYNCTCP_REPO}" .ci/asynctcp
49+
git clone --depth 1 https://github.com/espressif/arduino-esp32.git .ci/arduino-esp32
50+
git clone --depth 1 https://github.com/lwip-tcpip/lwip.git .ci/lwip
51+
git clone --depth 1 https://git.savannah.nongnu.org/git/lwip/lwip-contrib.git .ci/lwip-contrib
7652
7753
- name: Build with Arduino-Emulator
7854
run: |
79-
cmake -S .ci/arduino-emulator-build -B .ci/arduino-emulator-build/out -G Ninja
80-
cmake --build .ci/arduino-emulator-build/out --parallel
55+
cmake -S arduino_emulator_example -B .ci/arduino-emulator-build/out -G Ninja
56+
cmake --build .ci/arduino-emulator-build/out --target espasyncwebserver --parallel
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cmake_minimum_required(VERSION 3.11)
2+
project(espasyncwebserver_host_compile LANGUAGES C CXX)
3+
4+
add_subdirectory(${CMAKE_SOURCE_DIR}/../.ci/arduino-emulator ${CMAKE_BINARY_DIR}/arduino-emulator)
5+
file(GLOB WEB_SRC "${CMAKE_SOURCE_DIR}/../src/*.cpp")
6+
add_library(espasyncwebserver STATIC ${WEB_SRC})
7+
8+
target_compile_definitions(espasyncwebserver PUBLIC HOST ARDUINO=10813)
9+
target_include_directories(espasyncwebserver PUBLIC
10+
${CMAKE_SOURCE_DIR}/../src
11+
${CMAKE_SOURCE_DIR}/../.ci/asynctcp/src
12+
${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}
16+
)
17+
target_link_libraries(espasyncwebserver PUBLIC arduino_emulator)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
typedef void *SemaphoreHandle_t;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#pragma once
2+
3+
#define NO_SYS 1
4+
#define LWIP_SOCKET 0
5+
#define LWIP_NETCONN 0
6+
#define LWIP_TCP 1
7+
#define LWIP_IPV6 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#define LWIP_IPV6 1

0 commit comments

Comments
 (0)