Skip to content
Draft
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
1 change: 1 addition & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/Debug/debug.proto
7 changes: 7 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ jobs:
- name: Create build folder
run: mkdir build-emu

- name: Set up Homebrew
if: ${{ ! startsWith(matrix.os, 'macos') }}
uses: Homebrew/actions/setup-homebrew@main

- name: Install protoc/nanopb
run: brew install nanopb

- name: Build WARDuino CLI
run: cmake .. -D BUILD_EMULATOR=ON ; cmake --build .
working-directory: build-emu
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ jobs:
with:
node-version: 20

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@main

- name: Install protoc/nanopb
run: brew install nanopb

- name: Build warduino cli
run: |
cmake . -D BUILD_EMULATOR=ON
Expand Down Expand Up @@ -99,6 +105,12 @@ jobs:
with:
node-version: 20

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@main

- name: Install protoc/nanopb
run: brew install nanopb

- name: Build warduino cli
run: |
cmake . -D BUILD_EMULATOR=ON
Expand Down Expand Up @@ -152,6 +164,12 @@ jobs:
with:
node-version: 20

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@main

- name: Install protoc/nanopb
run: brew install nanopb

- name: Build warduino cli
run: |
cmake . -D BUILD_EMULATOR=ON
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.idea/
.air/
.vscode/
.ccls

.cache

*.bin
*.ipch
*.o
Expand Down Expand Up @@ -35,3 +38,4 @@ core
venv

*.wasm

22 changes: 19 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,26 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
set(WARDUINO_VERSION_STRING "${PROJECT_VERSION}")
configure_file(src/config.h.in include/warduino/config.h)

# Both host targets use one generated nanopb schema target.
if (BUILD_EMULATOR OR BUILD_UNITTEST)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
include(FetchContent)
FetchContent_Declare(
nanopb
GIT_REPOSITORY https://github.com/nanopb/nanopb.git
GIT_TAG 0.4.9.1
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(nanopb)
set(NANOPB_SRC_ROOT_FOLDER ${nanopb_SOURCE_DIR})
find_program(NANOPB_GENERATOR_PLUGIN NAMES protoc-gen-nanopb REQUIRED)
find_package(Nanopb REQUIRED)
nanopb_generate_cpp(TARGET proto src/Debug/debug.proto)
endif ()

# Build the emulator version of WARDuino
if (BUILD_EMULATOR)
set(EXTERNAL_LIB_HEADERS lib/json/single_include)

find_package(Threads REQUIRED)

set(SOURCE_FILES
Expand Down Expand Up @@ -71,7 +87,7 @@ if (BUILD_EMULATOR)

# WARDuino CLI
add_executable(wdcli platforms/CLI-Emulator/main.cpp ${SOURCE_FILES})
target_link_libraries(wdcli PRIVATE Threads::Threads)
target_link_libraries(wdcli PRIVATE Threads::Threads proto)
target_include_directories(wdcli PRIVATE ${EXTERNAL_LIB_HEADERS} "${PROJECT_BINARY_DIR}/include")
endif (BUILD_EMULATOR)

Expand Down Expand Up @@ -122,7 +138,7 @@ if (BUILD_UNITTEST)
get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE)
message(DEBUG "Add executable for " ${TEST_FILE})
add_executable(${TEST_NAME} ${TEST_FILE} ${SOURCE_FILES} ${SHARED_SRC})
target_link_libraries(${TEST_NAME} PRIVATE doctest::doctest)
target_link_libraries(${TEST_NAME} PRIVATE doctest::doctest proto)
target_include_directories(${TEST_NAME} PRIVATE ${EXTERNAL_LIB_HEADERS} "${PROJECT_BINARY_DIR}/include")
add_test(${TEST_NAME} ${TEST_NAME})
endforeach ()
Expand Down
Loading
Loading