Tool to embed binary resources

How do I move this post to "General Project Setup" questions? Or could someone do this for me? Many thanks!!!

Are there any plugins or included tools to build resources into the project?
Or are there pre and post build hooks so I could chain the tool from the project directory to run before each build?

For example: Compressing and embedding static webpages. Then having the browser decompress them.

  1. Compress webpage.html as gzip file 7z a -mx9 -tgzip ../indx.gzp index.html -r
  2. Use 1`xxd -p webpage.gzip > webpage.hex``
  3. echo "const unsigned long index_webpage_size = `fgrep -o , webpage.hex | wc -l`;" >> newproject.c.cpp.or.ino
  4. echo "const unsigned char index_webpage[] = {" >> newproject.c.cpp.or.ino
  5. cat webpage.hex >> newproject.c.cpp.or.ino
  6. echo "};" >> Esp32CanReciever.ino
  7. cat original.c.cpp.or.ino >> newproject.c.cpp.or.ino httpclient.send_headers_however("HTTP/1.1 200 OK\r\ncontent-encoding: gzip\r\nContent-Type: text/html\r\n\r\n");

I can use powershell to make this work too. Powershell works on both windows and linux. But maybe there is a better way to write something cross-platform?

I would also like a way to configure a environment variable + pre-compiler flag or something to simply copy it to a micro sd-card and let the code choose to include the sd-card related functionality instead of embedding the resources. But that would be done in the future.

How do I move this post to "General Project Setup" questions?

You can't.

I could, if I knew where such a section existed.

Or are there pre and post build hooks


Thank you! That seems like what I am looking for! Looks a bit complicated. Building a full fledge tool.