Hacker News new | ask | show | jobs
by simonw 91 days ago
Here's the build script that uses: https://github.com/ghostty-org/ghostling/blob/main/bin2heade...

I ran it against a 1x1 pixel GIF:

  cmake -DINPUT=pixel.gif -DOUTPUT=pixel.h -DARRAY_NAME=pixel_gif -P bin2header.cmake
And got this:

  // Auto-generated from /private/tmp/exp/pixel.gif — do not edit.
  static const unsigned char pixel_gif[] = {
      0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, 
      0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 
      0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3b
  };
1 comments

Interestingly, cmake 4.3 just added a builtin command 'bin2c':

https://cmake.org/cmake/help/v4.3/manual/cmake.1.html#cmdopt...

...it will probably take a decade or two until Debian-based Linux distros will get cmake 4.3 though ;)