-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BREAKING] Move and update many component implementations to support …
…litgen-based pybind11 generation to overhaul python library (#291) * Update file system and cli to have guards around ESP-specific code and start fleshing out the espp library * fleshing out library and updating how external libraries are copied; added color and event manager * add simple cli test * WIP trying to use litgen to automatically generate the python bindings 🚀 * WIP move implementation from header to source files so litgen can parse them effectively * WIP update cmakelists * WIP continuing to flesh out automatic binding support * fix: move task auto to header * update color, add missing pragma to fomatters files * fixed unmatched suppression * add missing task scope * working on configuring binding generator * update math components to better support autogenerating bindings * WIP trying to get more of the bindings working... * having to manually modify generated bindings... -.- * generated python docs * add requirements and gitignore * wip trying to get binding to work better * update gaussian so that alpha/beta/gamma class members are public instead of having getter/setter functions for them with the same name * WIP removed autogenerated default constructors for bezier, gaussian, task, timer, socket, tcpsocket, udpsocket and fixed autogenerated bindings. trying to get autogeneration to work for template classes * update python tests; ensure complete scoping for config members to facilitate proper binding generation; remove TcpTransmitConfig from detail namespace and update it to be TcpSocket::TransmitConfig with alternate workaround for gcc bug; updated ftp and rtsp accordingly * WIP trying to flesh out the bindings some more. still have to do a lot of manual editing of the generated bindings file, but it is way better than having to write the whole thing from scratch * revert back to implementation in main header even though it breaks litgen * minor update * move run_on_core out of espp::Task class and into espp::task namespace * update bindings * fix i2c * remove accidentally added i2c files * add missing param doc * add more explicit scoping * minor updates * update cmakelists to install magic enum headers correctly * minor update to support running examples on qtpy s3 * add some notes to the binding generator * update to generate into espp instead of espp_lib * add build library workflow * move sys/stdio.h to stdio.h for linux compat * update github action to support windows * update build to use cmake completely for better x-plat compat * WIP windows library * add simple readme * minor update * starting work on porting socket to windows * fix cmake * WIP windows support * comment out windows build for now * update bindings * feat(math): update gaussian to have getter/setter methods instead of public members * update bindings * update to use pybind11_add_module to simplify cmake lists, add windows build script, and update to build for release * update ci library build * ensure return code * update python bindings * use direct commands to get proper error status * update file system to use std::filesystem when not on esp-idf * clean up file system includes * update ftp to remove use of posix functions and replace with only std::filesystem or espp::FileSystem * explicit scoping * some more explicit scoping * more explicit * try to undefine logger verbosity enums since windows is complaining about them... * WIP trying to make socket a little more x-plat friendly * fix sa * include winsock in "C" linkage * WIP msvc is kinda stupid about include headers so we have to add some shit to the beginning of every file which includes one of the socket files... -.- * WIP getting windows build working * WIP added support for tabulate on msvc * updated to get closer to working compilation on windows * add note * test uplaoding output folder * update to v4 * disable reuseaddr on windows * update how msc_ver is checked * update install and ensure that pc can work * fix(socket): update to properly initialize socket library on windows before configuring socket. updated error logging to work across platforms * add pc tests for udp client/server and update build scripts accordingly * minor update * minor update * update readmes
- Loading branch information
Showing
92 changed files
with
8,761 additions
and
2,624 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Build Host C++ / Python Libraries | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_windows: | ||
|
||
runs-on: windows-latest | ||
continue-on-error: false | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Build libraries | ||
working-directory: lib/ | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. | ||
cmake --build . --config Release --target install | ||
- name: Upload output folder | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libespp_windows | ||
path: lib/pc | ||
|
||
build_linux: | ||
|
||
runs-on: ubuntu-latest | ||
continue-on-error: false | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Build libraries | ||
working-directory: lib/ | ||
run: | | ||
./build.sh | ||
- name: Upload output folder | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libespp_linux | ||
path: lib/pc | ||
|
||
build_macos: | ||
|
||
runs-on: macos-latest | ||
continue-on-error: false | ||
|
||
steps: | ||
- name: Setup XCode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: latest-stable | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
fetch-depth: 0 | ||
|
||
- name: Build libraries | ||
working-directory: lib/ | ||
run: | | ||
./build.sh | ||
- name: Upload output folder | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libespp_macos | ||
path: lib/pc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#pragma once | ||
|
||
#include "format.hpp" | ||
|
||
// for allowing easy serialization/printing of the | ||
// Rgb | ||
template <> struct fmt::formatter<espp::Rgb> { | ||
// Presentation format: 'f' - floating [0,1] (default), 'd' - integer [0,255], 'x' - hex integer. | ||
char presentation = 'f'; | ||
|
||
template <typename ParseContext> constexpr auto parse(ParseContext &ctx) { | ||
// Parse the presentation format and store it in the formatter: | ||
auto it = ctx.begin(), end = ctx.end(); | ||
if (it != end && (*it == 'f' || *it == 'd' || *it == 'x')) | ||
presentation = *it++; | ||
|
||
// TODO: Check if reached the end of the range: | ||
// if (it != end && *it != '}') throw format_error("invalid format"); | ||
|
||
// Return an iterator past the end of the parsed range: | ||
return it; | ||
} | ||
|
||
template <typename FormatContext> auto format(espp::Rgb const &rgb, FormatContext &ctx) const { | ||
switch (presentation) { | ||
case 'f': | ||
return fmt::format_to(ctx.out(), "({}, {}, {})", rgb.r, rgb.g, rgb.b); | ||
case 'd': | ||
return fmt::format_to(ctx.out(), "({}, {}, {})", static_cast<int>(rgb.r * 255), | ||
static_cast<int>(rgb.g * 255), static_cast<int>(rgb.b * 255)); | ||
case 'x': | ||
return fmt::format_to(ctx.out(), "{:#08X}", rgb.hex()); | ||
default: | ||
// shouldn't get here! | ||
return fmt::format_to(ctx.out(), "({}, {}, {})", rgb.r, rgb.g, rgb.b); | ||
} | ||
} | ||
}; | ||
|
||
// for allowing easy serialization/printing of the | ||
// Hsv | ||
template <> struct fmt::formatter<espp::Hsv> { | ||
template <typename ParseContext> constexpr auto parse(ParseContext &ctx) const { | ||
return ctx.begin(); | ||
} | ||
|
||
template <typename FormatContext> auto format(espp::Hsv const &hsv, FormatContext &ctx) const { | ||
return fmt::format_to(ctx.out(), "({}, {}, {})", hsv.h, hsv.s, hsv.v); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.